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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
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_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_with_html_store_titanic_random,
):
"""
We call the "suite demo" command without the suite name argument
- The data context has two datasou... | [
"def",
"test_suite_demo_multiple_datasources_with_generator_without_suite_name_argument",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"caplog",
",",
"site_builder_data_context_with_html_store_titanic_random",
",",
")",
":",
"root_dir",
"=",
"site_builder_data_context_with_html... | [
461,
0
] | [
540,
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_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_with_html_store_titanic_random,
):
"""
We call the "suite demo" command with the suite name argument
- The data context has two datasources -... | [
"def",
"test_suite_demo_multiple_datasources_with_generator_with_suite_name_argument",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"caplog",
",",
"site_builder_data_context_with_html_store_titanic_random",
",",
")",
":",
"root_dir",
"=",
"site_builder_data_context_with_html_st... | [
545,
0
] | [
609,
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... | [
612,
0
] | [
620,
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",
"(... | [
625,
0
] | [
654,
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... | [
659,
0
] | [
692,
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",
".",... | [
697,
0
] | [
725,
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",... | [
730,
0
] | [
762,
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_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_with_html_store_titanic_random,
):
"""
Here we verify that the "suite edit" command helps the user to specify the batc... | [
"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_with_html_store_titanic_random",
",",
")",
":",
"root_dir",
"=",
"site_build... | [
767,
0
] | [
847,
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_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_with_html_store_titanic_random,
):
"""
Here we verify that the "suite edit" command uses the batch kwargs found in
... | [
"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_with_html_store_titanic_random",
",",
")",
":",
"root_dir",
"=",
"site_bu... | [
852,
0
] | [
917,
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_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_with_html_store_titanic_random,
):
"""
Here we verify that when the "suite edit" command is called with batch_kwargs arg
that specifies the batch... | [
"def",
"test_suite_edit_multiple_datasources_with_generator_with_batch_kwargs_arg",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"caplog",
",",
"site_builder_data_context_with_html_store_titanic_random",
",",
")",
":",
"root_dir",
"=",
"site_builder_data_context_with_html_store... | [
922,
0
] | [
1013,
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... | [
1018,
0
] | [
1068,
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"... | [
1073,
0
] | [
1128,
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... | [
1133,
0
] | [
1212,
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... | [
1409,
0
] | [
1454,
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",
"... | [
1460,
0
] | [
1509,
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"... | [
1516,
0
] | [
1568,
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... | [
1575,
0
] | [
1630,
5
] | python | en | ['en', 'error', 'th'] | False |
EnvoyStatsMgr.update_log_levels | (self, last_attempt: float, level: Optional[str]=None) |
Heavy lifting around updating the Envoy log levels.
You MUST hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
update_log_levels does all the work of talking to Envoy and computing
new stats, then grabs the access_lock j... |
Heavy lifting around updating the Envoy log levels. | def update_log_levels(self, last_attempt: float, level: Optional[str]=None) -> bool:
"""
Heavy lifting around updating the Envoy log levels.
You MUST hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
update_log_levels doe... | [
"def",
"update_log_levels",
"(",
"self",
",",
"last_attempt",
":",
"float",
",",
"level",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"bool",
":",
"# self.logger.info(\"updating levels\")",
"text",
"=",
"self",
".",
"fetch_log_levels",
"(",
"leve... | [
203,
4
] | [
263,
23
] | python | en | ['en', 'error', 'th'] | False |
EnvoyStatsMgr.get_stats | (self) |
Get the current Envoy stats object, safely.
You MUST NOT hold the access_lock when calling this method.
|
Get the current Envoy stats object, safely. | def get_stats(self) -> EnvoyStats:
"""
Get the current Envoy stats object, safely.
You MUST NOT hold the access_lock when calling this method.
"""
with self.access_lock:
return self.stats | [
"def",
"get_stats",
"(",
"self",
")",
"->",
"EnvoyStats",
":",
"with",
"self",
".",
"access_lock",
":",
"return",
"self",
".",
"stats"
] | [
265,
4
] | [
273,
29
] | python | en | ['en', 'error', 'th'] | False |
EnvoyStatsMgr.update_envoy_stats | (self, last_attempt: float) |
Heavy lifting around updating the Envoy stats.
You MUST hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
update_envoy_stats does all the work of talking to Envoy and computing
new stats, then grabs the access_lock just ... |
Heavy lifting around updating the Envoy stats. | def update_envoy_stats(self, last_attempt: float) -> None:
"""
Heavy lifting around updating the Envoy stats.
You MUST hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
update_envoy_stats does all the work of talking to E... | [
"def",
"update_envoy_stats",
"(",
"self",
",",
"last_attempt",
":",
"float",
")",
"->",
"None",
":",
"text",
"=",
"self",
".",
"fetch_envoy_stats",
"(",
")",
"if",
"not",
"text",
":",
"# EnvoyStats is immutable, so...",
"new_stats",
"=",
"EnvoyStats",
"(",
"ma... | [
287,
4
] | [
451,
34
] | python | en | ['en', 'error', 'th'] | False |
EnvoyStatsMgr.update | (self) |
Update the Envoy stats object, including our take on Envoy's loglevel and
lower-level statistics.
You MUST NOT hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
The first thing that update_envoy_stats does is to acquire ... |
Update the Envoy stats object, including our take on Envoy's loglevel and
lower-level statistics. | def update(self) -> None:
"""
Update the Envoy stats object, including our take on Envoy's loglevel and
lower-level statistics.
You MUST NOT hold the update lock when calling this method.
You MUST NOT hold the access lock when calling this method.
The first thing that u... | [
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"# self.logger.info(\"updating estats\")",
"# First up, try bailing early.",
"if",
"not",
"self",
".",
"update_lock",
".",
"acquire",
"(",
"blocking",
"=",
"False",
")",
":",
"self",
".",
"logger",
".",
"warn... | [
455,
4
] | [
489,
38
] | python | en | ['en', 'error', 'th'] | False |
TestTopologicallySorted.test_Valid | (self) | Test that sorting works on a valid graph with one possible order. | Test that sorting works on a valid graph with one possible order. | def test_Valid(self):
"""Test that sorting works on a valid graph with one possible order."""
graph = {
'a': ['b', 'c'],
'b': [],
'c': ['d'],
'd': ['b'],
}
def GetEdge(node):
return tuple(graph[node])
self.assertEqual(
gyp.common.TopologicallySorted(gr... | [
"def",
"test_Valid",
"(",
"self",
")",
":",
"graph",
"=",
"{",
"'a'",
":",
"[",
"'b'",
",",
"'c'",
"]",
",",
"'b'",
":",
"[",
"]",
",",
"'c'",
":",
"[",
"'d'",
"]",
",",
"'d'",
":",
"[",
"'b'",
"]",
",",
"}",
"def",
"GetEdge",
"(",
"node",
... | [
14,
2
] | [
26,
27
] | python | en | ['en', 'en', 'en'] | True |
TestTopologicallySorted.test_Cycle | (self) | Test that an exception is thrown on a cyclic graph. | Test that an exception is thrown on a cyclic graph. | def test_Cycle(self):
"""Test that an exception is thrown on a cyclic graph."""
graph = {
'a': ['b'],
'b': ['c'],
'c': ['d'],
'd': ['a'],
}
def GetEdge(node):
return tuple(graph[node])
self.assertRaises(
gyp.common.CycleError, gyp.common.TopologicallyS... | [
"def",
"test_Cycle",
"(",
"self",
")",
":",
"graph",
"=",
"{",
"'a'",
":",
"[",
"'b'",
"]",
",",
"'b'",
":",
"[",
"'c'",
"]",
",",
"'c'",
":",
"[",
"'d'",
"]",
",",
"'d'",
":",
"[",
"'a'",
"]",
",",
"}",
"def",
"GetEdge",
"(",
"node",
")",
... | [
28,
2
] | [
40,
28
] | python | en | ['en', 'en', 'en'] | True |
checkpoint | (ctx) |
Checkpoint operations
A Checkpoint is a bundle of one or more batches of data with one or more
Expectation Suites.
A Checkpoint can be as simple as one batch of data paired with one
Expectation Suite.
A Checkpoint can be as complex as many batches of data across different
datasources pai... |
Checkpoint operations | def checkpoint(ctx):
"""
Checkpoint operations
A Checkpoint is a bundle of one or more batches of data with one or more
Expectation Suites.
A Checkpoint can be as simple as one batch of data paired with one
Expectation Suite.
A Checkpoint can be as complex as many batches of data across d... | [
"def",
"checkpoint",
"(",
"ctx",
")",
":",
"directory",
":",
"str",
"=",
"toolkit",
".",
"parse_cli_config_file_location",
"(",
"config_file_location",
"=",
"ctx",
".",
"obj",
".",
"config_file_location",
")",
".",
"get",
"(",
"\"directory\"",
")",
"context",
... | [
57,
0
] | [
86,
57
] | python | en | ['en', 'error', 'th'] | False |
checkpoint_new | (ctx, name, jupyter) | Create a new Checkpoint for easy deployments.
NAME is the name of the Checkpoint to create.
| Create a new Checkpoint for easy deployments. | def checkpoint_new(ctx, name, jupyter):
"""Create a new Checkpoint for easy deployments.
NAME is the name of the Checkpoint to create.
"""
_checkpoint_new(ctx=ctx, checkpoint_name=name, jupyter=jupyter) | [
"def",
"checkpoint_new",
"(",
"ctx",
",",
"name",
",",
"jupyter",
")",
":",
"_checkpoint_new",
"(",
"ctx",
"=",
"ctx",
",",
"checkpoint_name",
"=",
"name",
",",
"jupyter",
"=",
"jupyter",
")"
] | [
98,
0
] | [
103,
67
] | python | en | ['en', 'en', 'en'] | True |
checkpoint_list | (ctx) | List configured checkpoints. | List configured checkpoints. | def checkpoint_list(ctx):
"""List configured checkpoints."""
context: DataContext = ctx.obj.data_context
usage_event_end: str = ctx.obj.usage_event_end
checkpoints: List[str] = context.list_checkpoints()
if not checkpoints:
cli_message(
"No Checkpoints found.\n"
" -... | [
"def",
"checkpoint_list",
"(",
"ctx",
")",
":",
"context",
":",
"DataContext",
"=",
"ctx",
".",
"obj",
".",
"data_context",
"usage_event_end",
":",
"str",
"=",
"ctx",
".",
"obj",
".",
"usage_event_end",
"checkpoints",
":",
"List",
"[",
"str",
"]",
"=",
"... | [
173,
0
] | [
192,
76
] | python | en | ['en', 'en', 'en'] | True |
checkpoint_delete | (ctx, checkpoint) | Delete a Checkpoint. | Delete a Checkpoint. | def checkpoint_delete(ctx, checkpoint):
"""Delete a Checkpoint."""
context: DataContext = ctx.obj.data_context
usage_event_end: str = ctx.obj.usage_event_end
try:
toolkit.delete_checkpoint(
context=context,
checkpoint_name=checkpoint,
usage_event=usage_event_... | [
"def",
"checkpoint_delete",
"(",
"ctx",
",",
"checkpoint",
")",
":",
"context",
":",
"DataContext",
"=",
"ctx",
".",
"obj",
".",
"data_context",
"usage_event_end",
":",
"str",
"=",
"ctx",
".",
"obj",
".",
"usage_event_end",
"try",
":",
"toolkit",
".",
"del... | [
198,
0
] | [
220,
15
] | python | en | ['en', 'it', 'en'] | True |
checkpoint_run | (ctx, checkpoint) | Run a Checkpoint. | Run a Checkpoint. | def checkpoint_run(ctx, checkpoint):
"""Run a Checkpoint."""
context: DataContext = ctx.obj.data_context
usage_event_end: str = ctx.obj.usage_event_end
try:
result: CheckpointResult = toolkit.run_checkpoint(
context=context,
checkpoint_name=checkpoint,
usage_... | [
"def",
"checkpoint_run",
"(",
"ctx",
",",
"checkpoint",
")",
":",
"context",
":",
"DataContext",
"=",
"ctx",
".",
"obj",
".",
"data_context",
"usage_event_end",
":",
"str",
"=",
"ctx",
".",
"obj",
".",
"usage_event_end",
"try",
":",
"result",
":",
"Checkpo... | [
226,
0
] | [
254,
15
] | python | en | ['ro', 'gd', 'en'] | False |
checkpoint_script | (ctx, checkpoint) |
Create a python script to run a Checkpoint.
Checkpoints can be run directly without this script using the
`great_expectations Checkpoint run` command.
This script is provided for those who wish to run Checkpoints via python.
|
Create a python script to run a Checkpoint. | def checkpoint_script(ctx, checkpoint):
"""
Create a python script to run a Checkpoint.
Checkpoints can be run directly without this script using the
`great_expectations Checkpoint run` command.
This script is provided for those who wish to run Checkpoints via python.
"""
context: DataCont... | [
"def",
"checkpoint_script",
"(",
"ctx",
",",
"checkpoint",
")",
":",
"context",
":",
"DataContext",
"=",
"ctx",
".",
"obj",
".",
"data_context",
"usage_event_end",
":",
"str",
"=",
"ctx",
".",
"obj",
".",
"usage_event_end",
"toolkit",
".",
"validate_checkpoint... | [
289,
0
] | [
328,
76
] | python | en | ['en', 'error', 'th'] | False |
Formatter.get_style_defs | (self, arg='') |
Return the style definitions for the current style as a string.
``arg`` is an additional argument whose meaning depends on the
formatter used. Note that ``arg`` can also be a list or tuple
for some formatters like the html formatter.
|
Return the style definitions for the current style as a string. | def get_style_defs(self, arg=''):
"""
Return the style definitions for the current style as a string.
``arg`` is an additional argument whose meaning depends on the
formatter used. Note that ``arg`` can also be a list or tuple
for some formatters like the html formatter.
... | [
"def",
"get_style_defs",
"(",
"self",
",",
"arg",
"=",
"''",
")",
":",
"return",
"''"
] | [
76,
4
] | [
84,
17
] | python | en | ['en', 'error', 'th'] | False |
Formatter.format | (self, tokensource, outfile) |
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.
|
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.
| def format(self, tokensource, outfile):
"""
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.
"""
if self.encoding:
# wrap the outfile in a StreamWriter
outfile = codecs.lookup(self.encoding)[3](outfi... | [
"def",
"format",
"(",
"self",
",",
"tokensource",
",",
"outfile",
")",
":",
"if",
"self",
".",
"encoding",
":",
"# wrap the outfile in a StreamWriter",
"outfile",
"=",
"codecs",
".",
"lookup",
"(",
"self",
".",
"encoding",
")",
"[",
"3",
"]",
"(",
"outfile... | [
86,
4
] | [
94,
58
] | python | en | ['en', 'error', 'th'] | False |
PandasDatasource.build_configuration | (
cls,
data_asset_type=None,
batch_kwargs_generators=None,
boto3_options=None,
reader_method=None,
reader_options=None,
limit=None,
**kwargs
) |
Build a full configuration object for a datasource, potentially including generators with defaults.
Args:
data_asset_type: A ClassConfig dictionary
batch_kwargs_generators: Generator configuration dictionary
boto3_options: Optional dictionary with key-value pairs to... |
Build a full configuration object for a datasource, potentially including generators with defaults. | def build_configuration(
cls,
data_asset_type=None,
batch_kwargs_generators=None,
boto3_options=None,
reader_method=None,
reader_options=None,
limit=None,
**kwargs
):
"""
Build a full configuration object for a datasource, potentially i... | [
"def",
"build_configuration",
"(",
"cls",
",",
"data_asset_type",
"=",
"None",
",",
"batch_kwargs_generators",
"=",
"None",
",",
"boto3_options",
"=",
"None",
",",
"reader_method",
"=",
"None",
",",
"reader_options",
"=",
"None",
",",
"limit",
"=",
"None",
","... | [
39,
4
] | [
104,
28
] | python | en | ['en', 'error', 'th'] | False |
PandasDatasource._infer_default_options | (self, reader_fn: Callable, reader_options: dict) |
Allows reader options to be customized based on file context before loading to a DataFrame
Args:
reader_method (str): pandas reader method
reader_options: Current options and defaults set to pass to the reader method
Returns:
dict: A copy of the reader opti... |
Allows reader options to be customized based on file context before loading to a DataFrame | def _infer_default_options(self, reader_fn: Callable, reader_options: dict) -> dict:
"""
Allows reader options to be customized based on file context before loading to a DataFrame
Args:
reader_method (str): pandas reader method
reader_options: Current options and default... | [
"def",
"_infer_default_options",
"(",
"self",
",",
"reader_fn",
":",
"Callable",
",",
"reader_options",
":",
"dict",
")",
"->",
"dict",
":",
"while",
"isinstance",
"(",
"reader_fn",
",",
"partial",
")",
":",
"# reader_fn might be partial so need to unwrap to get under... | [
291,
4
] | [
311,
40
] | python | en | ['en', 'error', 'th'] | False |
PandasDatasource._get_reader_fn | (self, reader_method=None, path=None) | Static helper for parsing reader types. If reader_method is not provided, path will be used to guess the
correct reader_method.
Args:
reader_method (str): the name of the reader method to use, if available.
path (str): the to use to guess
Returns:
ReaderMeth... | Static helper for parsing reader types. If reader_method is not provided, path will be used to guess the
correct reader_method. | def _get_reader_fn(self, reader_method=None, path=None):
"""Static helper for parsing reader types. If reader_method is not provided, path will be used to guess the
correct reader_method.
Args:
reader_method (str): the name of the reader method to use, if available.
path... | [
"def",
"_get_reader_fn",
"(",
"self",
",",
"reader_method",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"if",
"reader_method",
"is",
"None",
"and",
"path",
"is",
"None",
":",
"raise",
"BatchKwargsError",
"(",
"\"Unable to determine pandas reader function with... | [
313,
4
] | [
348,
13
] | python | en | ['en', 'en', 'en'] | True |
norm_to_pixel_s1 | (pose_3d, camera, norm) |
pose_3d: 3d joints with absolute location in the camera coordinate system (meters)
pose_3d.shape = [T, K, N], e.g. [1500, 17, 3]
pose_2d: 2d joints with pixel location in the images coordinate system (pixels)
pose_3d.shape = [T, K, M], e.g. [1500, 17, 2]
return: normed_3d: root joint contain relati... |
pose_3d: 3d joints with absolute location in the camera coordinate system (meters)
pose_3d.shape = [T, K, N], e.g. [1500, 17, 3]
pose_2d: 2d joints with pixel location in the images coordinate system (pixels)
pose_3d.shape = [T, K, M], e.g. [1500, 17, 2]
return: normed_3d: root joint contain relati... | def norm_to_pixel_s1(pose_3d, camera, norm):
"""
pose_3d: 3d joints with absolute location in the camera coordinate system (meters)
pose_3d.shape = [T, K, N], e.g. [1500, 17, 3]
pose_2d: 2d joints with pixel location in the images coordinate system (pixels)
pose_3d.shape = [T, K, M], e.g. [1500, 17,... | [
"def",
"norm_to_pixel_s1",
"(",
"pose_3d",
",",
"camera",
",",
"norm",
")",
":",
"# stage1: linear project 3d X,Y to pixel unit, corresponding scale Z to keep the same 3d scale",
"pose3d_root_Z",
"=",
"pose_3d",
"[",
":",
",",
"0",
":",
"1",
",",
"2",
":",
"3",
"]",
... | [
30,
0
] | [
57,
31
] | python | en | ['en', 'error', 'th'] | False |
start_thread_soon | (fn, deliver) | Runs ``deliver(outcome.capture(fn))`` in a worker thread.
Generally ``fn`` does some blocking work, and ``deliver`` delivers the
result back to whoever is interested.
This is a low-level, no-frills interface, very similar to using
`threading.Thread` to spawn a thread directly. The main difference is
... | Runs ``deliver(outcome.capture(fn))`` in a worker thread. | def start_thread_soon(fn, deliver):
"""Runs ``deliver(outcome.capture(fn))`` in a worker thread.
Generally ``fn`` does some blocking work, and ``deliver`` delivers the
result back to whoever is interested.
This is a low-level, no-frills interface, very similar to using
`threading.Thread` to spawn ... | [
"def",
"start_thread_soon",
"(",
"fn",
",",
"deliver",
")",
":",
"THREAD_CACHE",
".",
"start_thread_soon",
"(",
"fn",
",",
"deliver",
")"
] | [
107,
0
] | [
167,
47
] | python | en | ['en', 'en', 'en'] | True |
Cache.add | (self, rsrc: Cacheable,
on_delete: Optional[DeletionHandler]=None) |
Adds an entry to the cache, if it's not already present. If
on_delete is not None, it will called when rsrc is removed from
the cache.
|
Adds an entry to the cache, if it's not already present. If
on_delete is not None, it will called when rsrc is removed from
the cache.
| def add(self, rsrc: Cacheable,
on_delete: Optional[DeletionHandler]=None) -> None:
"""
Adds an entry to the cache, if it's not already present. If
on_delete is not None, it will called when rsrc is removed from
the cache.
"""
key = rsrc.cache_key
i... | [
"def",
"add",
"(",
"self",
",",
"rsrc",
":",
"Cacheable",
",",
"on_delete",
":",
"Optional",
"[",
"DeletionHandler",
"]",
"=",
"None",
")",
"->",
"None",
":",
"key",
"=",
"rsrc",
".",
"cache_key",
"if",
"not",
"key",
":",
"self",
".",
"logger",
".",
... | [
57,
4
] | [
75,
47
] | python | en | ['en', 'error', 'th'] | False |
Cache.link | (self, owner: Cacheable, owned: Cacheable) |
Adds a link to the cache. Links are directional from the owner to
the owned. The basic idea is that if the owner changes, all the owned
things get invalidated. Both the owner and the owned must be in the
cache.
|
Adds a link to the cache. Links are directional from the owner to
the owned. The basic idea is that if the owner changes, all the owned
things get invalidated. Both the owner and the owned must be in the
cache.
| def link(self, owner: Cacheable, owned: Cacheable) -> None:
"""
Adds a link to the cache. Links are directional from the owner to
the owned. The basic idea is that if the owner changes, all the owned
things get invalidated. Both the owner and the owned must be in the
cache.
... | [
"def",
"link",
"(",
"self",
",",
"owner",
":",
"Cacheable",
",",
"owned",
":",
"Cacheable",
")",
"->",
"None",
":",
"owner_key",
"=",
"owner",
".",
"cache_key",
"owned_key",
"=",
"owned",
".",
"cache_key",
"if",
"not",
"owner_key",
":",
"self",
".",
"l... | [
77,
4
] | [
107,
35
] | python | en | ['en', 'error', 'th'] | False |
Cache.invalidate | (self, key: str) |
Recursively invalidate the entry named by 'key' and everything to which it
is linked.
|
Recursively invalidate the entry named by 'key' and everything to which it
is linked.
| def invalidate(self, key: str) -> None:
"""
Recursively invalidate the entry named by 'key' and everything to which it
is linked.
"""
# We use worklist to keep track of things to consider: for starters,
# it just has our key in it, and as we find owned things, we add th... | [
"def",
"invalidate",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"None",
":",
"# We use worklist to keep track of things to consider: for starters, ",
"# it just has our key in it, and as we find owned things, we add them",
"# to the worklist to consider.",
"#",
"# Note that word... | [
109,
4
] | [
178,
31
] | python | en | ['en', 'error', 'th'] | False |
Cache.__getitem__ | (self, key: str) |
Fetches only the _resource_ for a given key from the cache. If the
key is not present in the cache, returns None.
If you need the deletion callback, you'll have to work with
self.cache manually.
|
Fetches only the _resource_ for a given key from the cache. If the
key is not present in the cache, returns None. | def __getitem__(self, key: str) -> Optional[Cacheable]:
"""
Fetches only the _resource_ for a given key from the cache. If the
key is not present in the cache, returns None.
If you need the deletion callback, you'll have to work with
self.cache manually.
"""
ite... | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"Cacheable",
"]",
":",
"item",
":",
"Optional",
"[",
"CacheEntry",
"]",
"=",
"self",
".",
"cache",
".",
"get",
"(",
"key",
",",
"None",
")",
"if",
"item",
"is",
... | [
180,
4
] | [
198,
23
] | python | en | ['en', 'error', 'th'] | False |
Cache.dump | (self) |
Dump the cache to the logger.
|
Dump the cache to the logger.
| def dump(self) -> None:
"""
Dump the cache to the logger.
"""
for k in sorted(self.cache.keys()):
rsrc, on_delete = self.cache[k]
self.logger.info(f"CACHE: {k}, on_delete {self.fn_name(on_delete)}:")
if k in self.links:
for owned in ... | [
"def",
"dump",
"(",
"self",
")",
"->",
"None",
":",
"for",
"k",
"in",
"sorted",
"(",
"self",
".",
"cache",
".",
"keys",
"(",
")",
")",
":",
"rsrc",
",",
"on_delete",
"=",
"self",
".",
"cache",
"[",
"k",
"]",
"self",
".",
"logger",
".",
"info",
... | [
200,
4
] | [
212,
60
] | python | en | ['en', 'error', 'th'] | False |
is_instantiation | (decl_string) |
returns True if `decl_string` is template instantiation and False otherwise
:param decl_string: string that should be checked for pattern presence
:type decl_string: str
:rtype: bool
|
returns True if `decl_string` is template instantiation and False otherwise | def is_instantiation(decl_string):
"""
returns True if `decl_string` is template instantiation and False otherwise
:param decl_string: string that should be checked for pattern presence
:type decl_string: str
:rtype: bool
"""
return __THE_PARSER.has_pattern(decl_string) | [
"def",
"is_instantiation",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"has_pattern",
"(",
"decl_string",
")"
] | [
24,
0
] | [
33,
48
] | python | en | ['en', 'error', 'th'] | False |
name | (decl_string) |
returns name of instantiated template
:type decl_string: str
:rtype: str
|
returns name of instantiated template | def name(decl_string):
"""
returns name of instantiated template
:type decl_string: str
:rtype: str
"""
return __THE_PARSER.name(decl_string) | [
"def",
"name",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"name",
"(",
"decl_string",
")"
] | [
36,
0
] | [
43,
41
] | python | en | ['en', 'error', 'th'] | False |
args | (decl_string) |
returns list of template arguments
:type decl_string: `str`
:rtype: [`str`]
|
returns list of template arguments | def args(decl_string):
"""
returns list of template arguments
:type decl_string: `str`
:rtype: [`str`]
"""
return __THE_PARSER.args(decl_string) | [
"def",
"args",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"args",
"(",
"decl_string",
")"
] | [
46,
0
] | [
53,
41
] | python | en | ['en', 'error', 'th'] | False |
split | (decl_string) | returns (name, [arguments] ) | returns (name, [arguments] ) | def split(decl_string):
"""returns (name, [arguments] )"""
return __THE_PARSER.split(decl_string) | [
"def",
"split",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"split",
"(",
"decl_string",
")"
] | [
56,
0
] | [
58,
42
] | python | en | ['en', 'da', 'en'] | True |
split_recursive | (decl_string) | returns [(name, [arguments])] | returns [(name, [arguments])] | def split_recursive(decl_string):
"""returns [(name, [arguments])]"""
return __THE_PARSER.split_recursive(decl_string) | [
"def",
"split_recursive",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"split_recursive",
"(",
"decl_string",
")"
] | [
61,
0
] | [
63,
52
] | python | en | ['en', 'da', 'en'] | True |
join | (name_, args_) | returns name< argument_1, argument_2, ..., argument_n > | returns name< argument_1, argument_2, ..., argument_n > | def join(name_, args_):
"""returns name< argument_1, argument_2, ..., argument_n >"""
return __THE_PARSER.join(name_, args_) | [
"def",
"join",
"(",
"name_",
",",
"args_",
")",
":",
"return",
"__THE_PARSER",
".",
"join",
"(",
"name_",
",",
"args_",
")"
] | [
66,
0
] | [
68,
42
] | python | en | ['en', 'da', 'en'] | True |
normalize | (decl_string) | returns `decl_string`, which contains "normalized" spaces
this functionality allows to implement comparison of 2 different string
which are actually same: x::y< z > and x::y<z>
| returns `decl_string`, which contains "normalized" spaces | def normalize(decl_string):
"""returns `decl_string`, which contains "normalized" spaces
this functionality allows to implement comparison of 2 different string
which are actually same: x::y< z > and x::y<z>
"""
return __THE_PARSER.normalize(decl_string) | [
"def",
"normalize",
"(",
"decl_string",
")",
":",
"return",
"__THE_PARSER",
".",
"normalize",
"(",
"decl_string",
")"
] | [
71,
0
] | [
77,
46
] | python | en | ['en', 'en', 'en'] | True |
normalize_name | (decl) |
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
|
Cached variant of normalize | def normalize_name(decl):
"""
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
"""
if decl.cache.normalized_name is None:
decl.cache.normalized_name = normalize(decl.name)
return decl.cache.normalized_... | [
"def",
"normalize_name",
"(",
"decl",
")",
":",
"if",
"decl",
".",
"cache",
".",
"normalized_name",
"is",
"None",
":",
"decl",
".",
"cache",
".",
"normalized_name",
"=",
"normalize",
"(",
"decl",
".",
"name",
")",
"return",
"decl",
".",
"cache",
".",
"... | [
80,
0
] | [
92,
37
] | python | en | ['en', 'error', 'th'] | False |
normalize_partial_name | (decl) |
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
|
Cached variant of normalize | def normalize_partial_name(decl):
"""
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
"""
if decl.cache.normalized_partial_name is None:
decl.cache.normalized_partial_name = normalize(decl.partial_name)
... | [
"def",
"normalize_partial_name",
"(",
"decl",
")",
":",
"if",
"decl",
".",
"cache",
".",
"normalized_partial_name",
"is",
"None",
":",
"decl",
".",
"cache",
".",
"normalized_partial_name",
"=",
"normalize",
"(",
"decl",
".",
"partial_name",
")",
"return",
"dec... | [
95,
0
] | [
107,
45
] | python | en | ['en', 'error', 'th'] | False |
normalize_full_name_true | (decl) |
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
|
Cached variant of normalize | def normalize_full_name_true(decl):
"""
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
"""
if decl.cache.normalized_full_name_true is None:
decl.cache.normalized_full_name_true = normalize(
d... | [
"def",
"normalize_full_name_true",
"(",
"decl",
")",
":",
"if",
"decl",
".",
"cache",
".",
"normalized_full_name_true",
"is",
"None",
":",
"decl",
".",
"cache",
".",
"normalized_full_name_true",
"=",
"normalize",
"(",
"declaration_utils",
".",
"full_name",
"(",
... | [
110,
0
] | [
123,
47
] | python | en | ['en', 'error', 'th'] | False |
normalize_full_name_false | (decl) |
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
|
Cached variant of normalize | def normalize_full_name_false(decl):
"""
Cached variant of normalize
Args:
decl (declaration.declaration_t): the declaration
Returns:
str: normalized name
"""
if decl.cache.normalized_full_name_false is None:
decl.cache.normalized_full_name_false = normalize(
... | [
"def",
"normalize_full_name_false",
"(",
"decl",
")",
":",
"if",
"decl",
".",
"cache",
".",
"normalized_full_name_false",
"is",
"None",
":",
"decl",
".",
"cache",
".",
"normalized_full_name_false",
"=",
"normalize",
"(",
"declaration_utils",
".",
"full_name",
"(",... | [
126,
0
] | [
139,
48
] | python | en | ['en', 'error', 'th'] | False |
strip_version | (ver: str) |
strip_version is needed to strip a major/minor version of non-standard symbols. For example, when working with GKE,
`kubectl version` returns a minor version like '14+', which is not semver or any standard version, for that matter.
So we handle exceptions like that here.
:param ver: version string
... |
strip_version is needed to strip a major/minor version of non-standard symbols. For example, when working with GKE,
`kubectl version` returns a minor version like '14+', which is not semver or any standard version, for that matter.
So we handle exceptions like that here.
:param ver: version string
... | def strip_version(ver: str):
"""
strip_version is needed to strip a major/minor version of non-standard symbols. For example, when working with GKE,
`kubectl version` returns a minor version like '14+', which is not semver or any standard version, for that matter.
So we handle exceptions like that here.... | [
"def",
"strip_version",
"(",
"ver",
":",
"str",
")",
":",
"try",
":",
"return",
"int",
"(",
"ver",
")",
"except",
"ValueError",
"as",
"e",
":",
"# GKE returns weird versions with '+' in the end",
"if",
"ver",
"[",
"-",
"1",
"]",
"==",
"'+'",
":",
"return",... | [
114,
0
] | [
131,
27
] | python | en | ['en', 'error', 'th'] | False |
MyCustomSemanticTypeColumnDomainBuilder._get_domains | (
self,
variables: Optional[ParameterContainer] = None,
) |
Find the semantic column type for each column and return all domains matching the specified type or types.
|
Find the semantic column type for each column and return all domains matching the specified type or types.
| def _get_domains(
self,
variables: Optional[ParameterContainer] = None,
) -> List[Domain]:
"""
Find the semantic column type for each column and return all domains matching the specified type or types.
"""
batch_id: str = self.get_batch_id(variables=variables)
... | [
"def",
"_get_domains",
"(",
"self",
",",
"variables",
":",
"Optional",
"[",
"ParameterContainer",
"]",
"=",
"None",
",",
")",
"->",
"List",
"[",
"Domain",
"]",
":",
"batch_id",
":",
"str",
"=",
"self",
".",
"get_batch_id",
"(",
"variables",
"=",
"variabl... | [
43,
4
] | [
85,
22
] | python | en | ['en', 'error', 'th'] | False |
register | (classname: str, cls: "SchemaType") | Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry.
Example: ::
class MyClass:
pass
register('MyClass', MyClass)
# Registry:
# {
# ... | Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry. | def register(classname: str, cls: "SchemaType") -> None:
"""Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry.
Example: ::
class MyClass:
pass
registe... | [
"def",
"register",
"(",
"classname",
":",
"str",
",",
"cls",
":",
"\"SchemaType\"",
")",
"->",
"None",
":",
"# Module where the class is located",
"module",
"=",
"cls",
".",
"__module__",
"# Full module path to the class",
"# e.g. user.schemas.UserSchema",
"fullpath",
"... | [
25,
0
] | [
64,
15
] | python | en | ['en', 'en', 'en'] | True |
get_class | (
classname: str, all: bool = False
) | Retrieve a class from the registry.
:raises: marshmallow.exceptions.RegistryError if the class cannot be found
or if there are multiple entries for the given class name.
| Retrieve a class from the registry. | def get_class(
classname: str, all: bool = False
) -> typing.Union[typing.List["SchemaType"], "SchemaType"]:
"""Retrieve a class from the registry.
:raises: marshmallow.exceptions.RegistryError if the class cannot be found
or if there are multiple entries for the given class name.
"""
try:
... | [
"def",
"get_class",
"(",
"classname",
":",
"str",
",",
"all",
":",
"bool",
"=",
"False",
")",
"->",
"typing",
".",
"Union",
"[",
"typing",
".",
"List",
"[",
"\"SchemaType\"",
"]",
",",
"\"SchemaType\"",
"]",
":",
"try",
":",
"classes",
"=",
"_registry"... | [
67,
0
] | [
91,
38
] | python | en | ['en', 'en', 'en'] | True |
test_opt_out_environment_variable | (
in_memory_data_context_config_usage_stats_enabled, monkeypatch
) | Set the env variable GE_USAGE_STATS value to any of the following: FALSE, False, false, 0 | Set the env variable GE_USAGE_STATS value to any of the following: FALSE, False, false, 0 | def test_opt_out_environment_variable(
in_memory_data_context_config_usage_stats_enabled, monkeypatch
):
"""Set the env variable GE_USAGE_STATS value to any of the following: FALSE, False, false, 0"""
monkeypatch.setenv("GE_USAGE_STATS", "False")
assert (
in_memory_data_context_config_usage_stat... | [
"def",
"test_opt_out_environment_variable",
"(",
"in_memory_data_context_config_usage_stats_enabled",
",",
"monkeypatch",
")",
":",
"monkeypatch",
".",
"setenv",
"(",
"\"GE_USAGE_STATS\"",
",",
"\"False\"",
")",
"assert",
"(",
"in_memory_data_context_config_usage_stats_enabled",
... | [
78,
0
] | [
89,
69
] | python | en | ['en', 'en', 'en'] | True |
InferredAssetSqlDataConnector.__init__ | (
self,
name: str,
datasource_name: str,
execution_engine: Optional[ExecutionEngine] = None,
data_asset_name_prefix: Optional[str] = "",
data_asset_name_suffix: Optional[str] = "",
include_schema_name: Optional[bool] = False,
splitter_method: Optional[str]... |
InferredAssetDataConnector for connecting to data on a SQL database
Args:
name (str): The name of this DataConnector
datasource_name (str): The name of the Datasource that contains it
execution_engine (ExecutionEngine): An ExecutionEngine
data_asset_name... |
InferredAssetDataConnector for connecting to data on a SQL database | def __init__(
self,
name: str,
datasource_name: str,
execution_engine: Optional[ExecutionEngine] = None,
data_asset_name_prefix: Optional[str] = "",
data_asset_name_suffix: Optional[str] = "",
include_schema_name: Optional[bool] = False,
splitter_method: O... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"datasource_name",
":",
"str",
",",
"execution_engine",
":",
"Optional",
"[",
"ExecutionEngine",
"]",
"=",
"None",
",",
"data_asset_name_prefix",
":",
"Optional",
"[",
"str",
"]",
"=",
"\"\"",
"... | [
18,
4
] | [
94,
9
] | python | en | ['en', 'error', 'th'] | False |
kwargs_to_tuple | (d) | Convert expectation configuration kwargs to a canonical tuple. | Convert expectation configuration kwargs to a canonical tuple. | def kwargs_to_tuple(d):
"""Convert expectation configuration kwargs to a canonical tuple."""
if isinstance(d, list):
return tuple([kwargs_to_tuple(v) for v in sorted(d)])
elif isinstance(d, dict):
return tuple(
[
(k, kwargs_to_tuple(v))
for k, v in... | [
"def",
"kwargs_to_tuple",
"(",
"d",
")",
":",
"if",
"isinstance",
"(",
"d",
",",
"list",
")",
":",
"return",
"tuple",
"(",
"[",
"kwargs_to_tuple",
"(",
"v",
")",
"for",
"v",
"in",
"sorted",
"(",
"d",
")",
"]",
")",
"elif",
"isinstance",
"(",
"d",
... | [
7,
0
] | [
20,
12
] | python | en | ['en', 'en', 'sw'] | True |
DomainBuilder.__init__ | (
self,
data_context: DataContext,
batch_request: Optional[Union[dict, str]] = None,
) |
Args:
data_context: DataContext
batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
|
Args:
data_context: DataContext
batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
| def __init__(
self,
data_context: DataContext,
batch_request: Optional[Union[dict, str]] = None,
):
"""
Args:
data_context: DataContext
batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"data_context",
":",
"DataContext",
",",
"batch_request",
":",
"Optional",
"[",
"Union",
"[",
"dict",
",",
"str",
"]",
"]",
"=",
"None",
",",
")",
":",
"if",
"data_context",
"is",
"None",
":",
"raise",
"ge_exceptions"... | [
21,
4
] | [
38,
43
] | python | en | ['en', 'error', 'th'] | False |
DomainBuilder.get_domains | (
self,
variables: Optional[ParameterContainer] = None,
) |
Note: Please do not overwrite the public "get_domains()" method. If a child class needs to check parameters,
then please do so in its implementation of the (private) "_get_domains()" method, or in a utility method.
|
Note: Please do not overwrite the public "get_domains()" method. If a child class needs to check parameters,
then please do so in its implementation of the (private) "_get_domains()" method, or in a utility method.
| def get_domains(
self,
variables: Optional[ParameterContainer] = None,
) -> List[Domain]:
"""
Note: Please do not overwrite the public "get_domains()" method. If a child class needs to check parameters,
then please do so in its implementation of the (private) "_get_domains()... | [
"def",
"get_domains",
"(",
"self",
",",
"variables",
":",
"Optional",
"[",
"ParameterContainer",
"]",
"=",
"None",
",",
")",
"->",
"List",
"[",
"Domain",
"]",
":",
"return",
"self",
".",
"_get_domains",
"(",
"variables",
"=",
"variables",
")"
] | [
40,
4
] | [
48,
53
] | python | en | ['en', 'error', 'th'] | False |
DomainBuilder._get_domains | (
self,
variables: Optional[ParameterContainer] = None,
) |
_get_domains is the primary workhorse for the DomainBuilder
|
_get_domains is the primary workhorse for the DomainBuilder
| def _get_domains(
self,
variables: Optional[ParameterContainer] = None,
) -> List[Domain]:
"""
_get_domains is the primary workhorse for the DomainBuilder
"""
pass | [
"def",
"_get_domains",
"(",
"self",
",",
"variables",
":",
"Optional",
"[",
"ParameterContainer",
"]",
"=",
"None",
",",
")",
"->",
"List",
"[",
"Domain",
"]",
":",
"pass"
] | [
51,
4
] | [
59,
12
] | python | en | ['en', 'error', 'th'] | False |
format_exc | (exception, message) |
Formats an exception message to make the output cleaner.
|
Formats an exception message to make the output cleaner.
| def format_exc(exception, message):
"""
Formats an exception message to make the output cleaner.
"""
if exception == Exception:
exc = Exception
return exc, message
elif exception == ElementNotVisibleException:
exc = ElementNotVisibleException
elif exception == "ElementNot... | [
"def",
"format_exc",
"(",
"exception",
",",
"message",
")",
":",
"if",
"exception",
"==",
"Exception",
":",
"exc",
"=",
"Exception",
"return",
"exc",
",",
"message",
"elif",
"exception",
"==",
"ElementNotVisibleException",
":",
"exc",
"=",
"ElementNotVisibleExce... | [
14,
0
] | [
51,
23
] | python | en | ['en', 'error', 'th'] | False |
BaseRecipeAttrViewSet.get_queryset | (self) | Return objects for the current authenticated user only | Return objects for the current authenticated user only | def get_queryset(self):
"""Return objects for the current authenticated user only"""
assigned_only = bool(
int(self.request.query_params.get('assigned_only', 0))
)
queryset = self.queryset
if assigned_only:
queryset = queryset.filter(recipe__isnull=False)
... | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"assigned_only",
"=",
"bool",
"(",
"int",
"(",
"self",
".",
"request",
".",
"query_params",
".",
"get",
"(",
"'assigned_only'",
",",
"0",
")",
")",
")",
"queryset",
"=",
"self",
".",
"queryset",
"if",
"assi... | [
18,
4
] | [
29,
38
] | python | en | ['en', 'en', 'en'] | True |
BaseRecipeAttrViewSet.perform_create | (self, serializer) | Create a new tag | Create a new tag | def perform_create(self, serializer):
"""Create a new tag"""
serializer.save(user=self.request.user) | [
"def",
"perform_create",
"(",
"self",
",",
"serializer",
")",
":",
"serializer",
".",
"save",
"(",
"user",
"=",
"self",
".",
"request",
".",
"user",
")"
] | [
31,
4
] | [
33,
47
] | python | en | ['en', 'en', 'en'] | True |
RecipeViewSet._params_to_ints | (self, qs) | Convert a list of string IDs to a list of integers | Convert a list of string IDs to a list of integers | def _params_to_ints(self, qs):
"""Convert a list of string IDs to a list of integers"""
return [int(str_id) for str_id in qs.split(',')] | [
"def",
"_params_to_ints",
"(",
"self",
",",
"qs",
")",
":",
"return",
"[",
"int",
"(",
"str_id",
")",
"for",
"str_id",
"in",
"qs",
".",
"split",
"(",
"','",
")",
"]"
] | [
55,
4
] | [
57,
56
] | python | en | ['en', 'en', 'en'] | True |
RecipeViewSet.get_queryset | (self) | Retrieve the recipes for the authenticated user | Retrieve the recipes for the authenticated user | def get_queryset(self):
"""Retrieve the recipes for the authenticated user"""
tags = self.request.query_params.get('tags')
ingredients = self.request.query_params.get('ingredients')
queryset = self.queryset
if tags:
tag_ids = self._params_to_ints(tags)
que... | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"tags",
"=",
"self",
".",
"request",
".",
"query_params",
".",
"get",
"(",
"'tags'",
")",
"ingredients",
"=",
"self",
".",
"request",
".",
"query_params",
".",
"get",
"(",
"'ingredients'",
")",
"queryset",
"=... | [
59,
4
] | [
71,
54
] | python | en | ['en', 'en', 'en'] | True |
RecipeViewSet.get_serializer_class | (self) | Return appropriate serializer class | Return appropriate serializer class | def get_serializer_class(self):
"""Return appropriate serializer class"""
if self.action == 'retrieve':
return serializers.RecipeDetailSerializer
elif self.action == 'upload_image':
return serializers.RecipeImageSerializer
return self.serializer_class | [
"def",
"get_serializer_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"action",
"==",
"'retrieve'",
":",
"return",
"serializers",
".",
"RecipeDetailSerializer",
"elif",
"self",
".",
"action",
"==",
"'upload_image'",
":",
"return",
"serializers",
".",
"RecipeI... | [
73,
4
] | [
80,
36
] | python | en | ['en', 'co', 'en'] | True |
RecipeViewSet.perform_create | (self, serializer) | Create a new recipe | Create a new recipe | def perform_create(self, serializer):
"""Create a new recipe"""
serializer.save(user=self.request.user) | [
"def",
"perform_create",
"(",
"self",
",",
"serializer",
")",
":",
"serializer",
".",
"save",
"(",
"user",
"=",
"self",
".",
"request",
".",
"user",
")"
] | [
82,
4
] | [
84,
47
] | python | en | ['en', 'co', 'en'] | True |
RecipeViewSet.upload_image | (self, request, pk=None) | Upload an image to a recipe | Upload an image to a recipe | def upload_image(self, request, pk=None):
"""Upload an image to a recipe"""
recipe = self.get_object()
serializer = self.get_serializer(
recipe,
data=request.data
)
if serializer.is_valid():
serializer.save()
return Response(
... | [
"def",
"upload_image",
"(",
"self",
",",
"request",
",",
"pk",
"=",
"None",
")",
":",
"recipe",
"=",
"self",
".",
"get_object",
"(",
")",
"serializer",
"=",
"self",
".",
"get_serializer",
"(",
"recipe",
",",
"data",
"=",
"request",
".",
"data",
")",
... | [
87,
4
] | [
104,
9
] | python | en | ['en', 'en', 'en'] | True |
is_valid_partition_object | (partition_object) | Tests whether a given object is a valid continuous or categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
| Tests whether a given object is a valid continuous or categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
| def is_valid_partition_object(partition_object):
"""Tests whether a given object is a valid continuous or categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
"""
return is_valid_continuous_partition_object(
partition_object
) or is_val... | [
"def",
"is_valid_partition_object",
"(",
"partition_object",
")",
":",
"return",
"is_valid_continuous_partition_object",
"(",
"partition_object",
")",
"or",
"is_valid_categorical_partition_object",
"(",
"partition_object",
")"
] | [
22,
0
] | [
29,
64
] | python | en | ['en', 'en', 'en'] | True |
is_valid_categorical_partition_object | (partition_object) | Tests whether a given object is a valid categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
| Tests whether a given object is a valid categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
| def is_valid_categorical_partition_object(partition_object):
"""Tests whether a given object is a valid categorical partition object.
:param partition_object: The partition_object to evaluate
:return: Boolean
"""
if (
partition_object is None
or ("weights" not in partition_object)
... | [
"def",
"is_valid_categorical_partition_object",
"(",
"partition_object",
")",
":",
"if",
"(",
"partition_object",
"is",
"None",
"or",
"(",
"\"weights\"",
"not",
"in",
"partition_object",
")",
"or",
"(",
"\"values\"",
"not",
"in",
"partition_object",
")",
")",
":",... | [
32,
0
] | [
46,
61
] | python | en | ['en', 'en', 'en'] | True |
is_valid_continuous_partition_object | (partition_object) | Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`.
:param partition_object: The partition_object to evaluate
:return: Boolean
| Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`. | def is_valid_continuous_partition_object(partition_object):
"""Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`.
:param partition_object: The partition_object to evaluate
:return: Boolean
"""
if (
(partition_object is None)
or ("weight... | [
"def",
"is_valid_continuous_partition_object",
"(",
"partition_object",
")",
":",
"if",
"(",
"(",
"partition_object",
"is",
"None",
")",
"or",
"(",
"\"weights\"",
"not",
"in",
"partition_object",
")",
"or",
"(",
"\"bins\"",
"not",
"in",
"partition_object",
")",
... | [
49,
0
] | [
78,
5
] | python | en | ['en', 'en', 'en'] | True |
categorical_partition_data | (data) | Convenience method for creating weights from categorical data.
Args:
data (list-like): The data from which to construct the estimate.
Returns:
A new partition object::
{
"values": (list) The categorical values present in the data
"weights": (list) T... | Convenience method for creating weights from categorical data. | def categorical_partition_data(data):
"""Convenience method for creating weights from categorical data.
Args:
data (list-like): The data from which to construct the estimate.
Returns:
A new partition object::
{
"values": (list) The categorical values present in... | [
"def",
"categorical_partition_data",
"(",
"data",
")",
":",
"# Make dropna explicit (even though it defaults to true)",
"series",
"=",
"pd",
".",
"Series",
"(",
"data",
")",
"value_counts",
"=",
"series",
".",
"value_counts",
"(",
"dropna",
"=",
"True",
")",
"# Comp... | [
81,
0
] | [
107,
70
] | python | en | ['en', 'en', 'en'] | True |
kde_partition_data | (data, estimate_tails=True) | Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth.
Args:
data (list-like): The data from which to construct the estimate
estimate_tails (bool): Whether to estimate the tails of the distribution to keep the partition object finite
... | Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth. | def kde_partition_data(data, estimate_tails=True):
"""Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth.
Args:
data (list-like): The data from which to construct the estimate
estimate_tails (bool): Whether to estimate the tail... | [
"def",
"kde_partition_data",
"(",
"data",
",",
"estimate_tails",
"=",
"True",
")",
":",
"kde",
"=",
"stats",
".",
"kde",
".",
"gaussian_kde",
"(",
"data",
")",
"evaluation_bins",
"=",
"np",
".",
"linspace",
"(",
"start",
"=",
"np",
".",
"min",
"(",
"da... | [
110,
0
] | [
151,
45
] | python | en | ['en', 'en', 'en'] | True |
continuous_partition_data | (data, bins="auto", n_bins=10, **kwargs) | Convenience method for building a partition object on continuous data
Args:
data (list-like): The data from which to construct the estimate.
bins (string): One of 'uniform' (for uniformly spaced bins), 'ntile' (for percentile-spaced bins), or 'auto'
(for automatically spaced bins)
... | Convenience method for building a partition object on continuous data | def continuous_partition_data(data, bins="auto", n_bins=10, **kwargs):
"""Convenience method for building a partition object on continuous data
Args:
data (list-like): The data from which to construct the estimate.
bins (string): One of 'uniform' (for uniformly spaced bins), 'ntile' (for percen... | [
"def",
"continuous_partition_data",
"(",
"data",
",",
"bins",
"=",
"\"auto\"",
",",
"n_bins",
"=",
"10",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"bins",
"==",
"\"uniform\"",
":",
"bins",
"=",
"np",
".",
"linspace",
"(",
"start",
"=",
"np",
".",
"min... | [
163,
0
] | [
201,
59
] | python | en | ['en', 'en', 'en'] | True |
build_continuous_partition_object | (
dataset, column, bins="auto", n_bins=10, allow_relative_error=False
) | Convenience method for building a partition object on continuous data from a dataset and column
Args:
dataset (GE Dataset): the dataset for which to compute the partition
column (string): The name of the column for which to construct the estimate.
bins (string): One of 'uniform' (for unifor... | Convenience method for building a partition object on continuous data from a dataset and column | def build_continuous_partition_object(
dataset, column, bins="auto", n_bins=10, allow_relative_error=False
):
"""Convenience method for building a partition object on continuous data from a dataset and column
Args:
dataset (GE Dataset): the dataset for which to compute the partition
column ... | [
"def",
"build_continuous_partition_object",
"(",
"dataset",
",",
"column",
",",
"bins",
"=",
"\"auto\"",
",",
"n_bins",
"=",
"10",
",",
"allow_relative_error",
"=",
"False",
")",
":",
"bins",
"=",
"dataset",
".",
"get_column_partition",
"(",
"column",
",",
"bi... | [
204,
0
] | [
246,
27
] | python | en | ['en', 'en', 'en'] | True |
build_categorical_partition_object | (dataset, column, sort="value") | Convenience method for building a partition object on categorical data from a dataset and column
Args:
dataset (GE Dataset): the dataset for which to compute the partition
column (string): The name of the column for which to construct the estimate.
sort (string): must be one of "value", "co... | Convenience method for building a partition object on categorical data from a dataset and column | def build_categorical_partition_object(dataset, column, sort="value"):
"""Convenience method for building a partition object on categorical data from a dataset and column
Args:
dataset (GE Dataset): the dataset for which to compute the partition
column (string): The name of the column for which... | [
"def",
"build_categorical_partition_object",
"(",
"dataset",
",",
"column",
",",
"sort",
"=",
"\"value\"",
")",
":",
"counts",
"=",
"dataset",
".",
"get_column_value_counts",
"(",
"column",
",",
"sort",
")",
"return",
"{",
"\"values\"",
":",
"list",
"(",
"coun... | [
249,
0
] | [
273,
5
] | python | en | ['en', 'en', 'en'] | True |
infer_distribution_parameters | (data, distribution, params=None) | Convenience method for determining the shape parameters of a given distribution
Args:
data (list-like): The data to build shape parameters from.
distribution (string): Scipy distribution, determines which parameters to build.
params (dict or None): The known parameters. Parameters given her... | Convenience method for determining the shape parameters of a given distribution | def infer_distribution_parameters(data, distribution, params=None):
"""Convenience method for determining the shape parameters of a given distribution
Args:
data (list-like): The data to build shape parameters from.
distribution (string): Scipy distribution, determines which parameters to build... | [
"def",
"infer_distribution_parameters",
"(",
"data",
",",
"distribution",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"dict",
"(",
")",
"elif",
"not",
"isinstance",
"(",
"params",
",",
"dict",
")",
":",
"raise"... | [
276,
0
] | [
369,
17
] | python | en | ['en', 'en', 'en'] | True |
_scipy_distribution_positional_args_from_dict | (distribution, params) | Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\
to see an example of scipy's positional arguments. This function returns the arguments s... | Helper function that returns positional arguments for a scipy distribution using a dict of parameters. | def _scipy_distribution_positional_args_from_dict(distribution, params):
"""Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\
to see a... | [
"def",
"_scipy_distribution_positional_args_from_dict",
"(",
"distribution",
",",
"params",
")",
":",
"params",
"[",
"\"loc\"",
"]",
"=",
"params",
".",
"get",
"(",
"\"loc\"",
",",
"0",
")",
"if",
"\"scale\"",
"not",
"in",
"params",
":",
"params",
"[",
"\"sc... | [
372,
0
] | [
407,
45
] | python | en | ['en', 'en', 'en'] | True |
validate_distribution_parameters | (distribution, params) | Ensures that necessary parameters for a distribution are present and that all parameters are sensical.
If parameters necessary to construct a distribution are missing or invalid, this function raises ValueError\
with an informative description. Note that 'loc' and 'scale' are optional arguments, and that... | Ensures that necessary parameters for a distribution are present and that all parameters are sensical. | def validate_distribution_parameters(distribution, params):
"""Ensures that necessary parameters for a distribution are present and that all parameters are sensical.
If parameters necessary to construct a distribution are missing or invalid, this function raises ValueError\
with an informative descri... | [
"def",
"validate_distribution_parameters",
"(",
"distribution",
",",
"params",
")",
":",
"norm_msg",
"=",
"(",
"\"norm distributions require 0 parameters and optionally 'mean', 'std_dev'.\"",
")",
"beta_msg",
"=",
"\"beta distributions require 2 positive parameters 'alpha', 'beta' and ... | [
410,
0
] | [
549,
10
] | python | en | ['en', 'en', 'en'] | True |
create_multiple_expectations | (df, columns, expectation_type, *args, **kwargs) | Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column names represented as strings.
expectation_type (string): The expectation type.
... | Creates an identical expectation for each of the given columns with the specified arguments, if any. | def create_multiple_expectations(df, columns, expectation_type, *args, **kwargs):
"""Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column ... | [
"def",
"create_multiple_expectations",
"(",
"df",
",",
"columns",
",",
"expectation_type",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"expectation",
"=",
"getattr",
"(",
"df",
",",
"expectation_type",
")",
"results",
"=",
"list",
"(",
")",
"for",... | [
552,
0
] | [
575,
18
] | python | en | ['en', 'en', 'en'] | True |
frac_coverage_classify | (dataset_in, clean_mask, no_data=-9999) |
Description:
Performs fractional coverage algorithm on given dataset. If no clean mask is given, the 'cf_mask'
variable must be included in the input dataset, as it will be used to create a
clean mask
Assumption:
- The implemented algorithm is defined for Landsat 5/Landsat 7; in order f... |
Description:
Performs fractional coverage algorithm on given dataset. If no clean mask is given, the 'cf_mask'
variable must be included in the input dataset, as it will be used to create a
clean mask
Assumption:
- The implemented algorithm is defined for Landsat 5/Landsat 7; in order f... | def frac_coverage_classify(dataset_in, clean_mask, no_data=-9999):
"""
Description:
Performs fractional coverage algorithm on given dataset. If no clean mask is given, the 'cf_mask'
variable must be included in the input dataset, as it will be used to create a
clean mask
Assumption:
... | [
"def",
"frac_coverage_classify",
"(",
"dataset_in",
",",
"clean_mask",
",",
"no_data",
"=",
"-",
"9999",
")",
":",
"band_stack",
"=",
"[",
"]",
"mosaic_clean_mask",
"=",
"clean_mask",
".",
"flatten",
"(",
")",
"for",
"band",
"in",
"[",
"dataset_in",
".",
"... | [
22,
0
] | [
133,
23
] | python | en | ['en', 'error', 'th'] | False |
main | (platform, product_type, min_lon, max_lon, min_lat, max_lat, start_date, end_date, dc_config) |
Description:
Command-line fractional coverage tool - TODO
Assumptions:
The command-line tool assumes there is a measurement called cf_mask
Inputs:
platform (str)
product_type (str)
min_lon (str)
max_lon (str)
min_lat (str)
max_lat (str)
start_date (str)... |
Description:
Command-line fractional coverage tool - TODO
Assumptions:
The command-line tool assumes there is a measurement called cf_mask
Inputs:
platform (str)
product_type (str)
min_lon (str)
max_lon (str)
min_lat (str)
max_lat (str)
start_date (str)... | def main(platform, product_type, min_lon, max_lon, min_lat, max_lat, start_date, end_date, dc_config):
"""
Description:
Command-line fractional coverage tool - TODO
Assumptions:
The command-line tool assumes there is a measurement called cf_mask
Inputs:
platform (str)
product_typ... | [
"def",
"main",
"(",
"platform",
",",
"product_type",
",",
"min_lon",
",",
"max_lon",
",",
"min_lat",
",",
"max_lat",
",",
"start_date",
",",
"end_date",
",",
"dc_config",
")",
":",
"# Initialize data cube object",
"dc",
"=",
"datacube",
".",
"Datacube",
"(",
... | [
136,
0
] | [
230,
97
] | python | en | ['en', 'error', 'th'] | False |
TemporalModelBase.receptive_field | (self) |
Return the total receptive field of this model as # of frames.
|
Return the total receptive field of this model as # of frames.
| def receptive_field(self):
"""
Return the total receptive field of this model as # of frames.
"""
frames = 0
for f in self.pad:
frames += f
return 1 + 2 * frames | [
"def",
"receptive_field",
"(",
"self",
")",
":",
"frames",
"=",
"0",
"for",
"f",
"in",
"self",
".",
"pad",
":",
"frames",
"+=",
"f",
"return",
"1",
"+",
"2",
"*",
"frames"
] | [
41,
4
] | [
48,
29
] | python | en | ['en', 'error', 'th'] | False |
TemporalModelBase.total_causal_shift | (self) |
Return the asymmetric offset for sequence padding.
The returned value is typically 0 if causal convolutions are disabled,
otherwise it is half the receptive field.
|
Return the asymmetric offset for sequence padding.
The returned value is typically 0 if causal convolutions are disabled,
otherwise it is half the receptive field.
| def total_causal_shift(self):
"""
Return the asymmetric offset for sequence padding.
The returned value is typically 0 if causal convolutions are disabled,
otherwise it is half the receptive field.
"""
frames = self.causal_shift[0]
next_dilation = self.filter_widt... | [
"def",
"total_causal_shift",
"(",
"self",
")",
":",
"frames",
"=",
"self",
".",
"causal_shift",
"[",
"0",
"]",
"next_dilation",
"=",
"self",
".",
"filter_widths",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"self",
".",
"filt... | [
50,
4
] | [
61,
21
] | python | en | ['en', 'error', 'th'] | False |
TemporalModel.__init__ | (self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024, dense=False) |
Initialize this model.
Arguments:
num_joints_in -- number of input joints (e.g. 17 for Human3.6M)
in_features -- number of input features for each joint (typically 2 for 2D input)
num_joints_out -- number of output joints (can be different than input)
filter_widths -- l... |
Initialize this model. | def __init__(self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024, dense=False):
"""
Initialize this model.
Arguments:
num_joints_in -- number of input joints (e.g. 17 for Human3.6M)
in_features -- number of ... | [
"def",
"__init__",
"(",
"self",
",",
"num_joints_in",
",",
"in_features",
",",
"num_joints_out",
",",
"filter_widths",
",",
"causal",
"=",
"False",
",",
"dropout",
"=",
"0.25",
",",
"channels",
"=",
"1024",
",",
"dense",
"=",
"False",
")",
":",
"super",
... | [
92,
4
] | [
131,
49
] | python | en | ['en', 'error', 'th'] | False |
TemporalModelOptimized1f.__init__ | (self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024) |
Initialize this model.
Arguments:
num_joints_in -- number of input joints (e.g. 17 for Human3.6M)
in_features -- number of input features for each joint (typically 2 for 2D input)
num_joints_out -- number of output joints (can be different than input)
filter_widths -- l... |
Initialize this model. | def __init__(self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024):
"""
Initialize this model.
Arguments:
num_joints_in -- number of input joints (e.g. 17 for Human3.6M)
in_features -- number of input feature... | [
"def",
"__init__",
"(",
"self",
",",
"num_joints_in",
",",
"in_features",
",",
"num_joints_out",
",",
"filter_widths",
",",
"causal",
"=",
"False",
",",
"dropout",
"=",
"0.25",
",",
"channels",
"=",
"1024",
")",
":",
"super",
"(",
")",
".",
"__init__",
"... | [
159,
4
] | [
193,
49
] | python | en | ['en', 'error', 'th'] | False |
Same_Model.__init__ | (self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024) |
Initialize this model.
New Arguments:
FlexGroupLayer: Use this function with different group strategies
self.rep_pad: Recommend use nn.ReflectionPad1d to make the same temporal size as 2d inputs.
|
Initialize this model. | def __init__(self, num_joints_in, in_features, num_joints_out,
filter_widths, causal=False, dropout=0.25, channels=1024):
"""
Initialize this model.
New Arguments:
FlexGroupLayer: Use this function with different group strategies
self.rep_pad: Recommend use nn.R... | [
"def",
"__init__",
"(",
"self",
",",
"num_joints_in",
",",
"in_features",
",",
"num_joints_out",
",",
"filter_widths",
",",
"causal",
"=",
"False",
",",
"dropout",
"=",
"0.25",
",",
"channels",
"=",
"1024",
")",
":",
"mode",
"=",
"'replicate'",
"#padding mod... | [
217,
4
] | [
253,
92
] | python | en | ['en', 'error', 'th'] | False |
FlockTool.Dispatch | (self, args) | Dispatches a string command to a method. | Dispatches a string command to a method. | def Dispatch(self, args):
"""Dispatches a string command to a method."""
if len(args) < 1:
raise Exception("Not enough arguments")
method = "Exec%s" % self._CommandifyName(args[0])
getattr(self, method)(*args[1:]) | [
"def",
"Dispatch",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"raise",
"Exception",
"(",
"\"Not enough arguments\"",
")",
"method",
"=",
"\"Exec%s\"",
"%",
"self",
".",
"_CommandifyName",
"(",
"args",
"[",
"0",
"]... | [
22,
2
] | [
28,
36
] | python | en | ['en', 'en', 'en'] | True |
FlockTool._CommandifyName | (self, name_string) | Transforms a tool name like copy-info-plist to CopyInfoPlist | Transforms a tool name like copy-info-plist to CopyInfoPlist | def _CommandifyName(self, name_string):
"""Transforms a tool name like copy-info-plist to CopyInfoPlist"""
return name_string.title().replace('-', '') | [
"def",
"_CommandifyName",
"(",
"self",
",",
"name_string",
")",
":",
"return",
"name_string",
".",
"title",
"(",
")",
".",
"replace",
"(",
"'-'",
",",
"''",
")"
] | [
30,
2
] | [
32,
47
] | python | en | ['en', 'pl', 'en'] | True |
FlockTool.ExecFlock | (self, lockfile, *cmd_list) | Emulates the most basic behavior of Linux's flock(1). | Emulates the most basic behavior of Linux's flock(1). | def ExecFlock(self, lockfile, *cmd_list):
"""Emulates the most basic behavior of Linux's flock(1)."""
# Rely on exception handling to report errors.
# Note that the stock python on SunOS has a bug
# where fcntl.flock(fd, LOCK_EX) always fails
# with EBADF, that's why we use this F_SETLK
# hack i... | [
"def",
"ExecFlock",
"(",
"self",
",",
"lockfile",
",",
"*",
"cmd_list",
")",
":",
"# Rely on exception handling to report errors.",
"# Note that the stock python on SunOS has a bug",
"# where fcntl.flock(fd, LOCK_EX) always fails",
"# with EBADF, that's why we use this F_SETLK",
"# hac... | [
34,
2
] | [
49,
36
] | python | en | ['en', 'da', 'en'] | True |
call_redirector_t.__init__ | (self, name, decls) | creates call_redirector_t instance.
:param name: name of method, to be called on every object in the
`decls` list
:param decls: list of objects
| creates call_redirector_t instance. | def __init__(self, name, decls):
"""creates call_redirector_t instance.
:param name: name of method, to be called on every object in the
`decls` list
:param decls: list of objects
"""
object.__init__(self)
self.name = name
self.decls = decls | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"decls",
")",
":",
"object",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"name",
"=",
"name",
"self",
".",
"decls",
"=",
"decls"
] | [
21,
4
] | [
30,
26
] | python | en | ['en', 'en', 'en'] | True |
call_redirector_t.__call__ | (self, *arguments, **keywords) | calls method :attr:`call_redirector_t.name` on every object
within the :attr:`call_redirector_t.decls` list | calls method :attr:`call_redirector_t.name` on every object
within the :attr:`call_redirector_t.decls` list | def __call__(self, *arguments, **keywords):
"""calls method :attr:`call_redirector_t.name` on every object
within the :attr:`call_redirector_t.decls` list"""
for d in self.decls:
callable_ = getattr(d, self.name)
callable_(*arguments, **keywords) | [
"def",
"__call__",
"(",
"self",
",",
"*",
"arguments",
",",
"*",
"*",
"keywords",
")",
":",
"for",
"d",
"in",
"self",
".",
"decls",
":",
"callable_",
"=",
"getattr",
"(",
"d",
",",
"self",
".",
"name",
")",
"callable_",
"(",
"*",
"arguments",
",",
... | [
32,
4
] | [
37,
45
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.