Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
Time._deserialize
(self, value, attr, data, **kwargs)
Deserialize an ISO8601-formatted time to a :class:`datetime.time` object.
Deserialize an ISO8601-formatted time to a :class:`datetime.time` object.
def _deserialize(self, value, attr, data, **kwargs): """Deserialize an ISO8601-formatted time to a :class:`datetime.time` object.""" if not value: # falsy values are invalid raise self.make_error("invalid") try: return utils.from_iso_time(value) except (Attribute...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "attr", ",", "data", ",", "*", "*", "kwargs", ")", ":", "if", "not", "value", ":", "# falsy values are invalid", "raise", "self", ".", "make_error", "(", "\"invalid\"", ")", "try", ":", "return", "ut...
[ 1311, 4 ]
[ 1318, 55 ]
python
en
['en', 'en', 'en']
True
test_suite_demo_on_context_with_no_datasources
( mock_webbrowser, mock_subprocess, caplog, empty_data_context )
We call the "suite demo" command on a data context that has no datasources configured. The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
We call the "suite demo" command on a data context that has no datasources configured.
def test_suite_demo_on_context_with_no_datasources( mock_webbrowser, mock_subprocess, caplog, empty_data_context ): """ We call the "suite demo" command on a data context that has no datasources configured. The command should: - exit with a clear error message - NOT open Data Docs - NOT...
[ "def", "test_suite_demo_on_context_with_no_datasources", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ")", ":", "project_root_dir", "=", "empty_data_context", ".", "root_directory", "root_dir", "=", "project_root_dir", "runner", ...
[ 38, 0 ]
[ 70, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_demo_enter_existing_suite_name_as_arg
( mock_webbrowser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, )
We call the "suite demo" command with the name of an existing expectation suite in the --suite argument The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
We call the "suite demo" command with the name of an existing expectation suite in the --suite argument
def test_suite_demo_enter_existing_suite_name_as_arg( mock_webbrowser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, ): """ We call the "suite demo" command with the name of an existing expectation suite in the --suite argument The command should: - exit wit...
[ "def", "test_suite_demo_enter_existing_suite_name_as_arg", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "data_context_parameterized_expectation_suite", ",", ")", ":", "not_so_empty_data_context", "=", "data_context_parameterized_expectation_suite", "project_roo...
[ 75, 0 ]
[ 131, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_demo_answer_suite_name_prompts_with_name_of_existing_suite
( mock_webbrowser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, )
We call the "suite demo" command without the suite name argument The command should: - prompt us to enter the name of the expectation suite that will be created. We answer the prompt with the name of an existing expectation suite. - display an error message and let us retry until we answer wi...
We call the "suite demo" command without the suite name argument
def test_suite_demo_answer_suite_name_prompts_with_name_of_existing_suite( mock_webbrowser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, ): """ We call the "suite demo" command without the suite name argument The command should: - prompt ...
[ "def", "test_suite_demo_answer_suite_name_prompts_with_name_of_existing_suite", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "data_context_parameterized_expectation_suite", ",", "filesystem_csv_2", ",", ")", ":", "not_so_empty_data_context", "=", "data_contex...
[ 136, 0 ]
[ 212, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_new_creates_empty_suite
( mock_webbroser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, )
Running "suite new" should: - make an empty suite - open jupyter - NOT open data docs
Running "suite new" should: - make an empty suite - open jupyter - NOT open data docs
def test_suite_new_creates_empty_suite( mock_webbroser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, ): """ Running "suite new" should: - make an empty suite - open jupyter - NOT open data docs """ project_root_dir = data_contex...
[ "def", "test_suite_new_creates_empty_suite", "(", "mock_webbroser", ",", "mock_subprocess", ",", "caplog", ",", "data_context_parameterized_expectation_suite", ",", "filesystem_csv_2", ",", ")", ":", "project_root_dir", "=", "data_context_parameterized_expectation_suite", ".", ...
[ 217, 0 ]
[ 297, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_new_empty_with_no_jupyter
( mock_webbroser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, )
Running "suite new --no-jupyter" should: - make an empty suite - NOT open jupyter - NOT open data docs
Running "suite new --no-jupyter" should: - make an empty suite - NOT open jupyter - NOT open data docs
def test_suite_new_empty_with_no_jupyter( mock_webbroser, mock_subprocess, caplog, data_context_parameterized_expectation_suite, filesystem_csv_2, ): """ Running "suite new --no-jupyter" should: - make an empty suite - NOT open jupyter - NOT open data docs """ os.mkdir( ...
[ "def", "test_suite_new_empty_with_no_jupyter", "(", "mock_webbroser", ",", "mock_subprocess", ",", "caplog", ",", "data_context_parameterized_expectation_suite", ",", "filesystem_csv_2", ",", ")", ":", "os", ".", "mkdir", "(", "os", ".", "path", ".", "join", "(", "d...
[ 302, 0 ]
[ 376, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_demo_one_datasource_without_generator_without_suite_name_argument
( mock_webbrowser, mock_subprocess, caplog, empty_data_context, filesystem_csv_2 )
We call the "suite demo" command without the suite name argument The command should: - NOT prompt us to choose a datasource (because there is only one) - prompt us only to enter the path (The datasource has no generator configured and not to choose from the generator's list of available data ...
We call the "suite demo" command without the suite name argument
def test_suite_demo_one_datasource_without_generator_without_suite_name_argument( mock_webbrowser, mock_subprocess, caplog, empty_data_context, filesystem_csv_2 ): """ We call the "suite demo" command without the suite name argument The command should: - NOT prompt us to choose a datasource (becau...
[ "def", "test_suite_demo_one_datasource_without_generator_without_suite_name_argument", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ",", "filesystem_csv_2", ")", ":", "empty_data_context", ".", "add_datasource", "(", "\"my_datasource\"...
[ 381, 0 ]
[ 456, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_demo_multiple_datasources_with_generator_without_suite_name_argument
( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, )
We call the "suite demo" command without the suite name argument - The data context has two datasources - we choose one of them. - It has a generator configured. We choose to use the generator and select a generator asset from the list. - The command should prompt us to enter the name of the expec...
We call the "suite demo" command without the suite name argument
def test_suite_demo_multiple_datasources_with_generator_without_suite_name_argument( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, ): """ We call the "suite demo" command without the suite name argument - The data context has two da...
[ "def", "test_suite_demo_multiple_datasources_with_generator_without_suite_name_argument", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "site_builder_data_context_v013_with_html_store_titanic_random", ",", ")", ":", "root_dir", "=", "(", "site_builder_data_conte...
[ 461, 0 ]
[ 543, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_demo_multiple_datasources_with_generator_with_suite_name_argument
( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, )
We call the "suite demo" command with the suite name argument - The data context has two datasources - we choose one of them. - It has a generator configured. We choose to use the generator and select a generator asset from the list. - open Data Docs - NOT open jupyter
We call the "suite demo" command with the suite name argument
def test_suite_demo_multiple_datasources_with_generator_with_suite_name_argument( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, ): """ We call the "suite demo" command with the suite name argument - The data context has two datasour...
[ "def", "test_suite_demo_multiple_datasources_with_generator_with_suite_name_argument", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "site_builder_data_context_v013_with_html_store_titanic_random", ",", ")", ":", "root_dir", "=", "(", "site_builder_data_context_...
[ 548, 0 ]
[ 615, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_without_suite_name_raises_error
()
This is really only testing click missing arguments
This is really only testing click missing arguments
def test_suite_edit_without_suite_name_raises_error(): """This is really only testing click missing arguments""" runner = CliRunner(mix_stderr=False) result = runner.invoke(cli, "suite edit", catch_exceptions=False) assert result.exit_code == 2 assert ( 'Error: Missing argument "SUITE".' in ...
[ "def", "test_suite_edit_without_suite_name_raises_error", "(", ")", ":", "runner", "=", "CliRunner", "(", "mix_stderr", "=", "False", ")", "result", "=", "runner", ".", "invoke", "(", "cli", ",", "\"suite edit\"", ",", "catch_exceptions", "=", "False", ")", "ass...
[ 618, 0 ]
[ 626, 5 ]
python
en
['en', 'en', 'en']
True
test_suite_edit_with_invalid_json_batch_kwargs_raises_helpful_error
( mock_webbrowser, mock_subprocess, caplog, empty_data_context )
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
def test_suite_edit_with_invalid_json_batch_kwargs_raises_helpful_error( mock_webbrowser, mock_subprocess, caplog, empty_data_context ): """ The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter """ project_dir = empty_data_context.root_directory ...
[ "def", "test_suite_edit_with_invalid_json_batch_kwargs_raises_helpful_error", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ")", ":", "project_dir", "=", "empty_data_context", ".", "root_directory", "context", "=", "DataContext", "(...
[ 631, 0 ]
[ 660, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_with_batch_kwargs_unable_to_load_a_batch_raises_helpful_error
( mock_webbrowser, mock_subprocess, caplog, empty_data_context )
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
def test_suite_edit_with_batch_kwargs_unable_to_load_a_batch_raises_helpful_error( mock_webbrowser, mock_subprocess, caplog, empty_data_context ): """ The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter """ project_dir = empty_data_context.root_d...
[ "def", "test_suite_edit_with_batch_kwargs_unable_to_load_a_batch_raises_helpful_error", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ")", ":", "project_dir", "=", "empty_data_context", ".", "root_directory", "context", "=", "DataCont...
[ 665, 0 ]
[ 698, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_with_non_existent_suite_name_raises_error
( mock_webbrowser, mock_subprocess, caplog, empty_data_context )
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
def test_suite_edit_with_non_existent_suite_name_raises_error( mock_webbrowser, mock_subprocess, caplog, empty_data_context ): """ The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter """ project_dir = empty_data_context.root_directory assert ...
[ "def", "test_suite_edit_with_non_existent_suite_name_raises_error", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ")", ":", "project_dir", "=", "empty_data_context", ".", "root_directory", "assert", "not", "empty_data_context", ".",...
[ 703, 0 ]
[ 731, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_with_non_existent_datasource_shows_helpful_error_message
( mock_webbrowser, mock_subprocess, caplog, empty_data_context )
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter
def test_suite_edit_with_non_existent_datasource_shows_helpful_error_message( mock_webbrowser, mock_subprocess, caplog, empty_data_context ): """ The command should: - exit with a clear error message - NOT open Data Docs - NOT open jupyter """ project_dir = empty_data_context.root_direct...
[ "def", "test_suite_edit_with_non_existent_datasource_shows_helpful_error_message", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ")", ":", "project_dir", "=", "empty_data_context", ".", "root_directory", "context", "=", "DataContext",...
[ 736, 0 ]
[ 768, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_without_citations
( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, )
Here we verify that the "suite edit" command helps the user to specify the batch kwargs when it is called without the optional arguments that specify the batch. First, we call the "suite new" command to create the expectation suite our test will edit - this step is a just a setup. We call the "su...
Here we verify that the "suite edit" command helps the user to specify the batch kwargs when it is called without the optional arguments that specify the batch.
def test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_without_citations( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, ): """ Here we verify that the "suite edit" command helps the user to specify the...
[ "def", "test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_without_citations", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "site_builder_data_context_v013_with_html_store_titanic_random", ",", ")", ":", "root_dir", "=", "(", ...
[ 773, 0 ]
[ 856, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_containing_citations
( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, )
Here we verify that the "suite edit" command uses the batch kwargs found in citations in the existing suite when it is called without the optional arguments that specify the batch. First, we call the "suite new" command to create the expectation suite our test will edit - this step is a just a set...
Here we verify that the "suite edit" command uses the batch kwargs found in citations in the existing suite when it is called without the optional arguments that specify the batch.
def test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_containing_citations( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, ): """ Here we verify that the "suite edit" command uses the batch kwargs foun...
[ "def", "test_suite_edit_multiple_datasources_with_generator_with_no_additional_args_with_suite_containing_citations", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "site_builder_data_context_v013_with_html_store_titanic_random", ",", ")", ":", "root_dir", "=", "("...
[ 861, 0 ]
[ 929, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_multiple_datasources_with_generator_with_batch_kwargs_arg
( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, )
Here we verify that when the "suite edit" command is called with batch_kwargs arg that specifies the batch that will be used as a sample for editing the suite, the command processes the batch_kwargs correctly and skips all the prompts that help users to specify the batch (when called without batch_kwar...
Here we verify that when the "suite edit" command is called with batch_kwargs arg that specifies the batch that will be used as a sample for editing the suite, the command processes the batch_kwargs correctly and skips all the prompts that help users to specify the batch (when called without batch_kwar...
def test_suite_edit_multiple_datasources_with_generator_with_batch_kwargs_arg( mock_webbrowser, mock_subprocess, caplog, site_builder_data_context_v013_with_html_store_titanic_random, ): """ Here we verify that when the "suite edit" command is called with batch_kwargs arg that specifies the ...
[ "def", "test_suite_edit_multiple_datasources_with_generator_with_batch_kwargs_arg", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "site_builder_data_context_v013_with_html_store_titanic_random", ",", ")", ":", "root_dir", "=", "(", "site_builder_data_context_v01...
[ 934, 0 ]
[ 1028, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_on_exsiting_suite_one_datasources_with_batch_kwargs_without_datasource_raises_helpful_error
( mock_webbrowser, mock_subprocess, caplog, titanic_data_context, )
Given: - the suite foo exists - the a datasource exists - and the users runs this great_expectations suite edit foo --batch-kwargs '{"path": "data/10k.csv"}' Then: - The user should see a nice error and the program halts before notebook compilation. - NOT open Data Docs - NOT o...
Given: - the suite foo exists - the a datasource exists - and the users runs this great_expectations suite edit foo --batch-kwargs '{"path": "data/10k.csv"}'
def test_suite_edit_on_exsiting_suite_one_datasources_with_batch_kwargs_without_datasource_raises_helpful_error( mock_webbrowser, mock_subprocess, caplog, titanic_data_context, ): """ Given: - the suite foo exists - the a datasource exists - and the users runs this great_expectat...
[ "def", "test_suite_edit_on_exsiting_suite_one_datasources_with_batch_kwargs_without_datasource_raises_helpful_error", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "titanic_data_context", ",", ")", ":", "project_dir", "=", "titanic_data_context", ".", "root_di...
[ 1033, 0 ]
[ 1083, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_on_exsiting_suite_one_datasources_with_datasource_arg_and_batch_kwargs
( mock_webbrowser, mock_subprocess, caplog, titanic_data_context, )
Given: - the suite foo exists - the a datasource bar exists - and the users runs this great_expectations suite edit foo --datasource bar --batch-kwargs '{"path": "data/10k.csv"}' Then: - The user gets a working notebook - NOT open Data Docs - open jupyter
Given: - the suite foo exists - the a datasource bar exists - and the users runs this great_expectations suite edit foo --datasource bar --batch-kwargs '{"path": "data/10k.csv"}'
def test_suite_edit_on_exsiting_suite_one_datasources_with_datasource_arg_and_batch_kwargs( mock_webbrowser, mock_subprocess, caplog, titanic_data_context, ): """ Given: - the suite foo exists - the a datasource bar exists - and the users runs this great_expectations suite edit f...
[ "def", "test_suite_edit_on_exsiting_suite_one_datasources_with_datasource_arg_and_batch_kwargs", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "titanic_data_context", ",", ")", ":", "project_dir", "=", "titanic_data_context", ".", "root_directory", "context"...
[ 1088, 0 ]
[ 1143, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_edit_one_datasources_no_generator_with_no_additional_args_and_no_citations
( mock_webbrowser, mock_subprocess, caplog, empty_data_context, filesystem_csv_2 )
Here we verify that the "suite edit" command helps the user to specify the batch kwargs when it is called without the optional arguments that specify the batch. First, we call the "suite new" command to create the expectation suite our test will edit - this step is a just a setup. We call the "su...
Here we verify that the "suite edit" command helps the user to specify the batch kwargs when it is called without the optional arguments that specify the batch.
def test_suite_edit_one_datasources_no_generator_with_no_additional_args_and_no_citations( mock_webbrowser, mock_subprocess, caplog, empty_data_context, filesystem_csv_2 ): """ Here we verify that the "suite edit" command helps the user to specify the batch kwargs when it is called without the optional ...
[ "def", "test_suite_edit_one_datasources_no_generator_with_no_additional_args_and_no_citations", "(", "mock_webbrowser", ",", "mock_subprocess", ",", "caplog", ",", "empty_data_context", ",", "filesystem_csv_2", ")", ":", "empty_data_context", ".", "add_datasource", "(", "\"my_dat...
[ 1148, 0 ]
[ 1227, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_scaffold_on_context_with_no_datasource_raises_error
( mock_subprocess, mock_emit, caplog, empty_data_context_stats_enabled )
We call the "suite scaffold" command on a context with no datasource The command should: - exit with a clear error message - send a DataContext init success message - send a scaffold fail message
We call the "suite scaffold" command on a context with no datasource
def test_suite_scaffold_on_context_with_no_datasource_raises_error( mock_subprocess, mock_emit, caplog, empty_data_context_stats_enabled ): """ We call the "suite scaffold" command on a context with no datasource The command should: - exit with a clear error message - send a DataContext init su...
[ "def", "test_suite_scaffold_on_context_with_no_datasource_raises_error", "(", "mock_subprocess", ",", "mock_emit", ",", "caplog", ",", "empty_data_context_stats_enabled", ")", ":", "context", "=", "empty_data_context_stats_enabled", "root_dir", "=", "context", ".", "root_direct...
[ 1424, 0 ]
[ 1469, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_scaffold_on_existing_suite_raises_error
( mock_emit, caplog, empty_data_context_stats_enabled )
We call the "suite scaffold" command with an existing suite The command should: - exit with a clear error message - send a DataContext init success message - send a scaffold fail message
We call the "suite scaffold" command with an existing suite
def test_suite_scaffold_on_existing_suite_raises_error( mock_emit, caplog, empty_data_context_stats_enabled ): """ We call the "suite scaffold" command with an existing suite The command should: - exit with a clear error message - send a DataContext init success message - send a scaffold fa...
[ "def", "test_suite_scaffold_on_existing_suite_raises_error", "(", "mock_emit", ",", "caplog", ",", "empty_data_context_stats_enabled", ")", ":", "context", "=", "empty_data_context_stats_enabled", "root_dir", "=", "context", ".", "root_directory", "suite", "=", "context", "...
[ 1475, 0 ]
[ 1524, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_scaffold_creates_notebook_and_opens_jupyter
( mock_subprocess, mock_emit, caplog, titanic_data_context_stats_enabled )
We call the "suite scaffold" command The command should: - create a new notebook - open the notebook in jupyter - send a DataContext init success message - send a scaffold success message
We call the "suite scaffold" command
def test_suite_scaffold_creates_notebook_and_opens_jupyter( mock_subprocess, mock_emit, caplog, titanic_data_context_stats_enabled ): """ We call the "suite scaffold" command The command should: - create a new notebook - open the notebook in jupyter - send a DataContext init success message...
[ "def", "test_suite_scaffold_creates_notebook_and_opens_jupyter", "(", "mock_subprocess", ",", "mock_emit", ",", "caplog", ",", "titanic_data_context_stats_enabled", ")", ":", "context", "=", "titanic_data_context_stats_enabled", "root_dir", "=", "context", ".", "root_directory"...
[ 1531, 0 ]
[ 1583, 5 ]
python
en
['en', 'error', 'th']
False
test_suite_scaffold_creates_notebook_with_no_jupyter_flag
( mock_subprocess, mock_emit, caplog, titanic_data_context_stats_enabled )
We call the "suite scaffold --no-jupyter" The command should: - create a new notebook - NOT open the notebook in jupyter - tell the user to open the notebook - send a DataContext init success message - send a scaffold success message
We call the "suite scaffold --no-jupyter"
def test_suite_scaffold_creates_notebook_with_no_jupyter_flag( mock_subprocess, mock_emit, caplog, titanic_data_context_stats_enabled ): """ We call the "suite scaffold --no-jupyter" The command should: - create a new notebook - NOT open the notebook in jupyter - tell the user to open the n...
[ "def", "test_suite_scaffold_creates_notebook_with_no_jupyter_flag", "(", "mock_subprocess", ",", "mock_emit", ",", "caplog", ",", "titanic_data_context_stats_enabled", ")", ":", "context", "=", "titanic_data_context_stats_enabled", "root_dir", "=", "context", ".", "root_directo...
[ 1590, 0 ]
[ 1645, 5 ]
python
en
['en', 'error', 'th']
False
ManageUserView.get_object
(self)
Retrieve and return authentication user
Retrieve and return authentication user
def get_object(self): """Retrieve and return authentication user""" return self.request.user
[ "def", "get_object", "(", "self", ")", ":", "return", "self", ".", "request", ".", "user" ]
[ 24, 4 ]
[ 26, 32 ]
python
en
['en', 'en', 'en']
True
registerNoTpl
(name, cl)
Register a class without template It can seem not useful to register classes without template (and it wasn't useful until the SmartPointer template was generated), but those classes can be used as template argument of classes with template.
Register a class without template
def registerNoTpl(name, cl): """Register a class without template It can seem not useful to register classes without template (and it wasn't useful until the SmartPointer template was generated), but those classes can be used as template argument of classes with template. """ itkTemplate.__temp...
[ "def", "registerNoTpl", "(", "name", ",", "cl", ")", ":", "itkTemplate", ".", "__templates__", "[", "normalizeName", "(", "name", ")", "]", "=", "cl" ]
[ 37, 0 ]
[ 44, 55 ]
python
en
['en', 'en', 'en']
True
normalizeName
(name)
Normalize the class name to remove ambiguity This function removes the white spaces in the name, and also remove the pointer declaration "*" (it have no sense in python)
Normalize the class name to remove ambiguity
def normalizeName(name): """Normalize the class name to remove ambiguity This function removes the white spaces in the name, and also remove the pointer declaration "*" (it have no sense in python) """ name = name.replace(" ", "") name = name.replace("*", "") return name
[ "def", "normalizeName", "(", "name", ")", ":", "name", "=", "name", ".", "replace", "(", "\" \"", ",", "\"\"", ")", "name", "=", "name", ".", "replace", "(", "\"*\"", ",", "\"\"", ")", "return", "name" ]
[ 47, 0 ]
[ 56, 15 ]
python
en
['en', 'en', 'en']
True
itkTemplate.__add__
(self, paramSetString, cl)
Add a new argument set and the resulting class to the template. paramSetString is the C++ string which defines the parameters set. cl is the class which corresponds to the couple template-argument set.
Add a new argument set and the resulting class to the template.
def __add__(self, paramSetString, cl): """Add a new argument set and the resulting class to the template. paramSetString is the C++ string which defines the parameters set. cl is the class which corresponds to the couple template-argument set. """ # recreate the full name and no...
[ "def", "__add__", "(", "self", ",", "paramSetString", ",", "cl", ")", ":", "# recreate the full name and normalize it to avoid ambiguity", "normFullName", "=", "normalizeName", "(", "self", ".", "__name__", "+", "\"<\"", "+", "paramSetString", "+", "\">\"", ")", "# ...
[ 95, 4 ]
[ 170, 41 ]
python
en
['en', 'en', 'en']
True
itkTemplate.__find_param__
(self, paramSetString)
Find the parameters of the template. paramSetString is the C++ string which defines the parameters set. __find_param__ returns a list of itk classes, itkCType, and/or numbers which correspond to the parameters described in paramSetString. The parameters MUST have been registered before...
Find the parameters of the template.
def __find_param__(self, paramSetString): """Find the parameters of the template. paramSetString is the C++ string which defines the parameters set. __find_param__ returns a list of itk classes, itkCType, and/or numbers which correspond to the parameters described in paramSetString. ...
[ "def", "__find_param__", "(", "self", ",", "paramSetString", ")", ":", "# split the string in a list of parameters", "paramStrings", "=", "[", "]", "inner", "=", "0", "part", "=", "paramSetString", ".", "split", "(", "\",\"", ")", "for", "elt", "in", "part", "...
[ 172, 4 ]
[ 236, 25 ]
python
en
['en', 'en', 'en']
True
itkTemplate.__getitem__
(self, parameters)
Return the class which corresponds to the given template parameters. parameters can be: - a single parameter (Ex: itk.Index[2]) - a list of elements (Ex: itk.Image[itk.UC, 2])
Return the class which corresponds to the given template parameters.
def __getitem__(self, parameters): """Return the class which corresponds to the given template parameters. parameters can be: - a single parameter (Ex: itk.Index[2]) - a list of elements (Ex: itk.Image[itk.UC, 2]) """ parameters_type = type(parameters) i...
[ "def", "__getitem__", "(", "self", ",", "parameters", ")", ":", "parameters_type", "=", "type", "(", "parameters", ")", "if", "not", "parameters_type", "is", "tuple", "and", "not", "parameters_type", "is", "list", ":", "# parameters is a single element.", "# inclu...
[ 238, 4 ]
[ 273, 53 ]
python
en
['en', 'en', 'en']
True
itkTemplate.__getattr__
(self, attr)
Support for lazy loading.
Support for lazy loading.
def __getattr__(self, attr): """Support for lazy loading.""" self._LoadModules() return object.__getattribute__(self, attr)
[ "def", "__getattr__", "(", "self", ",", "attr", ")", ":", "self", ".", "_LoadModules", "(", ")", "return", "object", ".", "__getattribute__", "(", "self", ",", "attr", ")" ]
[ 278, 4 ]
[ 281, 50 ]
python
en
['en', 'en', 'en']
True
itkTemplate._LoadModules
(self)
Loads all the module that may have not been loaded by the lazy loading system. If multiple modules use the same object, the lazy loading system is only going to load the module in which the object belongs. The other modules will be loaded only when necessary.
Loads all the module that may have not been loaded by the lazy loading system.
def _LoadModules(self): """Loads all the module that may have not been loaded by the lazy loading system. If multiple modules use the same object, the lazy loading system is only going to load the module in which the object belongs. The other modules will be loaded only when necessary. ...
[ "def", "_LoadModules", "(", "self", ")", ":", "name", "=", "self", ".", "__name__", ".", "split", "(", "'::'", ")", "[", "-", "1", "]", "# Remove 'itk::' or 'itk::Function::'", "modules", "=", "itkBase", ".", "lazy_attributes", "[", "name", "]", "for", "mo...
[ 284, 4 ]
[ 300, 53 ]
python
en
['en', 'en', 'en']
True
itkTemplate.__dir__
(self)
Returns the list of the attributes available in the current template. This loads all the modules that might be required by this template first, and then returns the list of attributes. It is used when dir() is called or when it tries to autocomplete attribute names.
Returns the list of the attributes available in the current template.
def __dir__(self): """Returns the list of the attributes available in the current template. This loads all the modules that might be required by this template first, and then returns the list of attributes. It is used when dir() is called or when it tries to autocomplete attribute names...
[ "def", "__dir__", "(", "self", ")", ":", "self", ".", "_LoadModules", "(", ")", "def", "get_attrs", "(", "obj", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'__dict__'", ")", ":", "return", "[", "]", "# slots only", "if", "sys", ".", "version_...
[ 302, 4 ]
[ 342, 25 ]
python
en
['en', 'en', 'en']
True
itkTemplate.New
(self, *args, **kwargs)
Instantiate the template with a type implied from its input. Template type specification can be avoided by assuming that the type's first template argument should have the same type as its primary input. This is generally true. If it is not true, then specify the types explicitly. ...
Instantiate the template with a type implied from its input.
def New(self, *args, **kwargs): """Instantiate the template with a type implied from its input. Template type specification can be avoided by assuming that the type's first template argument should have the same type as its primary input. This is generally true. If it is not true, then ...
[ "def", "New", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "import", "itk", "keys", "=", "self", ".", "keys", "(", ")", "cur", "=", "itk", ".", "auto_pipeline", ".", "current", "if", "self", ".", "__name__", "==", "\"itk::Image...
[ 354, 4 ]
[ 401, 55 ]
python
en
['en', 'en', 'en']
True
itkTemplate.GetTypes
(self)
Helper method which prints out the available template parameters.
Helper method which prints out the available template parameters.
def GetTypes(self): """Helper method which prints out the available template parameters.""" print("<itkTemplate %s>" % self.__name__) print("Options:") for tp in self.GetTypesAsList(): print(" " + str(tp).replace("(", "[").replace(")", "]"))
[ "def", "GetTypes", "(", "self", ")", ":", "print", "(", "\"<itkTemplate %s>\"", "%", "self", ".", "__name__", ")", "print", "(", "\"Options:\"", ")", "for", "tp", "in", "self", ".", "GetTypesAsList", "(", ")", ":", "print", "(", "\" \"", "+", "str", "...
[ 508, 4 ]
[ 514, 69 ]
python
en
['en', 'en', 'en']
True
itkTemplate.GetTypesAsList
(self)
Helper method which returns the available template parameters.
Helper method which returns the available template parameters.
def GetTypesAsList(self): """Helper method which returns the available template parameters.""" # Make a list of allowed types, and sort them ctypes = [] classes = [] others = [] for key_tuple in self.__template__: key = str(key_tuple) if "itkCTyp...
[ "def", "GetTypesAsList", "(", "self", ")", ":", "# Make a list of allowed types, and sort them", "ctypes", "=", "[", "]", "classes", "=", "[", "]", "others", "=", "[", "]", "for", "key_tuple", "in", "self", ".", "__template__", ":", "key", "=", "str", "(", ...
[ 516, 4 ]
[ 537, 40 ]
python
en
['en', 'en', 'en']
True
State.__init__
(self, state_name: str, state_type: str)
Abstract class to describe the base for Steps. :param state_name: step's symbolic name. :param state_type: step's type.
Abstract class to describe the base for Steps.
def __init__(self, state_name: str, state_type: str): """ Abstract class to describe the base for Steps. :param state_name: step's symbolic name. :param state_type: step's type. """ self._name: str = state_name self._type: str = state_type
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ",", "state_type", ":", "str", ")", ":", "self", ".", "_name", ":", "str", "=", "state_name", "self", ".", "_type", ":", "str", "=", "state_type" ]
[ 5, 4 ]
[ 13, 36 ]
python
en
['en', 'error', 'th']
False
State.state_as_map
(self)
Return object as a map. :return: dictionary containing aws-relevant json properties.
Return object as a map.
def state_as_map(self) -> {}: """ Return object as a map. :return: dictionary containing aws-relevant json properties. """ data = {"Type": self._type} return data
[ "def", "state_as_map", "(", "self", ")", "->", "{", "}", ":", "data", "=", "{", "\"Type\"", ":", "self", ".", "_type", "}", "return", "data" ]
[ 16, 4 ]
[ 23, 19 ]
python
en
['en', 'error', 'th']
False
StateMachine.__init__
(self, states: [State], startAt: str)
State machine definition. :param states: array of states. :param startAt: name of the starting state.
State machine definition.
def __init__(self, states: [State], startAt: str): """ State machine definition. :param states: array of states. :param startAt: name of the starting state. """ if not states: raise Exception("You should provide at least one state in the argument array.") ...
[ "def", "__init__", "(", "self", ",", "states", ":", "[", "State", "]", ",", "startAt", ":", "str", ")", ":", "if", "not", "states", ":", "raise", "Exception", "(", "\"You should provide at least one state in the argument array.\"", ")", "self", ".", "_states", ...
[ 27, 4 ]
[ 41, 31 ]
python
en
['en', 'error', 'th']
False
StateMachine.get_as_map
(self)
Return object as a map. :return: dictionary containing aws-relevant json properties.
Return object as a map.
def get_as_map(self) -> {}: """ Return object as a map. :return: dictionary containing aws-relevant json properties. """ data = {} data["StartAt"] = self._startAt data["States"] = self.__states_as_map() return data
[ "def", "get_as_map", "(", "self", ")", "->", "{", "}", ":", "data", "=", "{", "}", "data", "[", "\"StartAt\"", "]", "=", "self", ".", "_startAt", "data", "[", "\"States\"", "]", "=", "self", ".", "__states_as_map", "(", ")", "return", "data" ]
[ 43, 4 ]
[ 54, 19 ]
python
en
['en', 'error', 'th']
False
StateMachine.__states_as_map
(self)
Convert all of the states into maps. :return: map of states.
Convert all of the states into maps.
def __states_as_map(self) -> {}: """ Convert all of the states into maps. :return: map of states. """ states = {} for state in self._states: states[state._name] = state.state_as_map() return states
[ "def", "__states_as_map", "(", "self", ")", "->", "{", "}", ":", "states", "=", "{", "}", "for", "state", "in", "self", ".", "_states", ":", "states", "[", "state", ".", "_name", "]", "=", "state", ".", "state_as_map", "(", ")", "return", "states" ]
[ 56, 4 ]
[ 66, 21 ]
python
en
['en', 'error', 'th']
False
ParallelState.__init__
(self, state_name: str, branches: [StateMachine], next_step: str)
Responsible for parallel execution of its branches. :param branches: array of branches to be executed in parallel :param next_step: next step to be executed after all the branches finish
Responsible for parallel execution of its branches.
def __init__(self, state_name: str, branches: [StateMachine], next_step: str): """ Responsible for parallel execution of its branches. :param branches: array of branches to be executed in parallel :param next_step: next step to be executed after all the branches finish """ ...
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ",", "branches", ":", "[", "StateMachine", "]", ",", "next_step", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "state_name", ",", "\"Parallel\"", ")", "if", "not", "next_s...
[ 70, 4 ]
[ 84, 33 ]
python
en
['en', 'error', 'th']
False
WaitState.__init__
(self, state_name: str, next_state: str, seconds: int)
State used for waiting. :param next_state: step to be executed after this one. :param seconds: time in seconds to be spent waiting in this step.
State used for waiting.
def __init__(self, state_name: str, next_state: str, seconds: int): """ State used for waiting. :param next_state: step to be executed after this one. :param seconds: time in seconds to be spent waiting in this step. """ super().__init__(state_name, "Wait") if n...
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ",", "next_state", ":", "str", ",", "seconds", ":", "int", ")", ":", "super", "(", ")", ".", "__init__", "(", "state_name", ",", "\"Wait\"", ")", "if", "not", "next_state", ":", "raise", ...
[ 100, 4 ]
[ 115, 31 ]
python
en
['en', 'error', 'th']
False
SucceedState.__init__
(self, state_name: str)
Terminal state.
Terminal state.
def __init__(self, state_name: str): """ Terminal state. """ super().__init__(state_name, "Succeed")
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "state_name", ",", "\"Succeed\"", ")" ]
[ 125, 4 ]
[ 129, 47 ]
python
en
['en', 'error', 'th']
False
FailState.__init__
(self, state_name: str, error: str, cause: str)
Terminal state that fails current scope. :param error: error name. :param cause: human-readable message.
Terminal state that fails current scope.
def __init__(self, state_name: str, error: str, cause: str): """ Terminal state that fails current scope. :param error: error name. :param cause: human-readable message. """ super().__init__(state_name, "Fail") self._error = error self._cause = cause
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ",", "error", ":", "str", ",", "cause", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "state_name", ",", "\"Fail\"", ")", "self", ".", "_error", "=", "error", "self", "...
[ 136, 4 ]
[ 145, 27 ]
python
en
['en', 'error', 'th']
False
TaskState.__init__
( self, state_name: str, lambda_arn: str, next_step: str = "", timeout: int = 60, is_end_state: bool = False, )
Task state class. :param timeout: if the step runs longer than timeout - state fails with States.Timeout. :param lambda_arn: arn of lambda function to be executed withing step. :param next_step: next step to be executed after he current one. :param is_end_state: if set to True,...
Task state class.
def __init__( self, state_name: str, lambda_arn: str, next_step: str = "", timeout: int = 60, is_end_state: bool = False, ): """ Task state class. :param timeout: if the step runs longer than timeout - state fails with States.Timeout. ...
[ "def", "__init__", "(", "self", ",", "state_name", ":", "str", ",", "lambda_arn", ":", "str", ",", "next_step", ":", "str", "=", "\"\"", ",", "timeout", ":", "int", "=", "60", ",", "is_end_state", ":", "bool", "=", "False", ",", ")", ":", "super", ...
[ 155, 4 ]
[ 178, 31 ]
python
en
['en', 'error', 'th']
False
StepMachine.__init__
(self, name: str, states: [State], startAt: str, comment: str = "")
:param name: step machine symbolic name. :param comment: optional comment.
:param name: step machine symbolic name. :param comment: optional comment.
def __init__(self, name: str, states: [State], startAt: str, comment: str = ""): """ :param name: step machine symbolic name. :param comment: optional comment. """ super().__init__(states, startAt) if len(name.strip()) < 2: raise Exception("Step machine name ...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "states", ":", "[", "State", "]", ",", "startAt", ":", "str", ",", "comment", ":", "str", "=", "\"\"", ")", ":", "super", "(", ")", ".", "__init__", "(", "states", ",", "startAt", ")",...
[ 198, 4 ]
[ 210, 37 ]
python
en
['en', 'error', 'th']
False
StepMachine.get_as_aws_json
(self)
Convert object to json string. :return: json-aws state machine definition.
Convert object to json string.
def get_as_aws_json(self) -> str: """ Convert object to json string. :return: json-aws state machine definition. """ return json.dumps(self.get_as_map())
[ "def", "get_as_aws_json", "(", "self", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "self", ".", "get_as_map", "(", ")", ")" ]
[ 220, 4 ]
[ 227, 44 ]
python
en
['en', 'error', 'th']
False
StepMachine.execute
(self, client, role_arn: str, state_input: str = None)
Execute the state machine within the current class. :param client: boto3.client object. :param role_arn: arn of the role. :param state_input: optional input. :return: execution arn.
Execute the state machine within the current class.
def execute(self, client, role_arn: str, state_input: str = None) -> str: """ Execute the state machine within the current class. :param client: boto3.client object. :param role_arn: arn of the role. :param state_input: optional input. :return: execution arn. """...
[ "def", "execute", "(", "self", ",", "client", ",", "role_arn", ":", "str", ",", "state_input", ":", "str", "=", "None", ")", "->", "str", ":", "if", "not", "self", ".", "state_machine_arn", ":", "self", ".", "state_machine_arn", "=", "self", ".", "__cr...
[ 229, 4 ]
[ 249, 28 ]
python
en
['en', 'error', 'th']
False
StepMachine.__create
(self, client, role_arn)
Create the state machine, requires object state. :param client: boto3.client object. :param role_arn: arn of the role. :return: arn of the created state machine.
Create the state machine, requires object state.
def __create(self, client, role_arn) -> str: """ Create the state machine, requires object state. :param client: boto3.client object. :param role_arn: arn of the role. :return: arn of the created state machine. """ try: response = client.create_state_...
[ "def", "__create", "(", "self", ",", "client", ",", "role_arn", ")", "->", "str", ":", "try", ":", "response", "=", "client", ".", "create_state_machine", "(", "name", "=", "self", ".", "_name", ",", "definition", "=", "self", ".", "get_as_map", "(", "...
[ 251, 4 ]
[ 267, 42 ]
python
en
['en', 'error', 'th']
False
StepMachine.delete
(self, client, sm_arn: str = None)
Delete local step machine, if no arn is specified. :param client: boto3.client object. :param sm_arn: optional state machine arn, if not specified - objects sm is deleted. :return:
Delete local step machine, if no arn is specified.
def delete(self, client, sm_arn: str = None) -> str: """ Delete local step machine, if no arn is specified. :param client: boto3.client object. :param sm_arn: optional state machine arn, if not specified - objects sm is deleted. :return: """ arn = sm_arn ...
[ "def", "delete", "(", "self", ",", "client", ",", "sm_arn", ":", "str", "=", "None", ")", "->", "str", ":", "arn", "=", "sm_arn", "if", "not", "arn", ":", "if", "not", "self", ".", "state_machine_arn", ":", "raise", "Exception", "(", "\"Argument arn is...
[ 269, 4 ]
[ 287, 64 ]
python
en
['en', 'error', 'th']
False
_Replacement_write_data
(writer, data, is_attrib=False)
Writes datachars to writer.
Writes datachars to writer.
def _Replacement_write_data(writer, data, is_attrib=False): """Writes datachars to writer.""" data = data.replace("&", "&amp;").replace("<", "&lt;") data = data.replace("\"", "&quot;").replace(">", "&gt;") if is_attrib: data = data.replace( "\r", "&#xD;").replace( "\n", "&#xA;").replace( ...
[ "def", "_Replacement_write_data", "(", "writer", ",", "data", ",", "is_attrib", "=", "False", ")", ":", "data", "=", "data", ".", "replace", "(", "\"&\"", ",", "\"&amp;\"", ")", ".", "replace", "(", "\"<\"", ",", "\"&lt;\"", ")", "data", "=", "data", "...
[ 15, 0 ]
[ 24, 20 ]
python
en
['en', 'sn', 'en']
True
BaseRetriever.retrieve
(self, query: str, filters: dict = None, top_k: int = 10, index: str = None)
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary where the keys specify a metadata field and the value is a list of accepted values for that field :param top_k: ...
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query.
def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str = None) -> List[Document]: """ Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary w...
[ "def", "retrieve", "(", "self", ",", "query", ":", "str", ",", "filters", ":", "dict", "=", "None", ",", "top_k", ":", "int", "=", "10", ",", "index", ":", "str", "=", "None", ")", "->", "List", "[", "Document", "]", ":", "pass" ]
[ 18, 4 ]
[ 28, 12 ]
python
en
['en', 'error', 'th']
False
BaseRetriever.timing
(self, fn)
Wrapper method used to time functions.
Wrapper method used to time functions.
def timing(self, fn): """Wrapper method used to time functions. """ @wraps(fn) def wrapper(*args, **kwargs): if "retrieve_time" not in self.__dict__: self.retrieve_time = 0 tic = perf_counter() ret = fn(*args, **kwargs) toc = perf_c...
[ "def", "timing", "(", "self", ",", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "\"retrieve_time\"", "not", "in", "self", ".", "__dict__", ":", "self", ".", "retrieve_tim...
[ 30, 4 ]
[ 41, 22 ]
python
en
['en', 'en', 'en']
True
BaseRetriever.eval
( self, label_index: str = "label", doc_index: str = "eval_document", label_origin: str = "gold_label", top_k: int = 10, open_domain: bool = False, return_preds: bool = False, )
Performs evaluation on the Retriever. Retriever is evaluated based on whether it finds the correct document given the query string and at which position in the ranking of documents the correct document is. | Returns a dict containing the following metrics: - "recall": Pro...
Performs evaluation on the Retriever. Retriever is evaluated based on whether it finds the correct document given the query string and at which position in the ranking of documents the correct document is.
def eval( self, label_index: str = "label", doc_index: str = "eval_document", label_origin: str = "gold_label", top_k: int = 10, open_domain: bool = False, return_preds: bool = False, ) -> dict: """ Performs evaluation on the Retriever. ...
[ "def", "eval", "(", "self", ",", "label_index", ":", "str", "=", "\"label\"", ",", "doc_index", ":", "str", "=", "\"eval_document\"", ",", "label_origin", ":", "str", "=", "\"gold_label\"", ",", "top_k", ":", "int", "=", "10", ",", "open_domain", ":", "b...
[ 43, 4 ]
[ 168, 26 ]
python
en
['en', 'error', 'th']
False
ExpectColumnSumToBeBetween.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "self", ".", "validate_metric_value_between_configuration", ...
[ 100, 4 ]
[ 112, 85 ]
python
en
['en', 'error', 'th']
False
pluralize
(singular_ge_noun)
Pluralizes a Great Expectations singular noun
Pluralizes a Great Expectations singular noun
def pluralize(singular_ge_noun): """ Pluralizes a Great Expectations singular noun """ try: return SINGULAR_TO_PLURAL_LOOKUP_DICT[singular_ge_noun.lower()] except KeyError: raise GreatExpectationsError( f"Unable to pluralize '{singular_ge_noun}'. Please update " ...
[ "def", "pluralize", "(", "singular_ge_noun", ")", ":", "try", ":", "return", "SINGULAR_TO_PLURAL_LOOKUP_DICT", "[", "singular_ge_noun", ".", "lower", "(", ")", "]", "except", "KeyError", ":", "raise", "GreatExpectationsError", "(", "f\"Unable to pluralize '{singular_ge_...
[ 72, 0 ]
[ 82, 9 ]
python
en
['en', 'error', 'th']
False
singularize
(plural_ge_noun)
Singularizes a Great Expectations plural noun
Singularizes a Great Expectations plural noun
def singularize(plural_ge_noun): """ Singularizes a Great Expectations plural noun """ try: return PLURAL_TO_SINGULAR_LOOKUP_DICT[plural_ge_noun.lower()] except KeyError: raise GreatExpectationsError( f"Unable to singularize '{plural_ge_noun}'. Please update " ...
[ "def", "singularize", "(", "plural_ge_noun", ")", ":", "try", ":", "return", "PLURAL_TO_SINGULAR_LOOKUP_DICT", "[", "plural_ge_noun", ".", "lower", "(", ")", "]", "except", "KeyError", ":", "raise", "GreatExpectationsError", "(", "f\"Unable to singularize '{plural_ge_no...
[ 85, 0 ]
[ 95, 9 ]
python
en
['en', 'error', 'th']
False
underscore
(word: str)
**Borrowed from inflection.underscore** Make an underscored, lowercase form from the expression in the string. Example:: >>> underscore("DeviceType") 'device_type' As a rule of thumb you can think of :func:`underscore` as the inverse of :func:`camelize`, though there are cases wh...
**Borrowed from inflection.underscore** Make an underscored, lowercase form from the expression in the string.
def underscore(word: str) -> str: """ **Borrowed from inflection.underscore** Make an underscored, lowercase form from the expression in the string. Example:: >>> underscore("DeviceType") 'device_type' As a rule of thumb you can think of :func:`underscore` as the inverse of :f...
[ "def", "underscore", "(", "word", ":", "str", ")", "->", "str", ":", "word", "=", "re", ".", "sub", "(", "r\"([A-Z]+)([A-Z][a-z])\"", ",", "r\"\\1_\\2\"", ",", "word", ")", "word", "=", "re", ".", "sub", "(", "r\"([a-z\\d])([A-Z])\"", ",", "r\"\\1_\\2\"", ...
[ 98, 0 ]
[ 118, 23 ]
python
en
['en', 'error', 'th']
False
get_currently_executing_function_call_arguments
( include_module_name: bool = False, include_caller_names: bool = False, **kwargs )
:param include_module_name: bool If True, module name will be determined and included in output dictionary (default is False) :param include_caller_names: bool If True, arguments, such as "self" and "cls", if present, will be included in output dictionary (default is False) :param kwargs: :return: dict...
:param include_module_name: bool If True, module name will be determined and included in output dictionary (default is False) :param include_caller_names: bool If True, arguments, such as "self" and "cls", if present, will be included in output dictionary (default is False) :param kwargs: :return: dict...
def get_currently_executing_function_call_arguments( include_module_name: bool = False, include_caller_names: bool = False, **kwargs ) -> dict: """ :param include_module_name: bool If True, module name will be determined and included in output dictionary (default is False) :param include_caller_names: b...
[ "def", "get_currently_executing_function_call_arguments", "(", "include_module_name", ":", "bool", "=", "False", ",", "include_caller_names", ":", "bool", "=", "False", ",", "*", "*", "kwargs", ")", "->", "dict", ":", "cf", ":", "FrameType", "=", "currentframe", ...
[ 186, 0 ]
[ 251, 25 ]
python
en
['en', 'error', 'th']
False
verify_dynamic_loading_support
(module_name: str, package_name: str = None)
:param module_name: a possibly-relative name of a module :param package_name: the name of a package, to which the given module belongs
:param module_name: a possibly-relative name of a module :param package_name: the name of a package, to which the given module belongs
def verify_dynamic_loading_support(module_name: str, package_name: str = None) -> None: """ :param module_name: a possibly-relative name of a module :param package_name: the name of a package, to which the given module belongs """ try: # noinspection PyUnresolvedReferences module_spe...
[ "def", "verify_dynamic_loading_support", "(", "module_name", ":", "str", ",", "package_name", ":", "str", "=", "None", ")", "->", "None", ":", "try", ":", "# noinspection PyUnresolvedReferences", "module_spec", ":", "importlib", ".", "machinery", ".", "ModuleSpec", ...
[ 254, 0 ]
[ 273, 40 ]
python
en
['en', 'error', 'th']
False
import_library_module
(module_name: str)
:param module_name: a fully-qualified name of a module (e.g., "great_expectations.dataset.sqlalchemy_dataset") :return: raw source code of the module (if can be retrieved)
:param module_name: a fully-qualified name of a module (e.g., "great_expectations.dataset.sqlalchemy_dataset") :return: raw source code of the module (if can be retrieved)
def import_library_module(module_name: str) -> Optional[ModuleType]: """ :param module_name: a fully-qualified name of a module (e.g., "great_expectations.dataset.sqlalchemy_dataset") :return: raw source code of the module (if can be retrieved) """ module_obj: Optional[ModuleType] try: ...
[ "def", "import_library_module", "(", "module_name", ":", "str", ")", "->", "Optional", "[", "ModuleType", "]", ":", "module_obj", ":", "Optional", "[", "ModuleType", "]", "try", ":", "module_obj", "=", "importlib", ".", "import_module", "(", "module_name", ")"...
[ 276, 0 ]
[ 288, 21 ]
python
en
['en', 'error', 'th']
False
_convert_to_dataset_class
(df, dataset_class, expectation_suite=None, profiler=None)
Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite Args: df: the DataFrame object to convert dataset_class: the class to which to convert the existing DataFrame expectation_suite: the expectation suite that should be attached to the resultin...
Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite
def _convert_to_dataset_class(df, dataset_class, expectation_suite=None, profiler=None): """ Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite Args: df: the DataFrame object to convert dataset_class: the class to which to convert the existing Da...
[ "def", "_convert_to_dataset_class", "(", "df", ",", "dataset_class", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ")", ":", "if", "expectation_suite", "is", "not", "None", ":", "# Create a dataset of the new class type, and manually initialize expe...
[ 322, 0 ]
[ 347, 17 ]
python
en
['en', 'error', 'th']
False
_load_and_convert_to_dataset_class
( df, class_name, module_name, expectation_suite=None, profiler=None )
Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite Args: df: the DataFrame object to convert class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant...
Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite
def _load_and_convert_to_dataset_class( df, class_name, module_name, expectation_suite=None, profiler=None ): """ Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite Args: df: the DataFrame object to convert class_name (str): class to which to...
[ "def", "_load_and_convert_to_dataset_class", "(", "df", ",", "class_name", ",", "module_name", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ")", ":", "verify_dynamic_loading_support", "(", "module_name", "=", "module_name", ")", "dataset_class"...
[ 350, 0 ]
[ 368, 84 ]
python
en
['en', 'error', 'th']
False
read_csv
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_csv and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module datase...
Read a file using Pandas read_csv and return a great_expectations dataset.
def read_csv( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_csv and return a great_expectations dataset. Args: filename (stri...
[ "def", "read_csv", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args", ...
[ 371, 0 ]
[ 412, 9 ]
python
en
['en', 'en', 'en']
True
read_json
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, accessor_func=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_json and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module datas...
Read a file using Pandas read_json and return a great_expectations dataset.
def read_json( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, accessor_func=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_json and return a great_expectations dataset. Ar...
[ "def", "read_json", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "accessor_func", "=", "None", ",", "profiler",...
[ 415, 0 ]
[ 465, 9 ]
python
en
['en', 'en', 'en']
True
read_excel
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_excel and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module data...
Read a file using Pandas read_excel and return a great_expectations dataset.
def read_excel( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_excel and return a great_expectations dataset. Args: filename (...
[ "def", "read_excel", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args", ...
[ 468, 0 ]
[ 520, 13 ]
python
en
['en', 'en', 'en']
True
read_table
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_table and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module data...
Read a file using Pandas read_table and return a great_expectations dataset.
def read_table( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_table and return a great_expectations dataset. Args: filename (...
[ "def", "read_table", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args", ...
[ 523, 0 ]
[ 564, 9 ]
python
en
['en', 'en', 'en']
True
read_feather
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_feather and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module da...
Read a file using Pandas read_feather and return a great_expectations dataset.
def read_feather( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_feather and return a great_expectations dataset. Args: filena...
[ "def", "read_feather", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args"...
[ 567, 0 ]
[ 608, 9 ]
python
en
['en', 'en', 'en']
True
read_parquet
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_parquet and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module da...
Read a file using Pandas read_parquet and return a great_expectations dataset.
def read_parquet( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_parquet and return a great_expectations dataset. Args: filena...
[ "def", "read_parquet", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args"...
[ 611, 0 ]
[ 652, 9 ]
python
en
['en', 'en', 'en']
True
from_pandas
( pandas_df, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, )
Read a Pandas data frame and return a great_expectations dataset. Args: pandas_df (Pandas df): Pandas data frame class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module dataset_class ...
Read a Pandas data frame and return a great_expectations dataset.
def from_pandas( pandas_df, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, ): """Read a Pandas data frame and return a great_expectations dataset. Args: pandas_df (Pandas df): Pandas data frame ...
[ "def", "from_pandas", "(", "pandas_df", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", ")", ":", ...
[ 655, 0 ]
[ 692, 9 ]
python
en
['en', 'en', 'en']
True
read_pickle
( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, )
Read a file using Pandas read_pickle and return a great_expectations dataset. Args: filename (string): path to file to read class_name (str): class to which to convert resulting Pandas df module_name (str): dataset module from which to try to dynamically load the relevant module dat...
Read a file using Pandas read_pickle and return a great_expectations dataset.
def read_pickle( filename, class_name="PandasDataset", module_name="great_expectations.dataset", dataset_class=None, expectation_suite=None, profiler=None, *args, **kwargs, ): """Read a file using Pandas read_pickle and return a great_expectations dataset. Args: filename...
[ "def", "read_pickle", "(", "filename", ",", "class_name", "=", "\"PandasDataset\"", ",", "module_name", "=", "\"great_expectations.dataset\"", ",", "dataset_class", "=", "None", ",", "expectation_suite", "=", "None", ",", "profiler", "=", "None", ",", "*", "args",...
[ 695, 0 ]
[ 736, 9 ]
python
en
['en', 'en', 'en']
True
validate
( data_asset, expectation_suite=None, data_asset_name=None, expectation_suite_name=None, data_context=None, data_asset_class_name=None, data_asset_module_name="great_expectations.dataset", data_asset_class=None, *args, **kwargs, )
Validate the provided data asset. Validate can accept an optional data_asset_name to apply, data_context to use to fetch an expectation_suite if one is not provided, and data_asset_class_name/data_asset_module_name or data_asset_class to use to provide custom expectations. Args: data_asset: the ass...
Validate the provided data asset. Validate can accept an optional data_asset_name to apply, data_context to use to fetch an expectation_suite if one is not provided, and data_asset_class_name/data_asset_module_name or data_asset_class to use to provide custom expectations.
def validate( data_asset, expectation_suite=None, data_asset_name=None, expectation_suite_name=None, data_context=None, data_asset_class_name=None, data_asset_module_name="great_expectations.dataset", data_asset_class=None, *args, **kwargs, ): """Validate the provided data as...
[ "def", "validate", "(", "data_asset", ",", "expectation_suite", "=", "None", ",", "data_asset_name", "=", "None", ",", "expectation_suite_name", "=", "None", ",", "data_context", "=", "None", ",", "data_asset_class_name", "=", "None", ",", "data_asset_module_name", ...
[ 739, 0 ]
[ 848, 75 ]
python
en
['en', 'en', 'en']
True
gen_directory_tree_str
(startpath)
Print the structure of directory as a tree: Ex: project_dir0/ AAA/ BBB/ aaa.txt bbb.txt #Note: files and directories are sorted alphabetically, so that this method can be used for testing.
Print the structure of directory as a tree:
def gen_directory_tree_str(startpath): """Print the structure of directory as a tree: Ex: project_dir0/ AAA/ BBB/ aaa.txt bbb.txt #Note: files and directories are sorted alphabetically, so that this method can be used for testing. """ output_str = "" ...
[ "def", "gen_directory_tree_str", "(", "startpath", ")", ":", "output_str", "=", "\"\"", "tuples", "=", "list", "(", "os", ".", "walk", "(", "startpath", ")", ")", "tuples", ".", "sort", "(", ")", "for", "root", ",", "dirs", ",", "files", "in", "tuples"...
[ 852, 0 ]
[ 880, 21 ]
python
en
['en', 'en', 'en']
True
lint_code
(code: str)
Lint strings of code passed in. Optional dependency "black" must be installed.
Lint strings of code passed in. Optional dependency "black" must be installed.
def lint_code(code: str) -> str: """Lint strings of code passed in. Optional dependency "black" must be installed.""" try: import black black_file_mode = black.FileMode() if not isinstance(code, str): raise TypeError try: linted_code = black.format_file_...
[ "def", "lint_code", "(", "code", ":", "str", ")", "->", "str", ":", "try", ":", "import", "black", "black_file_mode", "=", "black", ".", "FileMode", "(", ")", "if", "not", "isinstance", "(", "code", ",", "str", ")", ":", "raise", "TypeError", "try", ...
[ 883, 0 ]
[ 902, 19 ]
python
en
['en', 'af', 'en']
True
filter_properties_dict
( properties: dict, keep_fields: Optional[list] = None, delete_fields: Optional[list] = None, clean_nulls: Optional[bool] = True, clean_falsy: Optional[bool] = False, keep_falsy_numerics: Optional[bool] = True, inplace: Optional[bool] = False, )
Filter the entries of the source dictionary according to directives concerning the existing keys and values. Args: properties: source dictionary to be filtered according to the supplied filtering directives keep_fields: list of keys that must be retained, with the understanding that all other entri...
Filter the entries of the source dictionary according to directives concerning the existing keys and values.
def filter_properties_dict( properties: dict, keep_fields: Optional[list] = None, delete_fields: Optional[list] = None, clean_nulls: Optional[bool] = True, clean_falsy: Optional[bool] = False, keep_falsy_numerics: Optional[bool] = True, inplace: Optional[bool] = False, ) -> Optional[dict]: ...
[ "def", "filter_properties_dict", "(", "properties", ":", "dict", ",", "keep_fields", ":", "Optional", "[", "list", "]", "=", "None", ",", "delete_fields", ":", "Optional", "[", "list", "]", "=", "None", ",", "clean_nulls", ":", "Optional", "[", "bool", "]"...
[ 905, 0 ]
[ 1000, 21 ]
python
en
['en', 'en', 'en']
True
is_sane_slack_webhook
(url: str)
Really basic sanity checking.
Really basic sanity checking.
def is_sane_slack_webhook(url: str) -> bool: """Really basic sanity checking.""" if url is None: return False return url.strip().startswith("https://hooks.slack.com/")
[ "def", "is_sane_slack_webhook", "(", "url", ":", "str", ")", "->", "bool", ":", "if", "url", "is", "None", ":", "return", "False", "return", "url", ".", "strip", "(", ")", ".", "startswith", "(", "\"https://hooks.slack.com/\"", ")" ]
[ 1038, 0 ]
[ 1043, 61 ]
python
en
['en', 'fil', 'en']
True
generate_library_json_from_registered_expectations
()
Generate the JSON object used to populate the public gallery
Generate the JSON object used to populate the public gallery
def generate_library_json_from_registered_expectations(): """Generate the JSON object used to populate the public gallery""" library_json = {} for expectation_name, expectation in _registered_expectations.items(): report_object = expectation().run_diagnostics() library_json[expectation_name...
[ "def", "generate_library_json_from_registered_expectations", "(", ")", ":", "library_json", "=", "{", "}", "for", "expectation_name", ",", "expectation", "in", "_registered_expectations", ".", "items", "(", ")", ":", "report_object", "=", "expectation", "(", ")", "....
[ 1050, 0 ]
[ 1058, 23 ]
python
en
['en', 'en', 'en']
True
compute_iou
(box_1, box_2)
This function takes a pair of bounding boxes and returns intersection-over- union (IoU) of two bounding boxes.
This function takes a pair of bounding boxes and returns intersection-over- union (IoU) of two bounding boxes.
def compute_iou(box_1, box_2): """ This function takes a pair of bounding boxes and returns intersection-over- union (IoU) of two bounding boxes. """ tl_row_1, tl_col_1, br_row_1, br_col_1 = box_1 tl_row_2, tl_col_2, br_row_2, br_col_2 = box_2 assert tl_row_1 < br_row_1 assert tl_col_1 ...
[ "def", "compute_iou", "(", "box_1", ",", "box_2", ")", ":", "tl_row_1", ",", "tl_col_1", ",", "br_row_1", ",", "br_col_1", "=", "box_1", "tl_row_2", ",", "tl_col_2", ",", "br_row_2", ",", "br_col_2", "=", "box_2", "assert", "tl_row_1", "<", "br_row_1", "as...
[ 10, 0 ]
[ 43, 14 ]
python
en
['en', 'error', 'th']
False
compute_counts
(preds, ground_truths, iou_thr=0.5, conf_thr=0.5)
This function takes a pair of dictionaries (with our JSON format; see ex.) corresponding to predicted and ground truth bounding boxes for a collection of images and returns the number of true positives, false positives, and false negatives. <preds> is a dictionary containing predicted bounding boxe...
This function takes a pair of dictionaries (with our JSON format; see ex.) corresponding to predicted and ground truth bounding boxes for a collection of images and returns the number of true positives, false positives, and false negatives. <preds> is a dictionary containing predicted bounding boxe...
def compute_counts(preds, ground_truths, iou_thr=0.5, conf_thr=0.5): """ This function takes a pair of dictionaries (with our JSON format; see ex.) corresponding to predicted and ground truth bounding boxes for a collection of images and returns the number of true positives, false positives, and fal...
[ "def", "compute_counts", "(", "preds", ",", "ground_truths", ",", "iou_thr", "=", "0.5", ",", "conf_thr", "=", "0.5", ")", ":", "TP", "=", "0", "FP", "=", "0", "FN", "=", "0", "for", "pred_file", ",", "pred", "in", "preds", ".", "items", "(", ")", ...
[ 46, 0 ]
[ 96, 21 ]
python
en
['en', 'error', 'th']
False
main
()
Load training data.
Load training data.
def main(): args = parse_args() ''' Load training data. ''' with args.preds_folder.joinpath('preds_train.json').open('r') as f: preds_train = json.load(f) with args.splits_folder.joinpath('annotations_train.json').open('r') as f: ground_truths_train = json.load(f) if args....
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "with", "args", ".", "preds_folder", ".", "joinpath", "(", "'preds_train.json'", ")", ".", "open", "(", "'r'", ")", "as", "f", ":", "preds_train", "=", "json", ".", "load", "(", "f", ...
[ 125, 0 ]
[ 206, 18 ]
python
en
['en', 'error', 'th']
False
_library_not_loaded_test
( tmp_path_factory, cli_input, library_name, library_import_name, my_caplog )
This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree structure is in place - the config yml contains an empty dict in its datasource entry
This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree structure is in place - the config yml contains an empty dict in its datasource entry
def _library_not_loaded_test( tmp_path_factory, cli_input, library_name, library_import_name, my_caplog ): """ This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree structure is in place - the c...
[ "def", "_library_not_loaded_test", "(", "tmp_path_factory", ",", "cli_input", ",", "library_name", ",", "library_import_name", ",", "my_caplog", ")", ":", "basedir", "=", "tmp_path_factory", ".", "mktemp", "(", "\"test_cli_init_diff\"", ")", "basedir", "=", "str", "...
[ 14, 0 ]
[ 99, 63 ]
python
en
['en', 'error', 'th']
False
test_init_install_sqlalchemy
(caplog, tmp_path_factory)
WARNING: THIS TEST IS AWFUL AND WE HATE IT.
WARNING: THIS TEST IS AWFUL AND WE HATE IT.
def test_init_install_sqlalchemy(caplog, tmp_path_factory): """WARNING: THIS TEST IS AWFUL AND WE HATE IT.""" # This test is as much about changing the entire test environment with side effects as it is about actually testing # the observed behavior. library_import_name = "sqlalchemy" library_name =...
[ "def", "test_init_install_sqlalchemy", "(", "caplog", ",", "tmp_path_factory", ")", ":", "# This test is as much about changing the entire test environment with side effects as it is about actually testing", "# the observed behavior.", "library_import_name", "=", "\"sqlalchemy\"", "library...
[ 106, 0 ]
[ 135, 77 ]
python
en
['en', 'en', 'en']
True
ExpectAlphabeticalColumnNameCountToEqual4.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "# # Setting up a configuration", "try", ":", "assert", "\"user_input\"", "in", "configuration", ".", "kwargs", ",", "\"user_input is...
[ 173, 4 ]
[ 194, 19 ]
python
en
['en', 'error', 'th']
False
cli_message_list
(string_list, list_intro_string=None)
Simple util function for displaying simple lists in cli
Simple util function for displaying simple lists in cli
def cli_message_list(string_list, list_intro_string=None): """Simple util function for displaying simple lists in cli""" if list_intro_string: cli_message(list_intro_string) for string in string_list: cli_message(string)
[ "def", "cli_message_list", "(", "string_list", ",", "list_intro_string", "=", "None", ")", ":", "if", "list_intro_string", ":", "cli_message", "(", "list_intro_string", ")", "for", "string", "in", "string_list", ":", "cli_message", "(", "string", ")" ]
[ 47, 0 ]
[ 52, 27 ]
python
en
['en', 'en', 'en']
True
action_list_to_string
(action_list)
Util function for turning an action list into pretty string
Util function for turning an action list into pretty string
def action_list_to_string(action_list): """Util function for turning an action list into pretty string""" action_list_string = "" for idx, action in enumerate(action_list): action_list_string += "{} ({})".format( action["name"], action["action"]["class_name"] ) if idx == ...
[ "def", "action_list_to_string", "(", "action_list", ")", ":", "action_list_string", "=", "\"\"", "for", "idx", ",", "action", "in", "enumerate", "(", "action_list", ")", ":", "action_list_string", "+=", "\"{} ({})\"", ".", "format", "(", "action", "[", "\"name\"...
[ 55, 0 ]
[ 65, 29 ]
python
en
['en', 'en', 'en']
True
cli_message_dict
( dict_, indent=3, bullet_char="-", message_list=None, recursion_flag=False )
Util function for displaying nested dicts representing ge objects in cli
Util function for displaying nested dicts representing ge objects in cli
def cli_message_dict( dict_, indent=3, bullet_char="-", message_list=None, recursion_flag=False ): """Util function for displaying nested dicts representing ge objects in cli""" if message_list is None: message_list = [] if dict_.get("name"): name = dict_.pop("name") message = "{...
[ "def", "cli_message_dict", "(", "dict_", ",", "indent", "=", "3", ",", "bullet_char", "=", "\"-\"", ",", "message_list", "=", "None", ",", "recursion_flag", "=", "False", ")", ":", "if", "message_list", "is", "None", ":", "message_list", "=", "[", "]", "...
[ 68, 0 ]
[ 116, 38 ]
python
en
['en', 'en', 'en']
True
library_install_load_check
( python_import_name: str, pip_library_name: str )
Dynamically load a module from strings, attempt a pip install or raise a helpful error. :return: True if the library was loaded successfully, False otherwise Args: pip_library_name: name of the library to load python_import_name (str): a module to import to verify installation
Dynamically load a module from strings, attempt a pip install or raise a helpful error.
def library_install_load_check( python_import_name: str, pip_library_name: str ) -> Optional[int]: """ Dynamically load a module from strings, attempt a pip install or raise a helpful error. :return: True if the library was loaded successfully, False otherwise Args: pip_library_name: name ...
[ "def", "library_install_load_check", "(", "python_import_name", ":", "str", ",", "pip_library_name", ":", "str", ")", "->", "Optional", "[", "int", "]", ":", "if", "is_library_loadable", "(", "library_name", "=", "python_import_name", ")", ":", "return", "None", ...
[ 155, 0 ]
[ 214, 22 ]
python
en
['en', 'error', 'th']
False
get_batch_request
( datasource: BaseDatasource, additional_batch_request_args: Optional[Dict[str, Any]] = None, )
This method manages the interaction with user necessary to obtain batch_request for a batch of a data asset. In order to get batch_request this method needs datasource_name, data_connector_name and data_asset_name to combine them into a batch_request dictionary. All three arguments are optional. If t...
This method manages the interaction with user necessary to obtain batch_request for a batch of a data asset.
def get_batch_request( datasource: BaseDatasource, additional_batch_request_args: Optional[Dict[str, Any]] = None, ) -> Dict[str, Union[str, Dict[str, Any]]]: """ This method manages the interaction with user necessary to obtain batch_request for a batch of a data asset. In order to get batch_reque...
[ "def", "get_batch_request", "(", "datasource", ":", "BaseDatasource", ",", "additional_batch_request_args", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ",", ")", "->", "Dict", "[", "str", ",", "Union", "[", "str", ",", "D...
[ 31, 0 ]
[ 112, 24 ]
python
en
['en', 'error', 'th']
False
percents
(x, y)
Определение процента x от y
Определение процента x от y
def percents(x, y): """ Определение процента x от y""" oneprc = x/100 result = y/oneprc return int(result)
[ "def", "percents", "(", "x", ",", "y", ")", ":", "oneprc", "=", "x", "/", "100", "result", "=", "y", "/", "oneprc", "return", "int", "(", "result", ")" ]
[ 0, 0 ]
[ 4, 22 ]
python
bg
['bg', 'ru', 'bg']
True
test_simple_checkpoint_default_properties_with_no_optional_arguments
( empty_data_context, store_validation_result_action, store_eval_parameter_action, update_data_docs_action, titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpoints_v1_with_templates, )
This demonstrates the simplest possible usage.
This demonstrates the simplest possible usage.
def test_simple_checkpoint_default_properties_with_no_optional_arguments( empty_data_context, store_validation_result_action, store_eval_parameter_action, update_data_docs_action, titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpoints_v1_with_templates, ): """This demons...
[ "def", "test_simple_checkpoint_default_properties_with_no_optional_arguments", "(", "empty_data_context", ",", "store_validation_result_action", ",", "store_eval_parameter_action", ",", "update_data_docs_action", ",", "titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpo...
[ 110, 0 ]
[ 149, 46 ]
python
en
['en', 'en', 'en']
True
test_simple_checkpoint_notify_with_all_has_data_docs_action_with_none_specified
( empty_data_context, slack_notification_action, webhook, titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpoints_v1_with_templates, )
The underlying SlackNotificationAction and SlackRenderer default to including links to all sites if the key notify_with is not present. We are intentionally hiding this from users of SimpleCheckpoint by having a default of "all" that sets the configuration appropriately.
The underlying SlackNotificationAction and SlackRenderer default to including links to all sites if the key notify_with is not present. We are intentionally hiding this from users of SimpleCheckpoint by having a default of "all" that sets the configuration appropriately.
def test_simple_checkpoint_notify_with_all_has_data_docs_action_with_none_specified( empty_data_context, slack_notification_action, webhook, titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpoints_v1_with_templates, ): """ The underlying SlackNotificationAction and SlackR...
[ "def", "test_simple_checkpoint_notify_with_all_has_data_docs_action_with_none_specified", "(", "empty_data_context", ",", "slack_notification_action", ",", "webhook", ",", "titanic_pandas_data_context_with_v013_datasource_stats_enabled_with_checkpoints_v1_with_templates", ",", ")", ":", "c...
[ 228, 0 ]
[ 252, 69 ]
python
en
['en', 'error', 'th']
False
FlattenFilter
(node)
Returns a list of all the node and sub nodes.
Returns a list of all the node and sub nodes.
def FlattenFilter(node): """Returns a list of all the node and sub nodes.""" node_list = [] if (node.attributes and node.getAttribute('Name') == '_excluded_files'): # We don't add the "_excluded_files" filter. return [] for current in node.childNodes: if current.nodeName == 'Filter': ...
[ "def", "FlattenFilter", "(", "node", ")", ":", "node_list", "=", "[", "]", "if", "(", "node", ".", "attributes", "and", "node", ".", "getAttribute", "(", "'Name'", ")", "==", "'_excluded_files'", ")", ":", "# We don't add the \"_excluded_files\" filter.", "retur...
[ 94, 0 ]
[ 109, 18 ]
python
en
['en', 'en', 'en']
True
AbsoluteNode
(node)
Makes all the properties we know about in this node absolute.
Makes all the properties we know about in this node absolute.
def AbsoluteNode(node): """Makes all the properties we know about in this node absolute.""" if node.attributes: for (name, value) in node.attributes.items(): if name in ['InheritedPropertySheets', 'RelativePath', 'AdditionalIncludeDirectories', 'IntermediateDirectory', ...
[ "def", "AbsoluteNode", "(", "node", ")", ":", "if", "node", ".", "attributes", ":", "for", "(", "name", ",", "value", ")", "in", "node", ".", "attributes", ".", "items", "(", ")", ":", "if", "name", "in", "[", "'InheritedPropertySheets'", ",", "'Relati...
[ 127, 0 ]
[ 140, 34 ]
python
en
['en', 'en', 'en']
True
CleanupVcproj
(node)
For each sub node, we call recursively this function.
For each sub node, we call recursively this function.
def CleanupVcproj(node): """For each sub node, we call recursively this function.""" for sub_node in node.childNodes: AbsoluteNode(sub_node) CleanupVcproj(sub_node) # Normalize the node, and remove all extranous whitespaces. for sub_node in node.childNodes: if sub_node.nodeType == Node.TEXT_NODE: ...
[ "def", "CleanupVcproj", "(", "node", ")", ":", "for", "sub_node", "in", "node", ".", "childNodes", ":", "AbsoluteNode", "(", "sub_node", ")", "CleanupVcproj", "(", "sub_node", ")", "# Normalize the node, and remove all extranous whitespaces.", "for", "sub_node", "in",...
[ 143, 0 ]
[ 199, 30 ]
python
en
['en', 'en', 'en']
True
main
(argv)
Main function of this vcproj prettifier.
Main function of this vcproj prettifier.
def main(argv): """Main function of this vcproj prettifier.""" global ARGUMENTS ARGUMENTS = argv # check if we have exactly 1 parameter. if len(argv) < 2: print ('Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] ' '[key2=value2]' % argv[0]) return 1 # Parse the keys for i in rang...
[ "def", "main", "(", "argv", ")", ":", "global", "ARGUMENTS", "ARGUMENTS", "=", "argv", "# check if we have exactly 1 parameter.", "if", "len", "(", "argv", ")", "<", "2", ":", "print", "(", "'Usage: %s \"c:\\\\path\\\\to\\\\vcproj.vcproj\" [key1=value1] '", "'[key2=valu...
[ 278, 0 ]
[ 324, 10 ]
python
en
['en', 'en', 'en']
True
venv
(request)
Prepares a virtual environment for unittest, no extra packages required :rtype : virtual_environments.VirtualEnvDescription
Prepares a virtual environment for unittest, no extra packages required :rtype : virtual_environments.VirtualEnvDescription
def venv(request): """ Prepares a virtual environment for unittest, no extra packages required :rtype : virtual_environments.VirtualEnvDescription """ return virtual_environments.prepare_virtualenv()
[ "def", "venv", "(", "request", ")", ":", "return", "virtual_environments", ".", "prepare_virtualenv", "(", ")" ]
[ 14, 0 ]
[ 19, 52 ]
python
en
['en', 'error', 'th']
False
IRHTTPMappingGroup.finalize
(self, ir: 'IR', aconf: Config)
Finalize a MappingGroup based on the attributes of its Mappings. Core elements get lifted into the Group so we can more easily build Envoy routes; host-redirect and shadow get handled, etc. :param ir: the IR we're working from :param aconf: the Config we're working from :return...
Finalize a MappingGroup based on the attributes of its Mappings. Core elements get lifted into the Group so we can more easily build Envoy routes; host-redirect and shadow get handled, etc.
def finalize(self, ir: 'IR', aconf: Config) -> List[IRCluster]: """ Finalize a MappingGroup based on the attributes of its Mappings. Core elements get lifted into the Group so we can more easily build Envoy routes; host-redirect and shadow get handled, etc. :param ir: the IR we're worki...
[ "def", "finalize", "(", "self", ",", "ir", ":", "'IR'", ",", "aconf", ":", "Config", ")", "->", "List", "[", "IRCluster", "]", ":", "add_request_headers", ":", "Dict", "[", "str", ",", "Any", "]", "=", "{", "}", "add_response_headers", ":", "Dict", "...
[ 281, 4 ]
[ 420, 21 ]
python
en
['en', 'error', 'th']
False
venv
(request)
Virtual environment fixture with PyLint of the minimal and maximal supported version for a given python version. * the minimal supported PyLint version is 1.9 * Python 2.7 is supported up to PyLint 1.9 * Python 3.4+ is supported through to the latest, but 1.9 is not supported by python 3
Virtual environment fixture with PyLint of the minimal and maximal supported version for a given python version.
def venv(request): """Virtual environment fixture with PyLint of the minimal and maximal supported version for a given python version. * the minimal supported PyLint version is 1.9 * Python 2.7 is supported up to PyLint 1.9 * Python 3.4+ is supported through to the latest, but 1.9 is not supported ...
[ "def", "venv", "(", "request", ")", ":", "if", "sys", ".", "version_info", "<", "(", "2", ",", "7", ")", "or", "(", "3", ",", ")", "<=", "sys", ".", "version_info", "<", "(", "3", ",", "4", ")", ":", "pytest", ".", "skip", "(", "\"PyLint integr...
[ 15, 0 ]
[ 26, 67 ]
python
en
['en', 'en', 'en']
True
run
(venv, filename)
Execute PyLint with the TeamCityReporter. :param VirtualEnvDescription venv: virtual environment to run the test in :param filename: filename to inspect :rtype: str :return: captured STDOUT
Execute PyLint with the TeamCityReporter.
def run(venv, filename): """Execute PyLint with the TeamCityReporter. :param VirtualEnvDescription venv: virtual environment to run the test in :param filename: filename to inspect :rtype: str :return: captured STDOUT """ command = ' '.join([os.path.join(venv.bin, 'pylint'), '--output-forma...
[ "def", "run", "(", "venv", ",", "filename", ")", ":", "command", "=", "' '", ".", "join", "(", "[", "os", ".", "path", ".", "join", "(", "venv", ".", "bin", ",", "'pylint'", ")", ",", "'--output-format'", ",", "'teamcity.pylint_reporter.TeamCityReporter'",...
[ 68, 0 ]
[ 78, 31 ]
python
en
['en', 'en', 'en']
True