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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
MsvsSettings._GetLdManifestFlags | (self, config, name, gyp_to_build_path,
allow_isolation, build_dir) | Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
used to assert it doesn't add anything to the merged one.
- the list of all the manifest files to be merged by the manif... | Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
used to assert it doesn't add anything to the merged one.
- the list of all the manifest files to be merged by the manif... | def _GetLdManifestFlags(self, config, name, gyp_to_build_path,
allow_isolation, build_dir):
"""Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
... | [
"def",
"_GetLdManifestFlags",
"(",
"self",
",",
"config",
",",
"name",
",",
"gyp_to_build_path",
",",
"allow_isolation",
",",
"build_dir",
")",
":",
"generate_manifest",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'GenerateManifest'",
")",
",... | [
658,
2
] | [
743,
45
] | python | en | ['en', 'haw', 'en'] | True |
MsvsSettings._GetAdditionalManifestFiles | (self, config, gyp_to_build_path) | Gets additional manifest files that are added to the default one
generated by the linker. | Gets additional manifest files that are added to the default one
generated by the linker. | def _GetAdditionalManifestFiles(self, config, gyp_to_build_path):
"""Gets additional manifest files that are added to the default one
generated by the linker."""
files = self._Setting(('VCManifestTool', 'AdditionalManifestFiles'), config,
default=[])
if isinstance(files, str):
... | [
"def",
"_GetAdditionalManifestFiles",
"(",
"self",
",",
"config",
",",
"gyp_to_build_path",
")",
":",
"files",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCManifestTool'",
",",
"'AdditionalManifestFiles'",
")",
",",
"config",
",",
"default",
"=",
"[",
"]",
")",... | [
745,
2
] | [
754,
27
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.IsUseLibraryDependencyInputs | (self, config) | Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib). | Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib). | def IsUseLibraryDependencyInputs(self, config):
"""Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib)."""
config = self._TargetConfig(config)
uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config)
return uldi ==... | [
"def",
"IsUseLibraryDependencyInputs",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"uldi",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'UseLibraryDependencyInputs'",
")",
",",
"conf... | [
756,
2
] | [
761,
25
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.IsEmbedManifest | (self, config) | Returns whether manifest should be linked into binary. | Returns whether manifest should be linked into binary. | def IsEmbedManifest(self, config):
"""Returns whether manifest should be linked into binary."""
config = self._TargetConfig(config)
embed = self._Setting(('VCManifestTool', 'EmbedManifest'), config,
default='true')
return embed == 'true' | [
"def",
"IsEmbedManifest",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"embed",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCManifestTool'",
",",
"'EmbedManifest'",
")",
",",
"config",
",",
"default"... | [
763,
2
] | [
768,
26
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.IsLinkIncremental | (self, config) | Returns whether the target should be linked incrementally. | Returns whether the target should be linked incrementally. | def IsLinkIncremental(self, config):
"""Returns whether the target should be linked incrementally."""
config = self._TargetConfig(config)
link_inc = self._Setting(('VCLinkerTool', 'LinkIncremental'), config)
return link_inc != '1' | [
"def",
"IsLinkIncremental",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"link_inc",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'LinkIncremental'",
")",
",",
"config",
")",
"ret... | [
770,
2
] | [
774,
26
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.GetRcflags | (self, config, gyp_to_ninja_path) | Returns the flags that need to be added to invocations of the resource
compiler. | Returns the flags that need to be added to invocations of the resource
compiler. | def GetRcflags(self, config, gyp_to_ninja_path):
"""Returns the flags that need to be added to invocations of the resource
compiler."""
config = self._TargetConfig(config)
rcflags = []
rc = self._GetWrapper(self, self.msvs_settings[config],
'VCResourceCompilerTool', append=rcflags)
rc('A... | [
"def",
"GetRcflags",
"(",
"self",
",",
"config",
",",
"gyp_to_ninja_path",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"rcflags",
"=",
"[",
"]",
"rc",
"=",
"self",
".",
"_GetWrapper",
"(",
"self",
",",
"self",
".",
"msvs_... | [
776,
2
] | [
788,
18
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.BuildCygwinBashCommandLine | (self, args, path_to_base) | Build a command line that runs args via cygwin bash. We assume that all
incoming paths are in Windows normpath'd form, so they need to be
converted to posix style for the part of the command line that's passed to
bash. We also have to do some Visual Studio macro emulation here because
various rules use ... | Build a command line that runs args via cygwin bash. We assume that all
incoming paths are in Windows normpath'd form, so they need to be
converted to posix style for the part of the command line that's passed to
bash. We also have to do some Visual Studio macro emulation here because
various rules use ... | def BuildCygwinBashCommandLine(self, args, path_to_base):
"""Build a command line that runs args via cygwin bash. We assume that all
incoming paths are in Windows normpath'd form, so they need to be
converted to posix style for the part of the command line that's passed to
bash. We also have to do some ... | [
"def",
"BuildCygwinBashCommandLine",
"(",
"self",
",",
"args",
",",
"path_to_base",
")",
":",
"cygwin_dir",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path_to_base",
",",
"self",
".",
"msvs_cygwin_dirs",
"[",
"0",
... | [
790,
2
] | [
808,
14
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.IsRuleRunUnderCygwin | (self, rule) | Determine if an action should be run under cygwin. If the variable is
unset, or set to 1 we use cygwin. | Determine if an action should be run under cygwin. If the variable is
unset, or set to 1 we use cygwin. | def IsRuleRunUnderCygwin(self, rule):
"""Determine if an action should be run under cygwin. If the variable is
unset, or set to 1 we use cygwin."""
return int(rule.get('msvs_cygwin_shell',
self.spec.get('msvs_cygwin_shell', 1))) != 0 | [
"def",
"IsRuleRunUnderCygwin",
"(",
"self",
",",
"rule",
")",
":",
"return",
"int",
"(",
"rule",
".",
"get",
"(",
"'msvs_cygwin_shell'",
",",
"self",
".",
"spec",
".",
"get",
"(",
"'msvs_cygwin_shell'",
",",
"1",
")",
")",
")",
"!=",
"0"
] | [
810,
2
] | [
814,
68
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings._HasExplicitRuleForExtension | (self, spec, extension) | Determine if there's an explicit rule for a particular extension. | Determine if there's an explicit rule for a particular extension. | def _HasExplicitRuleForExtension(self, spec, extension):
"""Determine if there's an explicit rule for a particular extension."""
for rule in spec.get('rules', []):
if rule['extension'] == extension:
return True
return False | [
"def",
"_HasExplicitRuleForExtension",
"(",
"self",
",",
"spec",
",",
"extension",
")",
":",
"for",
"rule",
"in",
"spec",
".",
"get",
"(",
"'rules'",
",",
"[",
"]",
")",
":",
"if",
"rule",
"[",
"'extension'",
"]",
"==",
"extension",
":",
"return",
"Tru... | [
816,
2
] | [
821,
16
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings._HasExplicitIdlActions | (self, spec) | Determine if an action should not run midl for .idl files. | Determine if an action should not run midl for .idl files. | def _HasExplicitIdlActions(self, spec):
"""Determine if an action should not run midl for .idl files."""
return any([action.get('explicit_idl_action', 0)
for action in spec.get('actions', [])]) | [
"def",
"_HasExplicitIdlActions",
"(",
"self",
",",
"spec",
")",
":",
"return",
"any",
"(",
"[",
"action",
".",
"get",
"(",
"'explicit_idl_action'",
",",
"0",
")",
"for",
"action",
"in",
"spec",
".",
"get",
"(",
"'actions'",
",",
"[",
"]",
")",
"]",
"... | [
823,
2
] | [
826,
55
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.HasExplicitIdlRulesOrActions | (self, spec) | Determine if there's an explicit rule or action for idl files. When
there isn't we need to generate implicit rules to build MIDL .idl files. | Determine if there's an explicit rule or action for idl files. When
there isn't we need to generate implicit rules to build MIDL .idl files. | def HasExplicitIdlRulesOrActions(self, spec):
"""Determine if there's an explicit rule or action for idl files. When
there isn't we need to generate implicit rules to build MIDL .idl files."""
return (self._HasExplicitRuleForExtension(spec, 'idl') or
self._HasExplicitIdlActions(spec)) | [
"def",
"HasExplicitIdlRulesOrActions",
"(",
"self",
",",
"spec",
")",
":",
"return",
"(",
"self",
".",
"_HasExplicitRuleForExtension",
"(",
"spec",
",",
"'idl'",
")",
"or",
"self",
".",
"_HasExplicitIdlActions",
"(",
"spec",
")",
")"
] | [
828,
2
] | [
832,
46
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.HasExplicitAsmRules | (self, spec) | Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files. | Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files. | def HasExplicitAsmRules(self, spec):
"""Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files."""
return self._HasExplicitRuleForExtension(spec, 'asm') | [
"def",
"HasExplicitAsmRules",
"(",
"self",
",",
"spec",
")",
":",
"return",
"self",
".",
"_HasExplicitRuleForExtension",
"(",
"spec",
",",
"'asm'",
")"
] | [
834,
2
] | [
837,
57
] | python | en | ['en', 'en', 'en'] | True |
MsvsSettings.GetIdlBuildData | (self, source, config) | Determine the implicit outputs for an idl file. Returns output
directory, outputs, and variables and flags that are required. | Determine the implicit outputs for an idl file. Returns output
directory, outputs, and variables and flags that are required. | def GetIdlBuildData(self, source, config):
"""Determine the implicit outputs for an idl file. Returns output
directory, outputs, and variables and flags that are required."""
config = self._TargetConfig(config)
midl_get = self._GetWrapper(self, self.msvs_settings[config], 'VCMIDLTool')
def midl(name... | [
"def",
"GetIdlBuildData",
"(",
"self",
",",
"source",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"midl_get",
"=",
"self",
".",
"_GetWrapper",
"(",
"self",
",",
"self",
".",
"msvs_settings",
"[",
"config",
"]... | [
839,
2
] | [
864,
43
] | python | en | ['en', 'en', 'en'] | True |
PrecompiledHeader._PchHeader | (self) | Get the header that will appear in an #include line for all source
files. | Get the header that will appear in an #include line for all source
files. | def _PchHeader(self):
"""Get the header that will appear in an #include line for all source
files."""
return os.path.split(self.settings.msvs_precompiled_header[self.config])[1] | [
"def",
"_PchHeader",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"settings",
".",
"msvs_precompiled_header",
"[",
"self",
".",
"config",
"]",
")",
"[",
"1",
"]"
] | [
887,
2
] | [
890,
79
] | python | en | ['en', 'en', 'en'] | True |
PrecompiledHeader.GetObjDependencies | (self, sources, objs, arch) | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py. | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py. | def GetObjDependencies(self, sources, objs, arch):
"""Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py."""... | [
"def",
"GetObjDependencies",
"(",
"self",
",",
"sources",
",",
"objs",
",",
"arch",
")",
":",
"assert",
"arch",
"is",
"None",
"if",
"not",
"self",
".",
"_PchHeader",
"(",
")",
":",
"return",
"[",
"]",
"pch_ext",
"=",
"os",
".",
"path",
".",
"splitext... | [
892,
2
] | [
904,
13
] | python | en | ['en', 'en', 'en'] | True |
PrecompiledHeader.GetPchBuildCommands | (self, arch) | Not used on Windows as there are no additional build steps required
(instead, existing steps are modified in GetFlagsModifications below). | Not used on Windows as there are no additional build steps required
(instead, existing steps are modified in GetFlagsModifications below). | def GetPchBuildCommands(self, arch):
"""Not used on Windows as there are no additional build steps required
(instead, existing steps are modified in GetFlagsModifications below)."""
return [] | [
"def",
"GetPchBuildCommands",
"(",
"self",
",",
"arch",
")",
":",
"return",
"[",
"]"
] | [
906,
2
] | [
909,
13
] | python | en | ['en', 'en', 'en'] | True |
PrecompiledHeader.GetFlagsModifications | (self, input, output, implicit, command,
cflags_c, cflags_cc, expand_special) | Get the modified cflags and implicit dependencies that should be used
for the pch compilation step. | Get the modified cflags and implicit dependencies that should be used
for the pch compilation step. | def GetFlagsModifications(self, input, output, implicit, command,
cflags_c, cflags_cc, expand_special):
"""Get the modified cflags and implicit dependencies that should be used
for the pch compilation step."""
if input == self.pch_source:
pch_output = ['/Yc' + self._PchHead... | [
"def",
"GetFlagsModifications",
"(",
"self",
",",
"input",
",",
"output",
",",
"implicit",
",",
"command",
",",
"cflags_c",
",",
"cflags_cc",
",",
"expand_special",
")",
":",
"if",
"input",
"==",
"self",
".",
"pch_source",
":",
"pch_output",
"=",
"[",
"'/Y... | [
911,
2
] | [
923,
31
] | python | en | ['en', 'en', 'en'] | True |
HttpLexer.get_tokens_unprocessed | (self, text, stack=('root',)) | Reset the content-type state. | Reset the content-type state. | def get_tokens_unprocessed(self, text, stack=('root',)):
"""Reset the content-type state."""
self.content_type = None
return RegexLexer.get_tokens_unprocessed(self, text, stack) | [
"def",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
",",
"stack",
"=",
"(",
"'root'",
",",
")",
")",
":",
"self",
".",
"content_type",
"=",
"None",
"return",
"RegexLexer",
".",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
",",
"stack",
")"
] | [
124,
4
] | [
127,
67
] | python | en | ['en', 'en', 'en'] | True |
test_suite_edit_without_suite_name_raises_error | (
mock_emit,
monkeypatch,
empty_data_context_stats_enabled,
) | 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(
mock_emit,
monkeypatch,
empty_data_context_stats_enabled,
):
"""This is really only testing click missing arguments"""
context: DataContext = empty_data_context_stats_enabled
monkeypatch.chdir(os.path.dirname(context.root_directory))
runn... | [
"def",
"test_suite_edit_without_suite_name_raises_error",
"(",
"mock_emit",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"monkeypatch",
".",
"chdir",
"(",
"os",
".",
"pa... | [
786,
0
] | [
816,
5
] | python | en | ['en', 'en', 'en'] | True |
test_suite_edit_datasource_and_batch_request_error | (
mock_emit,
monkeypatch,
empty_data_context_stats_enabled,
) | This is really only testing click missing arguments | This is really only testing click missing arguments | def test_suite_edit_datasource_and_batch_request_error(
mock_emit,
monkeypatch,
empty_data_context_stats_enabled,
):
"""This is really only testing click missing arguments"""
context: DataContext = empty_data_context_stats_enabled
monkeypatch.chdir(os.path.dirname(context.root_directory))
e... | [
"def",
"test_suite_edit_datasource_and_batch_request_error",
"(",
"mock_emit",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"monkeypatch",
".",
"chdir",
"(",
"os",
".",
... | [
822,
0
] | [
875,
5
] | python | en | ['en', 'en', 'en'] | True |
test_suite_edit_with_non_existent_suite_name_raises_error | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
) |
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,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
):
"""
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",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_c... | [
883,
0
] | [
943,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_edit_with_non_existent_datasource_shows_helpful_error_message | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
) |
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,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
):
"""
The command should:
- exit with a clear error message
- NOT open Data Docs
- NOT open jupyt... | [
"def",
"test_suite_edit_with_non_existent_datasource_shows_helpful_error_message",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"context",
":",
"DataContext",
"=",
... | [
951,
0
] | [
1021,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_edit_multiple_datasources_with_no_additional_args_without_citations_runs_notebook_opens_jupyter | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_pandas_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
Here we verify that the "suite edit" command helps the user to specify batch_request
when it is called without the optional command-line 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 t... |
Here we verify that the "suite edit" command helps the user to specify batch_request
when it is called without the optional command-line arguments that specify the batch. | def test_suite_edit_multiple_datasources_with_no_additional_args_without_citations_runs_notebook_opens_jupyter(
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_pandas_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
):
"""
H... | [
"def",
"test_suite_edit_multiple_datasources_with_no_additional_args_without_citations_runs_notebook_opens_jupyter",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_v013_multi_datasource_pandas_data_context_with_checkpoints... | [
1029,
0
] | [
1249,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_edit_multiple_datasources_with_no_additional_args_with_citations_runs_notebook_opens_jupyter | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_pandas_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
Here we verify that the "suite edit" command uses the batch_request found in
citations in the existing suite when it is called without the optional
command-line arguments that specify the batch.
First, we call the "suite new" command to create the expectation suite our
test will edit -- this step ... |
Here we verify that the "suite edit" command uses the batch_request found in
citations in the existing suite when it is called without the optional
command-line arguments that specify the batch. | def test_suite_edit_multiple_datasources_with_no_additional_args_with_citations_runs_notebook_opens_jupyter(
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_pandas_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
):
"""
Here... | [
"def",
"test_suite_edit_multiple_datasources_with_no_additional_args_with_citations_runs_notebook_opens_jupyter",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_v013_multi_datasource_pandas_data_context_with_checkpoints_v1... | [
1257,
0
] | [
1451,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_without_citations_runs_notebook_opens_jupyter | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_multi_execution_engine_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
Here we verify that the "suite edit" command helps the user to specify batch_request
when it is called without the optional command-line 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 use an... |
Here we verify that the "suite edit" command helps the user to specify batch_request
when it is called without the optional command-line arguments that specify the batch. | def test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_without_citations_runs_notebook_opens_jupyter(
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_multi_execution_engine_data_context_with_checkpoints_v1_with_empty_store_stats_... | [
"def",
"test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_without_citations_runs_notebook_opens_jupyter",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_v013_multi_datasource_multi_execution_engine_data... | [
1459,
0
] | [
1679,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_with_citations_runs_notebook_opens_jupyter | (
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_multi_execution_engine_data_context_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
Here we verify that the "suite edit" command uses the batch_request found in
citations in the existing suite when it is called without the optional
command-line arguments that specify the batch.
First, we call the "suite new" command to create the expectation suite our
test will edit -- this step ... |
Here we verify that the "suite edit" command uses the batch_request found in
citations in the existing suite when it is called without the optional
command-line arguments that specify the batch. | def test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_with_citations_runs_notebook_opens_jupyter(
mock_webbrowser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_v013_multi_datasource_multi_execution_engine_data_context_with_checkpoints_v1_with_empty_store_stats_ena... | [
"def",
"test_suite_edit_multiple_datasources_with_sql_with_no_additional_args_with_citations_runs_notebook_opens_jupyter",
"(",
"mock_webbrowser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_v013_multi_datasource_multi_execution_engine_data_co... | [
1687,
0
] | [
1881,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_new_profile_on_context_with_no_datasource_raises_error | (
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
) |
We call the "suite new --profile" command on a context with no datasource
The command should:
- exit with a clear error message
- send a DataContext init success message
- send a new fail message
|
We call the "suite new --profile" command on a context with no datasource | def test_suite_new_profile_on_context_with_no_datasource_raises_error(
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
empty_data_context_stats_enabled,
):
"""
We call the "suite new --profile" command on a context with no datasource
The command should:
- exit with a clear error me... | [
"def",
"test_suite_new_profile_on_context_with_no_datasource_raises_error",
"(",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled... | [
2502,
0
] | [
2571,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_new_profile_on_existing_suite_raises_error | (
mock_emit, caplog, monkeypatch, empty_data_context_stats_enabled
) |
We call the "suite new --profile" command with an existing suite
The command should:
- exit with a clear error message
- send a DataContext init success message
- send a new fail message
|
We call the "suite new --profile" command with an existing suite | def test_suite_new_profile_on_existing_suite_raises_error(
mock_emit, caplog, monkeypatch, empty_data_context_stats_enabled
):
"""
We call the "suite new --profile" command with an existing suite
The command should:
- exit with a clear error message
- send a DataContext init success message
... | [
"def",
"test_suite_new_profile_on_existing_suite_raises_error",
"(",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"empty_data_context_stats_enabled",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"monkeypatch",
".",
"chdir",
"(",
... | [
2577,
0
] | [
2671,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_new_profile_runs_notebook_no_jupyter | (
mock_webbroser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
We call the "suite new --profile" command
The command should:
- create a new notebook
- send a DataContext init success message
- send a new success message
|
We call the "suite new --profile" command | def test_suite_new_profile_runs_notebook_no_jupyter(
mock_webbroser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled,
):
"""
We call the "suite new --profile" command
The command sho... | [
"def",
"test_suite_new_profile_runs_notebook_no_jupyter",
"(",
"mock_webbroser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled",
",",
")",
":",
"... | [
2679,
0
] | [
2880,
5
] | python | en | ['en', 'error', 'th'] | False |
test_suite_new_profile_runs_notebook_opens_jupyter | (
mock_webbroser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled,
) |
We call the "suite new --profile" command
The command should:
- create a new notebook
- open the notebook in jupyter
- send a DataContext init success message
- send a new success message
|
We call the "suite new --profile" command | def test_suite_new_profile_runs_notebook_opens_jupyter(
mock_webbroser,
mock_subprocess,
mock_emit,
caplog,
monkeypatch,
titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled,
):
"""
We call the "suite new --profile" command
The command ... | [
"def",
"test_suite_new_profile_runs_notebook_opens_jupyter",
"(",
"mock_webbroser",
",",
"mock_subprocess",
",",
"mock_emit",
",",
"caplog",
",",
"monkeypatch",
",",
"titanic_pandas_data_context_with_v013_datasource_with_checkpoints_v1_with_empty_store_stats_enabled",
",",
")",
":",
... | [
2888,
0
] | [
3089,
5
] | python | en | ['en', 'error', 'th'] | False |
CIDRRange.__init__ | (self, spec: str) |
Initialize a CIDRRange from a spec, which can look like any of:
127.0.0.1 -- an exact IPv4 match
::1 -- an exact IPv6 match
192.168.0.0/16 -- an IPv4 range
2001:2000::/64 -- an IPv6 range
If the prefix is not a valid IP address, or if the prefix length
isn't a ... |
Initialize a CIDRRange from a spec, which can look like any of: | def __init__(self, spec: str) -> None:
"""
Initialize a CIDRRange from a spec, which can look like any of:
127.0.0.1 -- an exact IPv4 match
::1 -- an exact IPv6 match
192.168.0.0/16 -- an IPv4 range
2001:2000::/64 -- an IPv6 range
If the prefix is not a valid IP... | [
"def",
"__init__",
"(",
"self",
",",
"spec",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"error",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
"self",
".",
"address",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
"self",
".",
"prefix_len",
... | [
10,
4
] | [
65,
33
] | python | en | ['en', 'error', 'th'] | False |
CIDRRange.__bool__ | (self) |
A CIDRRange will evaluate as True IFF there is no error, the address
is not None, and the prefix_len is not None.
|
A CIDRRange will evaluate as True IFF there is no error, the address
is not None, and the prefix_len is not None.
| def __bool__(self) -> bool:
"""
A CIDRRange will evaluate as True IFF there is no error, the address
is not None, and the prefix_len is not None.
"""
return ((not self.error) and
(self.address is not None) and
(self.prefix_len is not None)) | [
"def",
"__bool__",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"(",
"(",
"not",
"self",
".",
"error",
")",
"and",
"(",
"self",
".",
"address",
"is",
"not",
"None",
")",
"and",
"(",
"self",
".",
"prefix_len",
"is",
"not",
"None",
")",
")"
] | [
67,
4
] | [
75,
46
] | python | en | ['en', 'error', 'th'] | False |
CIDRRange.as_dict | (self) |
Return a dictionary version of a CIDRRange, suitable for use in
an Envoy config as an envoy.api.v2.core.CidrRange.
|
Return a dictionary version of a CIDRRange, suitable for use in
an Envoy config as an envoy.api.v2.core.CidrRange.
| def as_dict(self) -> dict:
"""
Return a dictionary version of a CIDRRange, suitable for use in
an Envoy config as an envoy.api.v2.core.CidrRange.
"""
return {
"address_prefix": self.address,
"prefix_len": self.prefix_len
} | [
"def",
"as_dict",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"\"address_prefix\"",
":",
"self",
".",
"address",
",",
"\"prefix_len\"",
":",
"self",
".",
"prefix_len",
"}"
] | [
83,
4
] | [
92,
9
] | python | en | ['en', 'error', 'th'] | False |
test_parser_timing | () | We currently reuse the parser, clearing the stack between calls, which is about 10 times faster than not
doing so. But these operations are really quick, so this may not be necessary. | We currently reuse the parser, clearing the stack between calls, which is about 10 times faster than not
doing so. But these operations are really quick, so this may not be necessary. | def test_parser_timing():
"""We currently reuse the parser, clearing the stack between calls, which is about 10 times faster than not
doing so. But these operations are really quick, so this may not be necessary."""
assert (
timeit(
"parse_evaluation_parameter('x', {'x': 1})",
... | [
"def",
"test_parser_timing",
"(",
")",
":",
"assert",
"(",
"timeit",
"(",
"\"parse_evaluation_parameter('x', {'x': 1})\"",
",",
"setup",
"=",
"\"from great_expectations.core.evaluation_parameters import parse_evaluation_parameter\"",
",",
"number",
"=",
"100",
",",
")",
"<",
... | [
114,
0
] | [
124,
5
] | python | en | ['en', 'en', 'en'] | True |
cli | (ctx, v2_api, verbose, config_file_location, assume_yes) |
Welcome to the great_expectations CLI!
Most commands follow this format: great_expectations <NOUN> <VERB>
The nouns are: checkpoint, datasource, docs, init, project, store, suite, validation-operator.
Most nouns accept the following verbs: new, list, edit
|
Welcome to the great_expectations CLI! | def cli(ctx, v2_api, verbose, config_file_location, assume_yes):
"""
Welcome to the great_expectations CLI!
Most commands follow this format: great_expectations <NOUN> <VERB>
The nouns are: checkpoint, datasource, docs, init, project, store, suite, validation-operator.
Most nouns accept the follow... | [
"def",
"cli",
"(",
"ctx",
",",
"v2_api",
",",
"verbose",
",",
"config_file_location",
",",
"assume_yes",
")",
":",
"logger",
"=",
"_set_up_logger",
"(",
")",
"if",
"verbose",
":",
"# Note we are explicitly not using a logger in all CLI output to have",
"# more control o... | [
135,
0
] | [
156,
51
] | python | en | ['en', 'error', 'th'] | False |
CLI.is_v2_api | (ctx) | Determine if v2 api is requested by searching context params. | Determine if v2 api is requested by searching context params. | def is_v2_api(ctx):
"""Determine if v2 api is requested by searching context params."""
if ctx.params:
return ctx.params and "v2_api" in ctx.params.keys() and ctx.params["v2_api"]
root_ctx_params = ctx.find_root().params
return (
root_ctx_params
and "... | [
"def",
"is_v2_api",
"(",
"ctx",
")",
":",
"if",
"ctx",
".",
"params",
":",
"return",
"ctx",
".",
"params",
"and",
"\"v2_api\"",
"in",
"ctx",
".",
"params",
".",
"keys",
"(",
")",
"and",
"ctx",
".",
"params",
"[",
"\"v2_api\"",
"]",
"root_ctx_params",
... | [
90,
4
] | [
100,
9
] | python | en | ['en', 'en', 'en'] | True |
FontManager.get_char_size | (self) |
Get the character size.
|
Get the character size.
| def get_char_size(self):
"""
Get the character size.
"""
return self.fonts['NORMAL'].getsize('M') | [
"def",
"get_char_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"fonts",
"[",
"'NORMAL'",
"]",
".",
"getsize",
"(",
"'M'",
")"
] | [
155,
4
] | [
159,
48
] | python | en | ['en', 'error', 'th'] | False |
FontManager.get_font | (self, bold, oblique) |
Get the font based on bold and italic flags.
|
Get the font based on bold and italic flags.
| def get_font(self, bold, oblique):
"""
Get the font based on bold and italic flags.
"""
if bold and oblique:
return self.fonts['BOLDITALIC']
elif bold:
return self.fonts['BOLD']
elif oblique:
return self.fonts['ITALIC']
else:
... | [
"def",
"get_font",
"(",
"self",
",",
"bold",
",",
"oblique",
")",
":",
"if",
"bold",
"and",
"oblique",
":",
"return",
"self",
".",
"fonts",
"[",
"'BOLDITALIC'",
"]",
"elif",
"bold",
":",
"return",
"self",
".",
"fonts",
"[",
"'BOLD'",
"]",
"elif",
"ob... | [
161,
4
] | [
172,
39
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter.__init__ | (self, **options) |
See the class docstring for explanation of options.
|
See the class docstring for explanation of options.
| def __init__(self, **options):
"""
See the class docstring for explanation of options.
"""
if not pil_available:
raise PilNotAvailable(
'Python Imaging Library is required for this formatter')
Formatter.__init__(self, **options)
self.encoding =... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"options",
")",
":",
"if",
"not",
"pil_available",
":",
"raise",
"PilNotAvailable",
"(",
"'Python Imaging Library is required for this formatter'",
")",
"Formatter",
".",
"__init__",
"(",
"self",
",",
"*",
"*",
"opt... | [
292,
4
] | [
346,
27
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_line_height | (self) |
Get the height of a line.
|
Get the height of a line.
| def _get_line_height(self):
"""
Get the height of a line.
"""
return self.fonth + self.line_pad | [
"def",
"_get_line_height",
"(",
"self",
")",
":",
"return",
"self",
".",
"fonth",
"+",
"self",
".",
"line_pad"
] | [
352,
4
] | [
356,
41
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_line_y | (self, lineno) |
Get the Y coordinate of a line number.
|
Get the Y coordinate of a line number.
| def _get_line_y(self, lineno):
"""
Get the Y coordinate of a line number.
"""
return lineno * self._get_line_height() + self.image_pad | [
"def",
"_get_line_y",
"(",
"self",
",",
"lineno",
")",
":",
"return",
"lineno",
"*",
"self",
".",
"_get_line_height",
"(",
")",
"+",
"self",
".",
"image_pad"
] | [
358,
4
] | [
362,
64
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_char_width | (self) |
Get the width of a character.
|
Get the width of a character.
| def _get_char_width(self):
"""
Get the width of a character.
"""
return self.fontw | [
"def",
"_get_char_width",
"(",
"self",
")",
":",
"return",
"self",
".",
"fontw"
] | [
364,
4
] | [
368,
25
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_char_x | (self, charno) |
Get the X coordinate of a character position.
|
Get the X coordinate of a character position.
| def _get_char_x(self, charno):
"""
Get the X coordinate of a character position.
"""
return charno * self.fontw + self.image_pad + self.line_number_width | [
"def",
"_get_char_x",
"(",
"self",
",",
"charno",
")",
":",
"return",
"charno",
"*",
"self",
".",
"fontw",
"+",
"self",
".",
"image_pad",
"+",
"self",
".",
"line_number_width"
] | [
370,
4
] | [
374,
76
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_text_pos | (self, charno, lineno) |
Get the actual position for a character and line position.
|
Get the actual position for a character and line position.
| def _get_text_pos(self, charno, lineno):
"""
Get the actual position for a character and line position.
"""
return self._get_char_x(charno), self._get_line_y(lineno) | [
"def",
"_get_text_pos",
"(",
"self",
",",
"charno",
",",
"lineno",
")",
":",
"return",
"self",
".",
"_get_char_x",
"(",
"charno",
")",
",",
"self",
".",
"_get_line_y",
"(",
"lineno",
")"
] | [
376,
4
] | [
380,
65
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_linenumber_pos | (self, lineno) |
Get the actual position for the start of a line number.
|
Get the actual position for the start of a line number.
| def _get_linenumber_pos(self, lineno):
"""
Get the actual position for the start of a line number.
"""
return (self.image_pad, self._get_line_y(lineno)) | [
"def",
"_get_linenumber_pos",
"(",
"self",
",",
"lineno",
")",
":",
"return",
"(",
"self",
".",
"image_pad",
",",
"self",
".",
"_get_line_y",
"(",
"lineno",
")",
")"
] | [
382,
4
] | [
386,
57
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_text_color | (self, style) |
Get the correct color for the token from the style.
|
Get the correct color for the token from the style.
| def _get_text_color(self, style):
"""
Get the correct color for the token from the style.
"""
if style['color'] is not None:
fill = '#' + style['color']
else:
fill = '#000'
return fill | [
"def",
"_get_text_color",
"(",
"self",
",",
"style",
")",
":",
"if",
"style",
"[",
"'color'",
"]",
"is",
"not",
"None",
":",
"fill",
"=",
"'#'",
"+",
"style",
"[",
"'color'",
"]",
"else",
":",
"fill",
"=",
"'#000'",
"return",
"fill"
] | [
388,
4
] | [
396,
19
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_style_font | (self, style) |
Get the correct font for the style.
|
Get the correct font for the style.
| def _get_style_font(self, style):
"""
Get the correct font for the style.
"""
return self.fonts.get_font(style['bold'], style['italic']) | [
"def",
"_get_style_font",
"(",
"self",
",",
"style",
")",
":",
"return",
"self",
".",
"fonts",
".",
"get_font",
"(",
"style",
"[",
"'bold'",
"]",
",",
"style",
"[",
"'italic'",
"]",
")"
] | [
398,
4
] | [
402,
66
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._get_image_size | (self, maxcharno, maxlineno) |
Get the required image size.
|
Get the required image size.
| def _get_image_size(self, maxcharno, maxlineno):
"""
Get the required image size.
"""
return (self._get_char_x(maxcharno) + self.image_pad,
self._get_line_y(maxlineno + 0) + self.image_pad) | [
"def",
"_get_image_size",
"(",
"self",
",",
"maxcharno",
",",
"maxlineno",
")",
":",
"return",
"(",
"self",
".",
"_get_char_x",
"(",
"maxcharno",
")",
"+",
"self",
".",
"image_pad",
",",
"self",
".",
"_get_line_y",
"(",
"maxlineno",
"+",
"0",
")",
"+",
... | [
404,
4
] | [
409,
65
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._draw_linenumber | (self, posno, lineno) |
Remember a line number drawable to paint later.
|
Remember a line number drawable to paint later.
| def _draw_linenumber(self, posno, lineno):
"""
Remember a line number drawable to paint later.
"""
self._draw_text(
self._get_linenumber_pos(posno),
str(lineno).rjust(self.line_number_chars),
font=self.fonts.get_font(self.line_number_bold,
... | [
"def",
"_draw_linenumber",
"(",
"self",
",",
"posno",
",",
"lineno",
")",
":",
"self",
".",
"_draw_text",
"(",
"self",
".",
"_get_linenumber_pos",
"(",
"posno",
")",
",",
"str",
"(",
"lineno",
")",
".",
"rjust",
"(",
"self",
".",
"line_number_chars",
")"... | [
411,
4
] | [
421,
9
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._draw_text | (self, pos, text, font, **kw) |
Remember a single drawable tuple to paint later.
|
Remember a single drawable tuple to paint later.
| def _draw_text(self, pos, text, font, **kw):
"""
Remember a single drawable tuple to paint later.
"""
self.drawables.append((pos, text, font, kw)) | [
"def",
"_draw_text",
"(",
"self",
",",
"pos",
",",
"text",
",",
"font",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"drawables",
".",
"append",
"(",
"(",
"pos",
",",
"text",
",",
"font",
",",
"kw",
")",
")"
] | [
423,
4
] | [
427,
52
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._create_drawables | (self, tokensource) |
Create drawables for the token content.
|
Create drawables for the token content.
| def _create_drawables(self, tokensource):
"""
Create drawables for the token content.
"""
lineno = charno = maxcharno = 0
for ttype, value in tokensource:
while ttype not in self.styles:
ttype = ttype.parent
style = self.styles[ttype]
... | [
"def",
"_create_drawables",
"(",
"self",
",",
"tokensource",
")",
":",
"lineno",
"=",
"charno",
"=",
"maxcharno",
"=",
"0",
"for",
"ttype",
",",
"value",
"in",
"tokensource",
":",
"while",
"ttype",
"not",
"in",
"self",
".",
"styles",
":",
"ttype",
"=",
... | [
429,
4
] | [
460,
31
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._draw_line_numbers | (self) |
Create drawables for the line numbers.
|
Create drawables for the line numbers.
| def _draw_line_numbers(self):
"""
Create drawables for the line numbers.
"""
if not self.line_numbers:
return
for p in xrange(self.maxlineno):
n = p + self.line_number_start
if (n % self.line_number_step) == 0:
self._draw_linenu... | [
"def",
"_draw_line_numbers",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"line_numbers",
":",
"return",
"for",
"p",
"in",
"xrange",
"(",
"self",
".",
"maxlineno",
")",
":",
"n",
"=",
"p",
"+",
"self",
".",
"line_number_start",
"if",
"(",
"n",
"%... | [
462,
4
] | [
471,
43
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter._paint_line_number_bg | (self, im) |
Paint the line number background on the image.
|
Paint the line number background on the image.
| def _paint_line_number_bg(self, im):
"""
Paint the line number background on the image.
"""
if not self.line_numbers:
return
if self.line_number_fg is None:
return
draw = ImageDraw.Draw(im)
recth = im.size[-1]
rectw = self.image_pad... | [
"def",
"_paint_line_number_bg",
"(",
"self",
",",
"im",
")",
":",
"if",
"not",
"self",
".",
"line_numbers",
":",
"return",
"if",
"self",
".",
"line_number_fg",
"is",
"None",
":",
"return",
"draw",
"=",
"ImageDraw",
".",
"Draw",
"(",
"im",
")",
"recth",
... | [
473,
4
] | [
487,
16
] | python | en | ['en', 'error', 'th'] | False |
ImageFormatter.format | (self, tokensource, outfile) |
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.
This implementation calculates where it should draw each token on the
pixmap, then calculates the required pixmap size and draws the items.
|
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``.
This implementation calculates where it should draw each token on the
pixmap, then calculates the required pixmap size and draws ... | [
"def",
"format",
"(",
"self",
",",
"tokensource",
",",
"outfile",
")",
":",
"self",
".",
"_create_drawables",
"(",
"tokensource",
")",
"self",
".",
"_draw_line_numbers",
"(",
")",
"im",
"=",
"Image",
".",
"new",
"(",
"'RGB'",
",",
"self",
".",
"_get_imag... | [
489,
4
] | [
517,
51
] | python | en | ['en', 'error', 'th'] | False |
file_signature | (filename) |
Return a signature for a file.
|
Return a signature for a file. | def file_signature(filename):
"""
Return a signature for a file.
"""
if not os.path.isfile(filename):
return None
if not os.path.exists(filename):
return None
# Duplicate auto-generated files can be recognized with the sha1 hash.
sig = hashlib.sha1()
with open(filename... | [
"def",
"file_signature",
"(",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"None",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"return",
"None",
"# Duplicate aut... | [
16,
0
] | [
33,
26
] | python | en | ['en', 'error', 'th'] | False |
configuration_signature | (config) |
Return a signature for a configuration (xml_generator_configuration_t)
object.
This can then be used as a key in the cache.
This method must take into account anything about
a configuration that could cause the declarations generated
to be different between runs.
|
Return a signature for a configuration (xml_generator_configuration_t)
object. | def configuration_signature(config):
"""
Return a signature for a configuration (xml_generator_configuration_t)
object.
This can then be used as a key in the cache.
This method must take into account anything about
a configuration that could cause the declarations generated
to be different ... | [
"def",
"configuration_signature",
"(",
"config",
")",
":",
"sig",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"if",
"isinstance",
"(",
"config",
",",
"cxx_parsers_cfg",
".",
"xml_generator_configuration_t",
")",
":",
"sig",
".",
"update",
"(",
"str",
"(",
"config... | [
36,
0
] | [
60,
26
] | python | en | ['en', 'error', 'th'] | False |
cache_base_t.flush | (self) | Flush (write out) the cache to disk if needed. | Flush (write out) the cache to disk if needed. | def flush(self):
""" Flush (write out) the cache to disk if needed. """
raise NotImplementedError() | [
"def",
"flush",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
69,
4
] | [
72,
35
] | python | en | ['en', 'en', 'en'] | True |
cache_base_t.update | (self, source_file, configuration, declarations, included_files) |
update cache entry
:param source_file: path to the C++ source file being parsed
:param configuration: configuration used in
parsing :class:`xml_generator_configuration_t`
:param declarations: declaration tree found when parsing
:param included_files: files includ... |
update cache entry | def update(self, source_file, configuration, declarations, included_files):
"""
update cache entry
:param source_file: path to the C++ source file being parsed
:param configuration: configuration used in
parsing :class:`xml_generator_configuration_t`
:param declar... | [
"def",
"update",
"(",
"self",
",",
"source_file",
",",
"configuration",
",",
"declarations",
",",
"included_files",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
74,
4
] | [
85,
35
] | python | en | ['en', 'error', 'th'] | False |
cache_base_t.cached_value | (self, source_file, configuration) |
Return declarations, we have cached, for the source_file and the
given configuration.
:param source_file: path to the C++ source file being parsed.
:param configuration: configuration that was used for parsing.
|
Return declarations, we have cached, for the source_file and the
given configuration. | def cached_value(self, source_file, configuration):
"""
Return declarations, we have cached, for the source_file and the
given configuration.
:param source_file: path to the C++ source file being parsed.
:param configuration: configuration that was used for parsing.
"""... | [
"def",
"cached_value",
"(",
"self",
",",
"source_file",
",",
"configuration",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
87,
4
] | [
97,
35
] | python | en | ['en', 'error', 'th'] | False |
file_cache_t.__init__ | (self, name) |
:param name: name of the cache file.
|
:param name: name of the cache file.
| def __init__(self, name):
"""
:param name: name of the cache file.
"""
cache_base_t.__init__(self)
self.__name = name # Name of cache file
# Map record_key to record_t
self.__cache = self.__load(self.__name)
self.__needs_flushed = not bool(
s... | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"cache_base_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"__name",
"=",
"name",
"# Name of cache file",
"# Map record_key to record_t",
"self",
".",
"__cache",
"=",
"self",
".",
"__load",
"(",
"se... | [
163,
4
] | [
175,
33
] | python | en | ['en', 'error', 'th'] | False |
file_cache_t.__load | (file_name) | Load pickled cache from file and return the object. | Load pickled cache from file and return the object. | def __load(file_name):
""" Load pickled cache from file and return the object. """
if os.path.exists(file_name) and not os.path.isfile(file_name):
raise RuntimeError(
'Cache should be initialized with valid full file name')
if not os.path.exists(file_name):
... | [
"def",
"__load",
"(",
"file_name",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"file_name",
")",
"and",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"file_name",
")",
":",
"raise",
"RuntimeError",
"(",
"'Cache should be initialized with valid ful... | [
178,
4
] | [
211,
20
] | python | en | ['en', 'en', 'en'] | True |
file_cache_t.update | (self, source_file, configuration, declarations, included_files) | Update a cached record with the current key and value contents. | Update a cached record with the current key and value contents. | def update(self, source_file, configuration, declarations, included_files):
""" Update a cached record with the current key and value contents. """
record = record_t(
source_signature=file_signature(source_file),
config_signature=configuration_signature(configuration),
... | [
"def",
"update",
"(",
"self",
",",
"source_file",
",",
"configuration",
",",
"declarations",
",",
"included_files",
")",
":",
"record",
"=",
"record_t",
"(",
"source_signature",
"=",
"file_signature",
"(",
"source_file",
")",
",",
"config_signature",
"=",
"confi... | [
233,
4
] | [
249,
35
] | python | en | ['en', 'en', 'en'] | True |
file_cache_t.cached_value | (self, source_file, configuration) |
Attempt to lookup the cached declarations for the given file and
configuration.
Returns None if declaration not found or signature check fails.
|
Attempt to lookup the cached declarations for the given file and
configuration. | def cached_value(self, source_file, configuration):
"""
Attempt to lookup the cached declarations for the given file and
configuration.
Returns None if declaration not found or signature check fails.
"""
key = record_t.create_key(source_file, configuration)
if ... | [
"def",
"cached_value",
"(",
"self",
",",
"source_file",
",",
"configuration",
")",
":",
"key",
"=",
"record_t",
".",
"create_key",
"(",
"source_file",
",",
"configuration",
")",
"if",
"key",
"not",
"in",
"self",
".",
"__cache",
":",
"return",
"None",
"reco... | [
251,
4
] | [
269,
23
] | python | en | ['en', 'error', 'th'] | False |
eval_doc_qa_feedback | (filters: FilterRequest = None) |
Return basic accuracy metrics based on the user feedback.
Which ratio of answers was correct? Which ratio of documents was correct?
You can supply filters in the request to only use a certain subset of labels.
**Example:**
```
| curl --location --request POST 'http://127.0... |
Return basic accuracy metrics based on the user feedback.
Which ratio of answers was correct? Which ratio of documents was correct?
You can supply filters in the request to only use a certain subset of labels. | def eval_doc_qa_feedback(filters: FilterRequest = None):
"""
Return basic accuracy metrics based on the user feedback.
Which ratio of answers was correct? Which ratio of documents was correct?
You can supply filters in the request to only use a certain subset of labels.
**Example:**
``... | [
"def",
"eval_doc_qa_feedback",
"(",
"filters",
":",
"FilterRequest",
"=",
"None",
")",
":",
"if",
"filters",
":",
"filters",
"=",
"filters",
".",
"filters",
"filters",
"[",
"\"origin\"",
"]",
"=",
"[",
"\"user-feedback\"",
"]",
"else",
":",
"filters",
"=",
... | [
84,
0
] | [
123,
14
] | python | en | ['en', 'error', 'th'] | False |
export_doc_qa_feedback | (context_size: int = 2_000) |
SQuAD format JSON export for question/answer pairs that were marked as "relevant".
The context_size param can be used to limit response size for large documents.
|
SQuAD format JSON export for question/answer pairs that were marked as "relevant". | def export_doc_qa_feedback(context_size: int = 2_000):
"""
SQuAD format JSON export for question/answer pairs that were marked as "relevant".
The context_size param can be used to limit response size for large documents.
"""
labels = document_store.get_all_labels(
index=DB_INDEX_FEEDBACK, f... | [
"def",
"export_doc_qa_feedback",
"(",
"context_size",
":",
"int",
"=",
"2_000",
")",
":",
"labels",
"=",
"document_store",
".",
"get_all_labels",
"(",
"index",
"=",
"DB_INDEX_FEEDBACK",
",",
"filters",
"=",
"{",
"\"is_correct_answer\"",
":",
"[",
"True",
"]",
... | [
126,
0
] | [
162,
17
] | python | en | ['en', 'error', 'th'] | False |
export_faq_feedback | () |
Export feedback for faq-qa in JSON format.
|
Export feedback for faq-qa in JSON format.
| def export_faq_feedback():
"""
Export feedback for faq-qa in JSON format.
"""
labels = document_store.get_all_labels(index=DB_INDEX_FEEDBACK, filters={"origin": ["user-feedback-faq"]})
export_data = []
for label in labels:
document = document_store.get_document_by_id(label.document_id)... | [
"def",
"export_faq_feedback",
"(",
")",
":",
"labels",
"=",
"document_store",
".",
"get_all_labels",
"(",
"index",
"=",
"DB_INDEX_FEEDBACK",
",",
"filters",
"=",
"{",
"\"origin\"",
":",
"[",
"\"user-feedback-faq\"",
"]",
"}",
")",
"export_data",
"=",
"[",
"]",... | [
166,
0
] | [
186,
17
] | python | en | ['en', 'error', 'th'] | False |
initialized_sqlite_project | (
mock_webbrowser, caplog, monkeypatch, tmp_path_factory, titanic_sqlite_db_file, sa
) | This is an initialized project through the CLI. | This is an initialized project through the CLI. | def initialized_sqlite_project(
mock_webbrowser, caplog, monkeypatch, tmp_path_factory, titanic_sqlite_db_file, sa
):
"""This is an initialized project through the CLI."""
project_dir = str(tmp_path_factory.mktemp("my_rad_project"))
engine = sa.create_engine(
"sqlite:///{}".format(titanic_sqlit... | [
"def",
"initialized_sqlite_project",
"(",
"mock_webbrowser",
",",
"caplog",
",",
"monkeypatch",
",",
"tmp_path_factory",
",",
"titanic_sqlite_db_file",
",",
"sa",
")",
":",
"project_dir",
"=",
"str",
"(",
"tmp_path_factory",
".",
"mktemp",
"(",
"\"my_rad_project\"",
... | [
424,
0
] | [
477,
22
] | python | en | ['en', 'en', 'en'] | True |
SmokeTestCase.test_xxx | (self) | XXX identity | XXX identity | def test_xxx(self):
"""XXX identity"""
pass | [
"def",
"test_xxx",
"(",
"self",
")",
":",
"pass"
] | [
3,
4
] | [
5,
12
] | python | en | ['en', 'pl', 'en'] | False |
bobster_columnar_table_multi_batch_normal_mean_5000_stdev_1000_data_context | (
tmp_path_factory,
monkeypatch,
) |
This fixture generates three years' worth (36 months; i.e., 36 batches) of taxi trip data with the number of rows
of a batch sampled from a normal distribution with the mean of 5,000 rows and the standard deviation of 1,000 rows.
|
This fixture generates three years' worth (36 months; i.e., 36 batches) of taxi trip data with the number of rows
of a batch sampled from a normal distribution with the mean of 5,000 rows and the standard deviation of 1,000 rows.
| def bobster_columnar_table_multi_batch_normal_mean_5000_stdev_1000_data_context(
tmp_path_factory,
monkeypatch,
) -> DataContext:
"""
This fixture generates three years' worth (36 months; i.e., 36 batches) of taxi trip data with the number of rows
of a batch sampled from a normal distribution with t... | [
"def",
"bobster_columnar_table_multi_batch_normal_mean_5000_stdev_1000_data_context",
"(",
"tmp_path_factory",
",",
"monkeypatch",
",",
")",
"->",
"DataContext",
":",
"# Re-enable GE_USAGE_STATS",
"monkeypatch",
".",
"delenv",
"(",
"\"GE_USAGE_STATS\"",
")",
"project_path",
":"... | [
217,
0
] | [
290,
18
] | python | en | ['en', 'error', 'th'] | False |
multi_part_name_parameter_container | () |
$parameter.date_strings.yyyy_mm_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.yyyy_mm_dd_date_format
$parameter.date_strings.mm_yyyy_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.mm_yyyy_dd_date_format
$parameter.date_strings.tolerances.max_abs_error_time_milliseconds
$parameter.date_... |
$parameter.date_strings.yyyy_mm_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.yyyy_mm_dd_date_format
$parameter.date_strings.mm_yyyy_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.mm_yyyy_dd_date_format
$parameter.date_strings.tolerances.max_abs_error_time_milliseconds
$parameter.date_... | def multi_part_name_parameter_container():
"""
$parameter.date_strings.yyyy_mm_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.yyyy_mm_dd_date_format
$parameter.date_strings.mm_yyyy_dd_hh_mm_ss_tz_date_format
$parameter.date_strings.mm_yyyy_dd_date_format
$parameter.date_strings.tolerances.ma... | [
"def",
"multi_part_name_parameter_container",
"(",
")",
":",
"root_mean_node",
":",
"ParameterNode",
"=",
"ParameterNode",
"(",
"{",
"\"mean\"",
":",
"6.5e-1",
",",
"}",
")",
"financial_tolerances_parameter_node",
":",
"ParameterNode",
"=",
"ParameterNode",
"(",
"{",
... | [
396,
0
] | [
490,
5
] | python | en | ['en', 'error', 'th'] | False |
DebuggingRegexLexer.get_tokens_unprocessed | (self, text, stack=('root',)) |
Split ``text`` into (tokentype, text) pairs.
``stack`` is the inital stack (default: ``['root']``)
|
Split ``text`` into (tokentype, text) pairs. | def get_tokens_unprocessed(self, text, stack=('root',)):
"""
Split ``text`` into (tokentype, text) pairs.
``stack`` is the inital stack (default: ``['root']``)
"""
tokendefs = self._tokens
self.ctx = ctx = LexerContext(text, 0)
ctx.stack = list(stack)
sta... | [
"def",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
",",
"stack",
"=",
"(",
"'root'",
",",
")",
")",
":",
"tokendefs",
"=",
"self",
".",
"_tokens",
"self",
".",
"ctx",
"=",
"ctx",
"=",
"LexerContext",
"(",
"text",
",",
"0",
")",
"ctx",
".",
... | [
36,
4
] | [
98,
25
] | python | en | ['en', 'error', 'th'] | False |
open_signal_receiver | (*signals) | A context manager for catching signals.
Entering this context manager starts listening for the given signals and
returns an async iterator; exiting the context manager stops listening.
The async iterator blocks until a signal arrives, and then yields it.
Note that if you leave the ``with`` block whil... | A context manager for catching signals. | def open_signal_receiver(*signals):
"""A context manager for catching signals.
Entering this context manager starts listening for the given signals and
returns an async iterator; exiting the context manager stops listening.
The async iterator blocks until a signal arrives, and then yields it.
Not... | [
"def",
"open_signal_receiver",
"(",
"*",
"signals",
")",
":",
"if",
"not",
"signals",
":",
"raise",
"TypeError",
"(",
"\"No signals were provided\"",
")",
"if",
"not",
"is_main_thread",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Sorry, open_signal_receiver is o... | [
113,
0
] | [
166,
36
] | python | en | ['en', 'en', 'en'] | True |
test_BasicDatasetProfiler_null_column | () |
The profiler should determine that null columns are of null cardinality and of null type and
not to generate expectations specific to types and cardinality categories.
We verify this by running the basic profiler on a Pandas dataset with an empty column
and asserting the number of successful results f... |
The profiler should determine that null columns are of null cardinality and of null type and
not to generate expectations specific to types and cardinality categories. | def test_BasicDatasetProfiler_null_column():
"""
The profiler should determine that null columns are of null cardinality and of null type and
not to generate expectations specific to types and cardinality categories.
We verify this by running the basic profiler on a Pandas dataset with an empty column
... | [
"def",
"test_BasicDatasetProfiler_null_column",
"(",
")",
":",
"toy_dataset",
"=",
"PandasDataset",
"(",
"{",
"\"x\"",
":",
"[",
"1",
",",
"2",
",",
"3",
"]",
",",
"\"y\"",
":",
"[",
"None",
",",
"None",
",",
"None",
"]",
"}",
")",
"assert",
"(",
"le... | [
85,
0
] | [
127,
5
] | python | en | ['en', 'error', 'th'] | False |
test_BasicDatasetProfiler_partially_null_column | (dataset) |
Unit test to check the expectations that BasicDatasetProfiler creates for a partially null column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
"nulls" is the partially null column in the fixture dataset
|
Unit test to check the expectations that BasicDatasetProfiler creates for a partially null column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture. | def test_BasicDatasetProfiler_partially_null_column(dataset):
"""
Unit test to check the expectations that BasicDatasetProfiler creates for a partially null column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
"nulls" is the partially null column... | [
"def",
"test_BasicDatasetProfiler_partially_null_column",
"(",
"dataset",
")",
":",
"expectations_config",
",",
"evr_config",
"=",
"BasicDatasetProfiler",
".",
"profile",
"(",
"dataset",
")",
"assert",
"{",
"\"expect_column_to_exist\"",
",",
"\"expect_column_values_to_be_in_t... | [
130,
0
] | [
152,
5
] | python | en | ['en', 'error', 'th'] | False |
test_BasicDatasetProfiler_non_numeric_low_cardinality | (non_numeric_low_card_dataset) |
Unit test to check the expectations that BasicDatasetProfiler creates for a low cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
|
Unit test to check the expectations that BasicDatasetProfiler creates for a low cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
| def test_BasicDatasetProfiler_non_numeric_low_cardinality(non_numeric_low_card_dataset):
"""
Unit test to check the expectations that BasicDatasetProfiler creates for a low cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixtur... | [
"def",
"test_BasicDatasetProfiler_non_numeric_low_cardinality",
"(",
"non_numeric_low_card_dataset",
")",
":",
"expectations_config",
",",
"evr_config",
"=",
"BasicDatasetProfiler",
".",
"profile",
"(",
"non_numeric_low_card_dataset",
")",
"assert",
"{",
"\"expect_column_to_exist... | [
155,
0
] | [
179,
5
] | python | en | ['en', 'error', 'th'] | False |
test_BasicDatasetProfiler_non_numeric_high_cardinality | (
non_numeric_high_card_dataset,
) |
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
|
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
| def test_BasicDatasetProfiler_non_numeric_high_cardinality(
non_numeric_high_card_dataset,
):
"""
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
non numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
... | [
"def",
"test_BasicDatasetProfiler_non_numeric_high_cardinality",
"(",
"non_numeric_high_card_dataset",
",",
")",
":",
"expectations_config",
",",
"evr_config",
"=",
"BasicDatasetProfiler",
".",
"profile",
"(",
"non_numeric_high_card_dataset",
")",
"assert",
"{",
"\"expect_colum... | [
182,
0
] | [
207,
5
] | python | en | ['en', 'error', 'th'] | False |
test_BasicDatasetProfiler_numeric_high_cardinality | (numeric_high_card_dataset) |
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
|
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
| def test_BasicDatasetProfiler_numeric_high_cardinality(numeric_high_card_dataset):
"""
Unit test to check the expectations that BasicDatasetProfiler creates for a high cardinality
numeric column.
The test is executed against all the backends (Pandas, Spark, etc.), because it uses
the fixture.
""... | [
"def",
"test_BasicDatasetProfiler_numeric_high_cardinality",
"(",
"numeric_high_card_dataset",
")",
":",
"expectations_config",
",",
"evr_config",
"=",
"BasicDatasetProfiler",
".",
"profile",
"(",
"numeric_high_card_dataset",
")",
"assert",
"{",
"\"expect_column_to_exist\"",
",... | [
210,
0
] | [
233,
5
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler | (filesystem_csv_data_context) |
This just validates that it's possible to profile using the datasource hook,
and have validation results available in the DataContext
|
This just validates that it's possible to profile using the datasource hook,
and have validation results available in the DataContext
| def test_context_profiler(filesystem_csv_data_context):
"""
This just validates that it's possible to profile using the datasource hook,
and have validation results available in the DataContext
"""
context = filesystem_csv_data_context
assert isinstance(context.datasources["rad_datasource"], Pa... | [
"def",
"test_context_profiler",
"(",
"filesystem_csv_data_context",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"assert",
"isinstance",
"(",
"context",
".",
"datasources",
"[",
"\"rad_datasource\"",
"]",
",",
"PandasDatasource",
")",
"assert",
"context",
".... | [
276,
0
] | [
298,
55
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler_with_data_asset_name | (filesystem_csv_data_context) |
If a valid data asset name is passed to the profiling method
in the data_assets argument, the profiling method profiles only this data asset
|
If a valid data asset name is passed to the profiling method
in the data_assets argument, the profiling method profiles only this data asset
| def test_context_profiler_with_data_asset_name(filesystem_csv_data_context):
"""
If a valid data asset name is passed to the profiling method
in the data_assets argument, the profiling method profiles only this data asset
"""
context = filesystem_csv_data_context
assert isinstance(context.datas... | [
"def",
"test_context_profiler_with_data_asset_name",
"(",
"filesystem_csv_data_context",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"assert",
"isinstance",
"(",
"context",
".",
"datasources",
"[",
"\"rad_datasource\"",
"]",
",",
"PandasDatasource",
")",
"asser... | [
301,
0
] | [
319,
5
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler_with_nonexisting_data_asset_name | (filesystem_csv_data_context) |
If a non-existing data asset name is passed to the profiling method
in the data_assets argument, the profiling method must return an error
code in the result and the names of the unrecognized assets
|
If a non-existing data asset name is passed to the profiling method
in the data_assets argument, the profiling method must return an error
code in the result and the names of the unrecognized assets
| def test_context_profiler_with_nonexisting_data_asset_name(filesystem_csv_data_context):
"""
If a non-existing data asset name is passed to the profiling method
in the data_assets argument, the profiling method must return an error
code in the result and the names of the unrecognized assets
"""
... | [
"def",
"test_context_profiler_with_nonexisting_data_asset_name",
"(",
"filesystem_csv_data_context",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"assert",
"isinstance",
"(",
"context",
".",
"datasources",
"[",
"\"rad_datasource\"",
"]",
",",
"PandasDatasource",
"... | [
322,
0
] | [
345,
5
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler_with_non_existing_generator | (filesystem_csv_data_context) |
If a non-existing generator name is passed to the profiling method
in the generator_name argument, the profiling method must raise an exception.
|
If a non-existing generator name is passed to the profiling method
in the generator_name argument, the profiling method must raise an exception.
| def test_context_profiler_with_non_existing_generator(filesystem_csv_data_context):
"""
If a non-existing generator name is passed to the profiling method
in the generator_name argument, the profiling method must raise an exception.
"""
context = filesystem_csv_data_context
assert isinstanc... | [
"def",
"test_context_profiler_with_non_existing_generator",
"(",
"filesystem_csv_data_context",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"assert",
"isinstance",
"(",
"context",
".",
"datasources",
"[",
"\"rad_datasource\"",
"]",
",",
"PandasDatasource",
")",
... | [
348,
0
] | [
363,
9
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler_without_generator_name_arg_on_datasource_with_multiple_generators | (
filesystem_csv_data_context, filesystem_csv_2
) |
If a no generator_name is passed to the profiling method and the datasource has more than one
generators configured, the profiling method must return an error code in the result
|
If a no generator_name is passed to the profiling method and the datasource has more than one
generators configured, the profiling method must return an error code in the result
| def test_context_profiler_without_generator_name_arg_on_datasource_with_multiple_generators(
filesystem_csv_data_context, filesystem_csv_2
):
"""
If a no generator_name is passed to the profiling method and the datasource has more than one
generators configured, the profiling method must return an error... | [
"def",
"test_context_profiler_without_generator_name_arg_on_datasource_with_multiple_generators",
"(",
"filesystem_csv_data_context",
",",
"filesystem_csv_2",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"context",
".",
"add_batch_kwargs_generator",
"(",
"\"rad_datasource\"... | [
366,
0
] | [
390,
71
] | python | en | ['en', 'error', 'th'] | False |
test_context_profiler_without_generator_name_arg_on_datasource_with_no_generators | (
filesystem_csv_data_context,
) |
If a no generator_name is passed to the profiling method and the datasource has no
generators configured, the profiling method must return an error code in the result
|
If a no generator_name is passed to the profiling method and the datasource has no
generators configured, the profiling method must return an error code in the result
| def test_context_profiler_without_generator_name_arg_on_datasource_with_no_generators(
filesystem_csv_data_context,
):
"""
If a no generator_name is passed to the profiling method and the datasource has no
generators configured, the profiling method must return an error code in the result
"""
co... | [
"def",
"test_context_profiler_without_generator_name_arg_on_datasource_with_no_generators",
"(",
"filesystem_csv_data_context",
",",
")",
":",
"context",
"=",
"filesystem_csv_data_context",
"context",
".",
"add_datasource",
"(",
"\"datasource_without_generators\"",
",",
"module_name"... | [
393,
0
] | [
413,
71
] | python | en | ['en', 'error', 'th'] | False |
one_sided | (alpha, p, treatment) | One sided confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
Args:
alpha (np.array): a confounding values vector
... | One sided confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf | def one_sided(alpha, p, treatment):
"""One sided confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
Args:
alpha (np.a... | [
"def",
"one_sided",
"(",
"alpha",
",",
"p",
",",
"treatment",
")",
":",
"assert",
"p",
".",
"shape",
"[",
"0",
"]",
"==",
"treatment",
".",
"shape",
"[",
"0",
"]",
"adj",
"=",
"alpha",
"*",
"(",
"1",
"-",
"p",
")",
"*",
"treatment",
"-",
"alpha... | [
10,
0
] | [
23,
14
] | python | en | ['en', 'en', 'en'] | True |
alignment | (alpha, p, treatment) | Alignment confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
Args:
alpha (np.array): a confounding values vector
... | Alignment confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf | def alignment(alpha, p, treatment):
"""Alignment confounding function.
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
Args:
alpha (np.a... | [
"def",
"alignment",
"(",
"alpha",
",",
"p",
",",
"treatment",
")",
":",
"assert",
"p",
".",
"shape",
"[",
"0",
"]",
"==",
"treatment",
".",
"shape",
"[",
"0",
"]",
"adj",
"=",
"alpha",
"*",
"(",
"1",
"-",
"p",
")",
"*",
"treatment",
"+",
"alpha... | [
26,
0
] | [
40,
14
] | python | en | ['en', 'en', 'en'] | True |
one_sided_att | (alpha, p, treatment) | One sided confounding function for the average effect of the treatment among the treated units (ATT)
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
... | One sided confounding function for the average effect of the treatment among the treated units (ATT) | def one_sided_att(alpha, p, treatment):
"""One sided confounding function for the average effect of the treatment among the treated units (ATT)
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.ma... | [
"def",
"one_sided_att",
"(",
"alpha",
",",
"p",
",",
"treatment",
")",
":",
"assert",
"p",
".",
"shape",
"[",
"0",
"]",
"==",
"treatment",
".",
"shape",
"[",
"0",
"]",
"adj",
"=",
"alpha",
"*",
"(",
"1",
"-",
"treatment",
")",
"return",
"adj"
] | [
43,
0
] | [
57,
14
] | python | en | ['en', 'en', 'en'] | True |
alignment_att | (alpha, p, treatment) | Alignment confounding function for the average effect of the treatment among the treated units (ATT)
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.mattblackwell.org/files/papers/causalsens.pdf
... | Alignment confounding function for the average effect of the treatment among the treated units (ATT) | def alignment_att(alpha, p, treatment):
"""Alignment confounding function for the average effect of the treatment among the treated units (ATT)
Reference: Blackwell, Matthew. "A selection bias approach to sensitivity analysis
for causal effects." Political Analysis 22.2 (2014): 169-182.
https://www.ma... | [
"def",
"alignment_att",
"(",
"alpha",
",",
"p",
",",
"treatment",
")",
":",
"assert",
"p",
".",
"shape",
"[",
"0",
"]",
"==",
"treatment",
".",
"shape",
"[",
"0",
"]",
"adj",
"=",
"alpha",
"*",
"(",
"1",
"-",
"treatment",
")",
"return",
"adj"
] | [
60,
0
] | [
74,
14
] | python | en | ['en', 'en', 'en'] | True |
Sensitivity.__init__ | (self, df, inference_features, p_col, treatment_col, outcome_col,
learner, *args, **kwargs) | Initialize.
Args:
df (pd.DataFrame): input data frame
inferenece_features (list of str): a list of columns that used in learner for inference
p_col (str): column name of propensity score
treatment_col (str): column name of whether in treatment of control
... | Initialize. | def __init__(self, df, inference_features, p_col, treatment_col, outcome_col,
learner, *args, **kwargs):
"""Initialize.
Args:
df (pd.DataFrame): input data frame
inferenece_features (list of str): a list of columns that used in learner for inference
p... | [
"def",
"__init__",
"(",
"self",
",",
"df",
",",
"inference_features",
",",
"p_col",
",",
"treatment_col",
",",
"outcome_col",
",",
"learner",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"df",
"=",
"df",
"self",
".",
"inference_fea... | [
84,
4
] | [
102,
30
] | python | en | ['en', 'en', 'it'] | False |
Sensitivity.get_prediction | (self, X, p, treatment, y) | Return the treatment effects prediction.
Args:
X (np.matrix): a feature matrix
p (np.array): a propensity score vector between 0 and 1
treatment (np.array): a treatment vector (1 if treated, otherwise 0)
y (np.array): an outcome vector
Returns:
... | Return the treatment effects prediction. | def get_prediction(self, X, p, treatment, y):
"""Return the treatment effects prediction.
Args:
X (np.matrix): a feature matrix
p (np.array): a propensity score vector between 0 and 1
treatment (np.array): a treatment vector (1 if treated, otherwise 0)
y ... | [
"def",
"get_prediction",
"(",
"self",
",",
"X",
",",
"p",
",",
"treatment",
",",
"y",
")",
":",
"learner",
"=",
"self",
".",
"learner",
"try",
":",
"preds",
"=",
"learner",
".",
"fit_predict",
"(",
"X",
"=",
"X",
",",
"p",
"=",
"p",
",",
"treatme... | [
104,
4
] | [
121,
20
] | python | en | ['en', 'en', 'en'] | True |
Sensitivity.get_ate_ci | (self, X, p, treatment, y) | Return the confidence intervals for treatment effects prediction.
Args:
X (np.matrix): a feature matrix
p (np.array): a propensity score vector between 0 and 1
treatment (np.array): a treatment vector (1 if treated, otherwise 0)
y (np.array): an outcome vector
... | Return the confidence intervals for treatment effects prediction. | def get_ate_ci(self, X, p, treatment, y):
"""Return the confidence intervals for treatment effects prediction.
Args:
X (np.matrix): a feature matrix
p (np.array): a propensity score vector between 0 and 1
treatment (np.array): a treatment vector (1 if treated, otherw... | [
"def",
"get_ate_ci",
"(",
"self",
",",
"X",
",",
"p",
",",
"treatment",
",",
"y",
")",
":",
"learner",
"=",
"self",
".",
"learner",
"from",
".",
".",
"inference",
".",
"meta",
".",
"tlearner",
"import",
"BaseTLearner",
"if",
"isinstance",
"(",
"learner... | [
123,
4
] | [
144,
49
] | python | en | ['en', 'en', 'en'] | True |
Sensitivity.get_class_object | (method_name, *args, **kwargs) | Return class object based on input method
Args:
method_name (list of str): a list of sensitivity analysis method
Returns:
(class): Sensitivy Class
| Return class object based on input method
Args:
method_name (list of str): a list of sensitivity analysis method
Returns:
(class): Sensitivy Class
| def get_class_object(method_name, *args, **kwargs):
"""Return class object based on input method
Args:
method_name (list of str): a list of sensitivity analysis method
Returns:
(class): Sensitivy Class
"""
method_list = ['Placebo Treatment', 'Random Cause... | [
"def",
"get_class_object",
"(",
"method_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"method_list",
"=",
"[",
"'Placebo Treatment'",
",",
"'Random Cause'",
",",
"'Subset Data'",
",",
"'Random Replace'",
",",
"'Selection Bias'",
"]",
"class_name",
... | [
147,
4
] | [
163,
70
] | python | en | ['en', 'en', 'en'] | True |
Sensitivity.sensitivity_analysis | (self, methods, sample_size=None,
confound='one_sided', alpha_range=None) | Return the sensitivity data by different method
Args:
method (list of str): a list of sensitivity analysis method
sample_size (float, optional): ratio for subset the original data
confound (string, optional): the name of confouding function
alpha_range (np.array,... | Return the sensitivity data by different method | def sensitivity_analysis(self, methods, sample_size=None,
confound='one_sided', alpha_range=None):
"""Return the sensitivity data by different method
Args:
method (list of str): a list of sensitivity analysis method
sample_size (float, optional): rat... | [
"def",
"sensitivity_analysis",
"(",
"self",
",",
"methods",
",",
"sample_size",
"=",
"None",
",",
"confound",
"=",
"'one_sided'",
",",
"alpha_range",
"=",
"None",
")",
":",
"if",
"alpha_range",
"is",
"None",
":",
"y",
"=",
"self",
".",
"df",
"[",
"self",... | [
165,
4
] | [
204,
25
] | python | en | ['en', 'en', 'en'] | True |
Sensitivity.summary | (self, method) | Summary report
Args:
method_name (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
| Summary report
Args:
method_name (str): sensitivity analysis method | def summary(self, method):
"""Summary report
Args:
method_name (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
"""
method_name = method
X = self.df[self.inference_features].values
p = self.df[self.p_col].va... | [
"def",
"summary",
"(",
"self",
",",
"method",
")",
":",
"method_name",
"=",
"method",
"X",
"=",
"self",
".",
"df",
"[",
"self",
".",
"inference_features",
"]",
".",
"values",
"p",
"=",
"self",
".",
"df",
"[",
"self",
".",
"p_col",
"]",
".",
"values... | [
206,
4
] | [
228,
34
] | python | en | ['en', 'ky', 'en'] | False |
SensitivityPlaceboTreatment.sensitivity_estimate | (self) | Summary report
Args:
return_ci (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
| Summary report
Args:
return_ci (str): sensitivity analysis method | def sensitivity_estimate(self):
"""Summary report
Args:
return_ci (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
"""
num_rows = self.df.shape[0]
X = self.df[self.inference_features].values
p = self.df[self.... | [
"def",
"sensitivity_estimate",
"(",
"self",
")",
":",
"num_rows",
"=",
"self",
".",
"df",
".",
"shape",
"[",
"0",
"]",
"X",
"=",
"self",
".",
"df",
"[",
"self",
".",
"inference_features",
"]",
".",
"values",
"p",
"=",
"self",
".",
"df",
"[",
"self"... | [
241,
4
] | [
257,
52
] | python | en | ['en', 'ky', 'en'] | False |
SensitivityRandomReplace.sensitivity_estimate | (self) | Replaces a random covariate with an irrelevant variable.
| Replaces a random covariate with an irrelevant variable.
| def sensitivity_estimate(self):
"""Replaces a random covariate with an irrelevant variable.
"""
logger.info('Replace feature {} with an random irrelevant variable'.format(self.replaced_feature))
df_new = self.df.copy()
num_rows = self.df.shape[0]
df_new[self.replaced_fea... | [
"def",
"sensitivity_estimate",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Replace feature {} with an random irrelevant variable'",
".",
"format",
"(",
"self",
".",
"replaced_feature",
")",
")",
"df_new",
"=",
"self",
".",
"df",
".",
"copy",
"(",
")",
... | [
293,
4
] | [
308,
52
] | python | en | ['en', 'en', 'en'] | True |
SensitivitySelectionBias.__init__ | (self, *args, confound='one_sided', alpha_range=None,
sensitivity_features=None, **kwargs) | Initialize.
Args:
confound (string): the name of confouding function
alpha_range (np.array): a parameter to pass the confounding function
sensitivity_features (list of str): ): a list of columns that to check each individual partial r-square
| Initialize. | def __init__(self, *args, confound='one_sided', alpha_range=None,
sensitivity_features=None, **kwargs):
super().__init__(*args, **kwargs)
"""Initialize.
Args:
confound (string): the name of confouding function
alpha_range (np.array): a parameter to pass ... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"confound",
"=",
"'one_sided'",
",",
"alpha_range",
"=",
"None",
",",
"sensitivity_features",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
... | [
344,
4
] | [
383,
31
] | python | en | ['en', 'en', 'it'] | False |
SensitivitySelectionBias.summary | (self, method='Selection Bias') | Summary report for Selection Bias Method
Args:
method_name (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
| Summary report for Selection Bias Method
Args:
method_name (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
| def summary(self, method='Selection Bias'):
"""Summary report for Selection Bias Method
Args:
method_name (str): sensitivity analysis method
Returns:
(pd.DataFrame): a summary dataframe
"""
method_name = method
sensitivity_summary = self.causalsen... | [
"def",
"summary",
"(",
"self",
",",
"method",
"=",
"'Selection Bias'",
")",
":",
"method_name",
"=",
"method",
"sensitivity_summary",
"=",
"self",
".",
"causalsens",
"(",
")",
"[",
"0",
"]",
"sensitivity_summary",
"[",
"'Method'",
"]",
"=",
"[",
"method_name... | [
426,
4
] | [
440,
92
] | python | en | ['en', 'en', 'en'] | True |
SensitivitySelectionBias.plot | (sens_df, partial_rsqs_df=None, type='raw', ci=False, partial_rsqs=False) | Plot the results of a sensitivity analysis against unmeasured
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
partial_rsqs_d (pandas.DataFrame) : a data frame output from causalsens including partial rsqure
type (str, optional): the type of plot to draw,... | Plot the results of a sensitivity analysis against unmeasured
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
partial_rsqs_d (pandas.DataFrame) : a data frame output from causalsens including partial rsqure
type (str, optional): the type of plot to draw,... | def plot(sens_df, partial_rsqs_df=None, type='raw', ci=False, partial_rsqs=False):
"""Plot the results of a sensitivity analysis against unmeasured
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
partial_rsqs_d (pandas.DataFrame) : a data frame output from c... | [
"def",
"plot",
"(",
"sens_df",
",",
"partial_rsqs_df",
"=",
"None",
",",
"type",
"=",
"'raw'",
",",
"ci",
"=",
"False",
",",
"partial_rsqs",
"=",
"False",
")",
":",
"if",
"type",
"==",
"'raw'",
"and",
"not",
"ci",
":",
"fig",
",",
"ax",
"=",
"plt",... | [
443,
4
] | [
492,
62
] | python | en | ['en', 'en', 'en'] | True |
SensitivitySelectionBias.partial_rsqs_confounding | (sens_df, feature_name, partial_rsqs_value, range=0.01) | Check partial rsqs values of feature corresponding confounding amonunt of ATE
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
feature_name (str): feature name to check
partial_rsqs_value (float) : partial rsquare value of feature
range (float... | Check partial rsqs values of feature corresponding confounding amonunt of ATE
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
feature_name (str): feature name to check
partial_rsqs_value (float) : partial rsquare value of feature
range (float... | def partial_rsqs_confounding(sens_df, feature_name, partial_rsqs_value, range=0.01):
"""Check partial rsqs values of feature corresponding confounding amonunt of ATE
Args:
sens_df (pandas.DataFrame): a data frame output from causalsens
feature_name (str): feature name to check
... | [
"def",
"partial_rsqs_confounding",
"(",
"sens_df",
",",
"feature_name",
",",
"partial_rsqs_value",
",",
"range",
"=",
"0.01",
")",
":",
"rsqs_dict",
"=",
"[",
"]",
"for",
"i",
"in",
"sens_df",
".",
"rsqs",
":",
"if",
"partial_rsqs_value",
"-",
"partial_rsqs_va... | [
495,
4
] | [
519,
170
] | python | en | ['en', 'en', 'en'] | True |
SourceTreeAndPathFromPath | (input_path) | Given input_path, returns a tuple with sourceTree and path values.
Examples:
input_path (source_tree, output_path)
'$(VAR)/path' ('VAR', 'path')
'$(VAR)' ('VAR', None)
'path' (None, 'path')
| Given input_path, returns a tuple with sourceTree and path values. | def SourceTreeAndPathFromPath(input_path):
"""Given input_path, returns a tuple with sourceTree and path values.
Examples:
input_path (source_tree, output_path)
'$(VAR)/path' ('VAR', 'path')
'$(VAR)' ('VAR', None)
'path' (None, 'path')
"""
source_group_match = _path_leading_... | [
"def",
"SourceTreeAndPathFromPath",
"(",
"input_path",
")",
":",
"source_group_match",
"=",
"_path_leading_variable",
".",
"match",
"(",
"input_path",
")",
"if",
"source_group_match",
":",
"source_tree",
"=",
"source_group_match",
".",
"group",
"(",
"1",
")",
"outpu... | [
177,
0
] | [
195,
35
] | 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.