hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _get_config_from_prompts | Dict | def _get_config_from_prompts(should_prompt_for_example: bool = True) -> Dict:
"""Ask user to provide necessary inputs.
Args:
should_prompt_for_example: Whether to include a prompt for example.
Returns:
Resulting config dictionary.
"""
# set output directory to the current directo... | Ask user to provide necessary inputs.
Args:
should_prompt_for_example: Whether to include a prompt for example.
Returns:
Resulting config dictionary.
| Ask user to provide necessary inputs. | [
"Ask",
"user",
"to",
"provide",
"necessary",
"inputs",
"."
] | def _get_config_from_prompts(should_prompt_for_example: bool = True) -> Dict:
output_dir = os.path.abspath(os.path.curdir)
project_name_prompt = _get_prompt_text(
"Project Name:",
"Please enter a human readable name for your new project.",
"Spaces and punctuation are allowed.",
s... | [
"def",
"_get_config_from_prompts",
"(",
"should_prompt_for_example",
":",
"bool",
"=",
"True",
")",
"->",
"Dict",
":",
"output_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"curdir",
")",
"project_name_prompt",
"=",
"_get_prompt_te... | Ask user to provide necessary inputs. | [
"Ask",
"user",
"to",
"provide",
"necessary",
"inputs",
"."
] | [
"\"\"\"Ask user to provide necessary inputs.\n\n Args:\n should_prompt_for_example: Whether to include a prompt for example.\n\n Returns:\n Resulting config dictionary.\n\n \"\"\"",
"# set output directory to the current directory",
"# get project name",
"# get repo name",
"# get pyth... | [
{
"param": "should_prompt_for_example",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "Resulting config dictionary.",
"docstring_tokens": [
"Resulting",
"config",
"dictionary",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "should_prompt_for_example",
"type": "bool",... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _parse_config | Dict | def _parse_config(config_path: str, verbose: bool) -> Dict:
"""Parse the config YAML from its path.
Args:
config_path: The path of the config.yml file.
verbose: Print the config contents.
Raises:
Exception: If the file cannot be parsed.
Returns:
The config as a diction... | Parse the config YAML from its path.
Args:
config_path: The path of the config.yml file.
verbose: Print the config contents.
Raises:
Exception: If the file cannot be parsed.
Returns:
The config as a dictionary.
| Parse the config YAML from its path. | [
"Parse",
"the",
"config",
"YAML",
"from",
"its",
"path",
"."
] | def _parse_config(config_path: str, verbose: bool) -> Dict:
try:
with open(config_path, "r") as config_file:
config = yaml.safe_load(config_file)
if verbose:
click.echo(config_path + ":")
click.echo(yaml.dump(config, default_flow_style=False))
return confi... | [
"def",
"_parse_config",
"(",
"config_path",
":",
"str",
",",
"verbose",
":",
"bool",
")",
"->",
"Dict",
":",
"try",
":",
"with",
"open",
"(",
"config_path",
",",
"\"r\"",
")",
"as",
"config_file",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"con... | Parse the config YAML from its path. | [
"Parse",
"the",
"config",
"YAML",
"from",
"its",
"path",
"."
] | [
"\"\"\"Parse the config YAML from its path.\n\n Args:\n config_path: The path of the config.yml file.\n verbose: Print the config contents.\n\n Raises:\n Exception: If the file cannot be parsed.\n\n Returns:\n The config as a dictionary.\n\n \"\"\""
] | [
{
"param": "config_path",
"type": "str"
},
{
"param": "verbose",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "The config as a dictionary.",
"docstring_tokens": [
"The",
"config",
"as",
"a",
"dictionary",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "If the file cannot be parsed.",
"docstri... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _check_config_ok | Dict[str, Any] | def _check_config_ok(config_path: str, config: Dict[str, Any]) -> Dict[str, Any]:
"""Check that the configuration file contains all needed variables.
Args:
config_path: The path of the config file.
config: The config as a dictionary.
Returns:
Config dictionary.
Raises:
... | Check that the configuration file contains all needed variables.
Args:
config_path: The path of the config file.
config: The config as a dictionary.
Returns:
Config dictionary.
Raises:
KedroCliError: If the config file is empty or does not contain all
keys from... | Check that the configuration file contains all needed variables. | [
"Check",
"that",
"the",
"configuration",
"file",
"contains",
"all",
"needed",
"variables",
"."
] | def _check_config_ok(config_path: str, config: Dict[str, Any]) -> Dict[str, Any]:
if config is None:
_show_example_config()
raise KedroCliError(config_path + " is empty")
missing_keys = _get_default_config().keys() - config.keys()
if missing_keys:
click.echo(f"\n{config_path}:")
... | [
"def",
"_check_config_ok",
"(",
"config_path",
":",
"str",
",",
"config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"config",
"is",
"None",
":",
"_show_example_config",
"(",
")",
"raise",
"Ke... | Check that the configuration file contains all needed variables. | [
"Check",
"that",
"the",
"configuration",
"file",
"contains",
"all",
"needed",
"variables",
"."
] | [
"\"\"\"Check that the configuration file contains all needed variables.\n\n Args:\n config_path: The path of the config file.\n config: The config as a dictionary.\n\n Returns:\n Config dictionary.\n\n Raises:\n KedroCliError: If the config file is empty or does not contain all\... | [
{
"param": "config_path",
"type": "str"
},
{
"param": "config",
"type": "Dict[str, Any]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [
{
"docstring": "If the config file is empty or does not contain all\nkeys from template/cookiecutter.json and output_dir.",
"docstring_tokens": [
"If",
... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _assert_output_dir_ok | null | def _assert_output_dir_ok(output_dir: str):
"""Check that output directory exists.
Args:
output_dir: Output directory path.
Raises:
KedroCliError: If the output directory does not exist.
"""
if not os.path.exists(output_dir):
message = (
"`{}` is not a valid ou... | Check that output directory exists.
Args:
output_dir: Output directory path.
Raises:
KedroCliError: If the output directory does not exist.
| Check that output directory exists. | [
"Check",
"that",
"output",
"directory",
"exists",
"."
] | def _assert_output_dir_ok(output_dir: str):
if not os.path.exists(output_dir):
message = (
"`{}` is not a valid output directory. "
"It must be a relative or absolute path "
"to an existing directory.".format(output_dir)
)
raise KedroCliError(message) | [
"def",
"_assert_output_dir_ok",
"(",
"output_dir",
":",
"str",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"output_dir",
")",
":",
"message",
"=",
"(",
"\"`{}` is not a valid output directory. \"",
"\"It must be a relative or absolute path \"",
"\"to... | Check that output directory exists. | [
"Check",
"that",
"output",
"directory",
"exists",
"."
] | [
"\"\"\"Check that output directory exists.\n\n Args:\n output_dir: Output directory path.\n\n Raises:\n KedroCliError: If the output directory does not exist.\n\n \"\"\""
] | [
{
"param": "output_dir",
"type": "str"
}
] | {
"returns": [],
"raises": [
{
"docstring": "If the output directory does not exist.",
"docstring_tokens": [
"If",
"the",
"output",
"directory",
"does",
"not",
"exist",
"."
],
"type": "KedroCliError"
}
],
"params": [... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _assert_pkg_name_ok | null | def _assert_pkg_name_ok(pkg_name: str):
"""Check that python package name is in line with PEP8 requirements.
Args:
pkg_name: Candidate Python package name.
Raises:
KedroCliError: If package name violates the requirements.
"""
base_message = "`{}` is not a valid Python package name... | Check that python package name is in line with PEP8 requirements.
Args:
pkg_name: Candidate Python package name.
Raises:
KedroCliError: If package name violates the requirements.
| Check that python package name is in line with PEP8 requirements. | [
"Check",
"that",
"python",
"package",
"name",
"is",
"in",
"line",
"with",
"PEP8",
"requirements",
"."
] | def _assert_pkg_name_ok(pkg_name: str):
base_message = "`{}` is not a valid Python package name.".format(pkg_name)
if not re.match(r"^[a-zA-Z_]", pkg_name):
message = base_message + " It must start with a letter or underscore."
raise KedroCliError(message)
if len(pkg_name) < 2:
messa... | [
"def",
"_assert_pkg_name_ok",
"(",
"pkg_name",
":",
"str",
")",
":",
"base_message",
"=",
"\"`{}` is not a valid Python package name.\"",
".",
"format",
"(",
"pkg_name",
")",
"if",
"not",
"re",
".",
"match",
"(",
"r\"^[a-zA-Z_]\"",
",",
"pkg_name",
")",
":",
"me... | Check that python package name is in line with PEP8 requirements. | [
"Check",
"that",
"python",
"package",
"name",
"is",
"in",
"line",
"with",
"PEP8",
"requirements",
"."
] | [
"\"\"\"Check that python package name is in line with PEP8 requirements.\n\n Args:\n pkg_name: Candidate Python package name.\n\n Raises:\n KedroCliError: If package name violates the requirements.\n \"\"\""
] | [
{
"param": "pkg_name",
"type": "str"
}
] | {
"returns": [],
"raises": [
{
"docstring": "If package name violates the requirements.",
"docstring_tokens": [
"If",
"package",
"name",
"violates",
"the",
"requirements",
"."
],
"type": "KedroCliError"
}
],
"params": [
... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | load_entry_points | List[str] | def load_entry_points(name: str) -> List[str]:
"""Load package entry point commands.
Args:
name: The key value specified in ENTRY_POINT_GROUPS.
Raises:
Exception: If loading an entry point failed.
Returns:
List of entry point commands.
"""
entry_points = pkg_resources... | Load package entry point commands.
Args:
name: The key value specified in ENTRY_POINT_GROUPS.
Raises:
Exception: If loading an entry point failed.
Returns:
List of entry point commands.
| Load package entry point commands. | [
"Load",
"package",
"entry",
"point",
"commands",
"."
] | def load_entry_points(name: str) -> List[str]:
entry_points = pkg_resources.iter_entry_points(group=ENTRY_POINT_GROUPS[name])
entry_point_commands = []
for entry_point in entry_points:
try:
entry_point_commands.append(entry_point.load())
except Exception:
_handle_ex... | [
"def",
"load_entry_points",
"(",
"name",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"entry_points",
"=",
"pkg_resources",
".",
"iter_entry_points",
"(",
"group",
"=",
"ENTRY_POINT_GROUPS",
"[",
"name",
"]",
")",
"entry_point_commands",
"=",
"[",
"]... | Load package entry point commands. | [
"Load",
"package",
"entry",
"point",
"commands",
"."
] | [
"\"\"\"Load package entry point commands.\n\n Args:\n name: The key value specified in ENTRY_POINT_GROUPS.\n\n Raises:\n Exception: If loading an entry point failed.\n\n Returns:\n List of entry point commands.\n\n \"\"\"",
"# pylint: disable=broad-except"
] | [
{
"param": "name",
"type": "str"
}
] | {
"returns": [
{
"docstring": "List of entry point commands.",
"docstring_tokens": [
"List",
"of",
"entry",
"point",
"commands",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "If loading an entry point failed.",
... |
6b2754e83429e16a4b2470a845fd85d8d82d7954 | eferm/kedro | kedro/framework/cli/cli.py | [
"Apache-2.0"
] | Python | _handle_exception | null | def _handle_exception(msg, end=True):
"""Pretty print the current exception then exit."""
if _VERBOSE:
click.secho(traceback.format_exc(), nl=False, fg="yellow")
else:
etype, value, _ = sys.exc_info()
click.secho(
"".join(traceback.format_exception_only(etype, value))
... | Pretty print the current exception then exit. | Pretty print the current exception then exit. | [
"Pretty",
"print",
"the",
"current",
"exception",
"then",
"exit",
"."
] | def _handle_exception(msg, end=True):
if _VERBOSE:
click.secho(traceback.format_exc(), nl=False, fg="yellow")
else:
etype, value, _ = sys.exc_info()
click.secho(
"".join(traceback.format_exception_only(etype, value))
+ "Run with --verbose to see the full exception... | [
"def",
"_handle_exception",
"(",
"msg",
",",
"end",
"=",
"True",
")",
":",
"if",
"_VERBOSE",
":",
"click",
".",
"secho",
"(",
"traceback",
".",
"format_exc",
"(",
")",
",",
"nl",
"=",
"False",
",",
"fg",
"=",
"\"yellow\"",
")",
"else",
":",
"etype",
... | Pretty print the current exception then exit. | [
"Pretty",
"print",
"the",
"current",
"exception",
"then",
"exit",
"."
] | [
"\"\"\"Pretty print the current exception then exit.\"\"\""
] | [
{
"param": "msg",
"type": null
},
{
"param": "end",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "msg",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "end",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | create_config_file_no_example | null | def create_config_file_no_example(context):
"""Behave step to create a temporary config file
(given the existing temp directory) and store it in the context.
"""
_create_config_file(context, include_example=False) | Behave step to create a temporary config file
(given the existing temp directory) and store it in the context.
| Behave step to create a temporary config file
(given the existing temp directory) and store it in the context. | [
"Behave",
"step",
"to",
"create",
"a",
"temporary",
"config",
"file",
"(",
"given",
"the",
"existing",
"temp",
"directory",
")",
"and",
"store",
"it",
"in",
"the",
"context",
"."
] | def create_config_file_no_example(context):
_create_config_file(context, include_example=False) | [
"def",
"create_config_file_no_example",
"(",
"context",
")",
":",
"_create_config_file",
"(",
"context",
",",
"include_example",
"=",
"False",
")"
] | Behave step to create a temporary config file
(given the existing temp directory) and store it in the context. | [
"Behave",
"step",
"to",
"create",
"a",
"temporary",
"config",
"file",
"(",
"given",
"the",
"existing",
"temp",
"directory",
")",
"and",
"store",
"it",
"in",
"the",
"context",
"."
] | [
"\"\"\"Behave step to create a temporary config file\n (given the existing temp directory) and store it in the context.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | create_config_file_with_example | null | def create_config_file_with_example(context):
"""Behave step to create a temporary config file
(given the existing temp directory) and store it in the context.
"""
_create_config_file(context, include_example=True) | Behave step to create a temporary config file
(given the existing temp directory) and store it in the context.
| Behave step to create a temporary config file
(given the existing temp directory) and store it in the context. | [
"Behave",
"step",
"to",
"create",
"a",
"temporary",
"config",
"file",
"(",
"given",
"the",
"existing",
"temp",
"directory",
")",
"and",
"store",
"it",
"in",
"the",
"context",
"."
] | def create_config_file_with_example(context):
_create_config_file(context, include_example=True) | [
"def",
"create_config_file_with_example",
"(",
"context",
")",
":",
"_create_config_file",
"(",
"context",
",",
"include_example",
"=",
"True",
")"
] | Behave step to create a temporary config file
(given the existing temp directory) and store it in the context. | [
"Behave",
"step",
"to",
"create",
"a",
"temporary",
"config",
"file",
"(",
"given",
"the",
"existing",
"temp",
"directory",
")",
"and",
"store",
"it",
"in",
"the",
"context",
"."
] | [
"\"\"\"Behave step to create a temporary config file\n (given the existing temp directory) and store it in the context.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | create_project_from_config_file | null | def create_project_from_config_file(context):
"""Behave step to run kedro new given the config I previously created.
"""
res = run([context.kedro, "new", "-c", str(context.config_file)], env=context.env)
assert res.returncode == OK_EXIT_CODE, res | Behave step to run kedro new given the config I previously created.
| Behave step to run kedro new given the config I previously created. | [
"Behave",
"step",
"to",
"run",
"kedro",
"new",
"given",
"the",
"config",
"I",
"previously",
"created",
"."
] | def create_project_from_config_file(context):
res = run([context.kedro, "new", "-c", str(context.config_file)], env=context.env)
assert res.returncode == OK_EXIT_CODE, res | [
"def",
"create_project_from_config_file",
"(",
"context",
")",
":",
"res",
"=",
"run",
"(",
"[",
"context",
".",
"kedro",
",",
"\"new\"",
",",
"\"-c\"",
",",
"str",
"(",
"context",
".",
"config_file",
")",
"]",
",",
"env",
"=",
"context",
".",
"env",
"... | Behave step to run kedro new given the config I previously created. | [
"Behave",
"step",
"to",
"run",
"kedro",
"new",
"given",
"the",
"config",
"I",
"previously",
"created",
"."
] | [
"\"\"\"Behave step to run kedro new given the config I previously created.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | delete_unnecessary_assets | null | def delete_unnecessary_assets(context):
"""Delete .kedro.yml as it is not needed when executing installed project package.
"""
kedro_yaml = context.root_project_dir / ".kedro.yml"
kedro_yaml.unlink() | Delete .kedro.yml as it is not needed when executing installed project package.
| Delete .kedro.yml as it is not needed when executing installed project package. | [
"Delete",
".",
"kedro",
".",
"yml",
"as",
"it",
"is",
"not",
"needed",
"when",
"executing",
"installed",
"project",
"package",
"."
] | def delete_unnecessary_assets(context):
kedro_yaml = context.root_project_dir / ".kedro.yml"
kedro_yaml.unlink() | [
"def",
"delete_unnecessary_assets",
"(",
"context",
")",
":",
"kedro_yaml",
"=",
"context",
".",
"root_project_dir",
"/",
"\".kedro.yml\"",
"kedro_yaml",
".",
"unlink",
"(",
")"
] | Delete .kedro.yml as it is not needed when executing installed project package. | [
"Delete",
".",
"kedro",
".",
"yml",
"as",
"it",
"is",
"not",
"needed",
"when",
"executing",
"installed",
"project",
"package",
"."
] | [
"\"\"\"Delete .kedro.yml as it is not needed when executing installed project package.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | simulate_nb_execution | null | def simulate_nb_execution(context):
"""Change test jupyter notebook to TEST_JUPYTER_AFTER_EXEC
simulate that it was executed and output was saved.
"""
with open(
str(context.root_project_dir / "notebooks" / "hello_world.ipynb"), "wt"
) as test_nb_fh:
test_nb_fh.write(TEST_JUPYTER_AFT... | Change test jupyter notebook to TEST_JUPYTER_AFTER_EXEC
simulate that it was executed and output was saved.
| Change test jupyter notebook to TEST_JUPYTER_AFTER_EXEC
simulate that it was executed and output was saved. | [
"Change",
"test",
"jupyter",
"notebook",
"to",
"TEST_JUPYTER_AFTER_EXEC",
"simulate",
"that",
"it",
"was",
"executed",
"and",
"output",
"was",
"saved",
"."
] | def simulate_nb_execution(context):
with open(
str(context.root_project_dir / "notebooks" / "hello_world.ipynb"), "wt"
) as test_nb_fh:
test_nb_fh.write(TEST_JUPYTER_AFTER_EXEC) | [
"def",
"simulate_nb_execution",
"(",
"context",
")",
":",
"with",
"open",
"(",
"str",
"(",
"context",
".",
"root_project_dir",
"/",
"\"notebooks\"",
"/",
"\"hello_world.ipynb\"",
")",
",",
"\"wt\"",
")",
"as",
"test_nb_fh",
":",
"test_nb_fh",
".",
"write",
"("... | Change test jupyter notebook to TEST_JUPYTER_AFTER_EXEC
simulate that it was executed and output was saved. | [
"Change",
"test",
"jupyter",
"notebook",
"to",
"TEST_JUPYTER_AFTER_EXEC",
"simulate",
"that",
"it",
"was",
"executed",
"and",
"output",
"was",
"saved",
"."
] | [
"\"\"\"Change test jupyter notebook to TEST_JUPYTER_AFTER_EXEC\n simulate that it was executed and output was saved.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_empty_pipeline_exists | null | def check_empty_pipeline_exists(context):
"""Check if the created `pipeline.py` contains no nodes"""
pipeline_file = (
context.root_project_dir
/ "src"
/ context.project_name.replace("-", "_")
/ "pipeline.py"
)
assert '"__default__": Pipeline([])' in pipeline_file.read_te... | Check if the created `pipeline.py` contains no nodes | Check if the created `pipeline.py` contains no nodes | [
"Check",
"if",
"the",
"created",
"`",
"pipeline",
".",
"py",
"`",
"contains",
"no",
"nodes"
] | def check_empty_pipeline_exists(context):
pipeline_file = (
context.root_project_dir
/ "src"
/ context.project_name.replace("-", "_")
/ "pipeline.py"
)
assert '"__default__": Pipeline([])' in pipeline_file.read_text("utf-8") | [
"def",
"check_empty_pipeline_exists",
"(",
"context",
")",
":",
"pipeline_file",
"=",
"(",
"context",
".",
"root_project_dir",
"/",
"\"src\"",
"/",
"context",
".",
"project_name",
".",
"replace",
"(",
"\"-\"",
",",
"\"_\"",
")",
"/",
"\"pipeline.py\"",
")",
"a... | Check if the created `pipeline.py` contains no nodes | [
"Check",
"if",
"the",
"created",
"`",
"pipeline",
".",
"py",
"`",
"contains",
"no",
"nodes"
] | [
"\"\"\"Check if the created `pipeline.py` contains no nodes\"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_pipeline_not_empty | null | def check_pipeline_not_empty(context):
"""Check if the created `pipeline.py` contains nodes"""
pipeline_file = (
context.root_project_dir
/ "src"
/ context.project_name.replace("-", "_")
/ "pipeline.py"
)
assert "pipeline = Pipeline([])" not in pipeline_file.read_text("ut... | Check if the created `pipeline.py` contains nodes | Check if the created `pipeline.py` contains nodes | [
"Check",
"if",
"the",
"created",
"`",
"pipeline",
".",
"py",
"`",
"contains",
"nodes"
] | def check_pipeline_not_empty(context):
pipeline_file = (
context.root_project_dir
/ "src"
/ context.project_name.replace("-", "_")
/ "pipeline.py"
)
assert "pipeline = Pipeline([])" not in pipeline_file.read_text("utf-8") | [
"def",
"check_pipeline_not_empty",
"(",
"context",
")",
":",
"pipeline_file",
"=",
"(",
"context",
".",
"root_project_dir",
"/",
"\"src\"",
"/",
"context",
".",
"project_name",
".",
"replace",
"(",
"\"-\"",
",",
"\"_\"",
")",
"/",
"\"pipeline.py\"",
")",
"asse... | Check if the created `pipeline.py` contains nodes | [
"Check",
"if",
"the",
"created",
"`",
"pipeline",
".",
"py",
"`",
"contains",
"nodes"
] | [
"\"\"\"Check if the created `pipeline.py` contains nodes\"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_additional_cell_added | null | def check_additional_cell_added(context):
"""Check that an addiitonal cell has been added compared to notebook
coded by TEST_JUPYTER_ORG.
"""
with open(
str(context.root_project_dir / "notebooks" / "hello_world.ipynb")
) as test_nb_fh:
context.nb_data = json.load(test_nb_fh)
... | Check that an addiitonal cell has been added compared to notebook
coded by TEST_JUPYTER_ORG.
| Check that an addiitonal cell has been added compared to notebook
coded by TEST_JUPYTER_ORG. | [
"Check",
"that",
"an",
"addiitonal",
"cell",
"has",
"been",
"added",
"compared",
"to",
"notebook",
"coded",
"by",
"TEST_JUPYTER_ORG",
"."
] | def check_additional_cell_added(context):
with open(
str(context.root_project_dir / "notebooks" / "hello_world.ipynb")
) as test_nb_fh:
context.nb_data = json.load(test_nb_fh)
assert len(context.nb_data["cells"]) == 2 | [
"def",
"check_additional_cell_added",
"(",
"context",
")",
":",
"with",
"open",
"(",
"str",
"(",
"context",
".",
"root_project_dir",
"/",
"\"notebooks\"",
"/",
"\"hello_world.ipynb\"",
")",
")",
"as",
"test_nb_fh",
":",
"context",
".",
"nb_data",
"=",
"json",
... | Check that an addiitonal cell has been added compared to notebook
coded by TEST_JUPYTER_ORG. | [
"Check",
"that",
"an",
"addiitonal",
"cell",
"has",
"been",
"added",
"compared",
"to",
"notebook",
"coded",
"by",
"TEST_JUPYTER_ORG",
"."
] | [
"\"\"\"Check that an addiitonal cell has been added compared to notebook\n coded by TEST_JUPYTER_ORG.\n \"\"\""
] | [
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_jupyter_nb_proc_on_port | null | def check_jupyter_nb_proc_on_port(context: behave.runner.Context, port: int):
"""Check that jupyter notebook service is running on specified port.
Args:
context: Test context
port: Port to check
"""
url = "http://localhost:%d" % int(port)
try:
util.wait_for(
fun... | Check that jupyter notebook service is running on specified port.
Args:
context: Test context
port: Port to check
| Check that jupyter notebook service is running on specified port. | [
"Check",
"that",
"jupyter",
"notebook",
"service",
"is",
"running",
"on",
"specified",
"port",
"."
] | def check_jupyter_nb_proc_on_port(context: behave.runner.Context, port: int):
url = "http://localhost:%d" % int(port)
try:
util.wait_for(
func=_check_service_up,
context=context,
url=url,
string="Jupyter Notebook",
timeout_=15,
prin... | [
"def",
"check_jupyter_nb_proc_on_port",
"(",
"context",
":",
"behave",
".",
"runner",
".",
"Context",
",",
"port",
":",
"int",
")",
":",
"url",
"=",
"\"http://localhost:%d\"",
"%",
"int",
"(",
"port",
")",
"try",
":",
"util",
".",
"wait_for",
"(",
"func",
... | Check that jupyter notebook service is running on specified port. | [
"Check",
"that",
"jupyter",
"notebook",
"service",
"is",
"running",
"on",
"specified",
"port",
"."
] | [
"\"\"\"Check that jupyter notebook service is running on specified port.\n\n Args:\n context: Test context\n port: Port to check\n\n \"\"\""
] | [
{
"param": "context",
"type": "behave.runner.Context"
},
{
"param": "port",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": "behave.runner.Context",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "port",
"type": "int",
"... |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_jupyter_lab_proc_on_port | null | def check_jupyter_lab_proc_on_port(context: behave.runner.Context, port: int):
"""Check that jupyter lab service is running on specified port.
Args:
context: Test context
port: Port to check
"""
url = "http://localhost:%d" % int(port)
try:
util.wait_for(
func=_c... | Check that jupyter lab service is running on specified port.
Args:
context: Test context
port: Port to check
| Check that jupyter lab service is running on specified port. | [
"Check",
"that",
"jupyter",
"lab",
"service",
"is",
"running",
"on",
"specified",
"port",
"."
] | def check_jupyter_lab_proc_on_port(context: behave.runner.Context, port: int):
url = "http://localhost:%d" % int(port)
try:
util.wait_for(
func=_check_service_up,
context=context,
url=url,
string='<a href="/lab"',
print_error=True,
)
... | [
"def",
"check_jupyter_lab_proc_on_port",
"(",
"context",
":",
"behave",
".",
"runner",
".",
"Context",
",",
"port",
":",
"int",
")",
":",
"url",
"=",
"\"http://localhost:%d\"",
"%",
"int",
"(",
"port",
")",
"try",
":",
"util",
".",
"wait_for",
"(",
"func",... | Check that jupyter lab service is running on specified port. | [
"Check",
"that",
"jupyter",
"lab",
"service",
"is",
"running",
"on",
"specified",
"port",
"."
] | [
"\"\"\"Check that jupyter lab service is running on specified port.\n\n Args:\n context: Test context\n port: Port to check\n\n \"\"\""
] | [
{
"param": "context",
"type": "behave.runner.Context"
},
{
"param": "port",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": "behave.runner.Context",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "port",
"type": "int",
"... |
bad68f52f6b9bb470171b33f9311d782c5d3f614 | eferm/kedro | features/steps/cli_steps.py | [
"Apache-2.0"
] | Python | check_docs_generated | null | def check_docs_generated(context: behave.runner.Context):
"""Check that new project docs are generated."""
index_html = (
context.root_project_dir / "docs" / "build" / "html" / "index.html"
).read_text("utf-8")
project_repo = context.project_name.replace("-", "_")
assert "Welcome to project’... | Check that new project docs are generated. | Check that new project docs are generated. | [
"Check",
"that",
"new",
"project",
"docs",
"are",
"generated",
"."
] | def check_docs_generated(context: behave.runner.Context):
index_html = (
context.root_project_dir / "docs" / "build" / "html" / "index.html"
).read_text("utf-8")
project_repo = context.project_name.replace("-", "_")
assert "Welcome to project’s %s API docs!" % project_repo in index_html | [
"def",
"check_docs_generated",
"(",
"context",
":",
"behave",
".",
"runner",
".",
"Context",
")",
":",
"index_html",
"=",
"(",
"context",
".",
"root_project_dir",
"/",
"\"docs\"",
"/",
"\"build\"",
"/",
"\"html\"",
"/",
"\"index.html\"",
")",
".",
"read_text",... | Check that new project docs are generated. | [
"Check",
"that",
"new",
"project",
"docs",
"are",
"generated",
"."
] | [
"\"\"\"Check that new project docs are generated.\"\"\""
] | [
{
"param": "context",
"type": "behave.runner.Context"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": "behave.runner.Context",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903f4569344f88c7e515e59353cdf4359c98f288 | eferm/kedro | kedro/cli/utils.py | [
"Apache-2.0"
] | Python | call | null | def call(cmd: List[str], **kwargs): # pragma: no cover
"""Run a subprocess command and exit if it fails."""
print(" ".join(shlex.quote(c) for c in cmd))
# pylint: disable=subprocess-run-check
res = subprocess.run(cmd, **kwargs).returncode
if res:
sys.exit(res) | Run a subprocess command and exit if it fails. | Run a subprocess command and exit if it fails. | [
"Run",
"a",
"subprocess",
"command",
"and",
"exit",
"if",
"it",
"fails",
"."
] | def call(cmd: List[str], **kwargs):
print(" ".join(shlex.quote(c) for c in cmd))
res = subprocess.run(cmd, **kwargs).returncode
if res:
sys.exit(res) | [
"def",
"call",
"(",
"cmd",
":",
"List",
"[",
"str",
"]",
",",
"**",
"kwargs",
")",
":",
"print",
"(",
"\" \"",
".",
"join",
"(",
"shlex",
".",
"quote",
"(",
"c",
")",
"for",
"c",
"in",
"cmd",
")",
")",
"res",
"=",
"subprocess",
".",
"run",
"(... | Run a subprocess command and exit if it fails. | [
"Run",
"a",
"subprocess",
"command",
"and",
"exit",
"if",
"it",
"fails",
"."
] | [
"# pragma: no cover",
"\"\"\"Run a subprocess command and exit if it fails.\"\"\"",
"# pylint: disable=subprocess-run-check"
] | [
{
"param": "cmd",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903f4569344f88c7e515e59353cdf4359c98f288 | eferm/kedro | kedro/cli/utils.py | [
"Apache-2.0"
] | Python | export_nodes | None | def export_nodes(filepath: Path, output_path: Path) -> None:
"""Copy code from Jupyter cells into nodes in src/<package_name>/nodes/,
under filename with same name as notebook.
Args:
filepath: Path to Jupyter notebook file
output_path: Path where notebook cells' source code will be exported... | Copy code from Jupyter cells into nodes in src/<package_name>/nodes/,
under filename with same name as notebook.
Args:
filepath: Path to Jupyter notebook file
output_path: Path where notebook cells' source code will be exported
Raises:
KedroCliError: When provided a filepath that ca... | Copy code from Jupyter cells into nodes in src//nodes/,
under filename with same name as notebook. | [
"Copy",
"code",
"from",
"Jupyter",
"cells",
"into",
"nodes",
"in",
"src",
"//",
"nodes",
"/",
"under",
"filename",
"with",
"same",
"name",
"as",
"notebook",
"."
] | def export_nodes(filepath: Path, output_path: Path) -> None:
try:
content = json.loads(filepath.read_text())
except json.JSONDecodeError:
raise KedroCliError(f"Provided filepath is not a Jupyter notebook: {filepath}")
cells = [
cell
for cell in content["cells"]
if cel... | [
"def",
"export_nodes",
"(",
"filepath",
":",
"Path",
",",
"output_path",
":",
"Path",
")",
"->",
"None",
":",
"try",
":",
"content",
"=",
"json",
".",
"loads",
"(",
"filepath",
".",
"read_text",
"(",
")",
")",
"except",
"json",
".",
"JSONDecodeError",
... | Copy code from Jupyter cells into nodes in src/<package_name>/nodes/,
under filename with same name as notebook. | [
"Copy",
"code",
"from",
"Jupyter",
"cells",
"into",
"nodes",
"in",
"src",
"/",
"<package_name",
">",
"/",
"nodes",
"/",
"under",
"filename",
"with",
"same",
"name",
"as",
"notebook",
"."
] | [
"\"\"\"Copy code from Jupyter cells into nodes in src/<package_name>/nodes/,\n under filename with same name as notebook.\n\n Args:\n filepath: Path to Jupyter notebook file\n output_path: Path where notebook cells' source code will be exported\n Raises:\n KedroCliError: When provided ... | [
{
"param": "filepath",
"type": "Path"
},
{
"param": "output_path",
"type": "Path"
}
] | {
"returns": [],
"raises": [
{
"docstring": "When provided a filepath that cannot be read as a\nJupyer notebook and loaded into json format.",
"docstring_tokens": [
"When",
"provided",
"a",
"filepath",
"that",
"cannot",
"be",
"read",
... |
903f4569344f88c7e515e59353cdf4359c98f288 | eferm/kedro | kedro/cli/utils.py | [
"Apache-2.0"
] | Python | forward_command | <not_specific> | def forward_command(group, name=None, forward_help=False):
"""A command that receives the rest of the command line as 'args'."""
def wrapit(func):
func = click.argument("args", nargs=-1, type=click.UNPROCESSED)(func)
func = group.command(
name=name,
context_settings=dict... | A command that receives the rest of the command line as 'args'. | A command that receives the rest of the command line as 'args'. | [
"A",
"command",
"that",
"receives",
"the",
"rest",
"of",
"the",
"command",
"line",
"as",
"'",
"args",
"'",
"."
] | def forward_command(group, name=None, forward_help=False):
def wrapit(func):
func = click.argument("args", nargs=-1, type=click.UNPROCESSED)(func)
func = group.command(
name=name,
context_settings=dict(
ignore_unknown_options=True,
help_option_... | [
"def",
"forward_command",
"(",
"group",
",",
"name",
"=",
"None",
",",
"forward_help",
"=",
"False",
")",
":",
"def",
"wrapit",
"(",
"func",
")",
":",
"func",
"=",
"click",
".",
"argument",
"(",
"\"args\"",
",",
"nargs",
"=",
"-",
"1",
",",
"type",
... | A command that receives the rest of the command line as 'args'. | [
"A",
"command",
"that",
"receives",
"the",
"rest",
"of",
"the",
"command",
"line",
"as",
"'",
"args",
"'",
"."
] | [
"\"\"\"A command that receives the rest of the command line as 'args'.\"\"\""
] | [
{
"param": "group",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "forward_help",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "group",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": ... |
bb422424d0516362502c6e19080d4c3f2fbb0057 | eferm/kedro | kedro/extras/datasets/spark/spark_dataset.py | [
"Apache-2.0"
] | Python | _dbfs_glob | List[str] | def _dbfs_glob(pattern: str, dbutils: Any) -> List[str]:
"""Perform a custom glob search in DBFS using the provided pattern.
It is assumed that version paths are managed by Kedro only.
Args:
pattern: Glob pattern to search for.
dbutils: dbutils instance to operate with DBFS.
Returns:
... | Perform a custom glob search in DBFS using the provided pattern.
It is assumed that version paths are managed by Kedro only.
Args:
pattern: Glob pattern to search for.
dbutils: dbutils instance to operate with DBFS.
Returns:
List of DBFS paths prefixed with '/dbfs' that satisfy... | Perform a custom glob search in DBFS using the provided pattern.
It is assumed that version paths are managed by Kedro only. | [
"Perform",
"a",
"custom",
"glob",
"search",
"in",
"DBFS",
"using",
"the",
"provided",
"pattern",
".",
"It",
"is",
"assumed",
"that",
"version",
"paths",
"are",
"managed",
"by",
"Kedro",
"only",
"."
] | def _dbfs_glob(pattern: str, dbutils: Any) -> List[str]:
pattern = _strip_dbfs_prefix(pattern)
prefix = _parse_glob_pattern(pattern)
matched = set()
filename = pattern.split("/")[-1]
for file_info in dbutils.fs.ls(prefix):
if file_info.isDir():
path = str(
PurePos... | [
"def",
"_dbfs_glob",
"(",
"pattern",
":",
"str",
",",
"dbutils",
":",
"Any",
")",
"->",
"List",
"[",
"str",
"]",
":",
"pattern",
"=",
"_strip_dbfs_prefix",
"(",
"pattern",
")",
"prefix",
"=",
"_parse_glob_pattern",
"(",
"pattern",
")",
"matched",
"=",
"s... | Perform a custom glob search in DBFS using the provided pattern. | [
"Perform",
"a",
"custom",
"glob",
"search",
"in",
"DBFS",
"using",
"the",
"provided",
"pattern",
"."
] | [
"\"\"\"Perform a custom glob search in DBFS using the provided pattern.\n It is assumed that version paths are managed by Kedro only.\n\n Args:\n pattern: Glob pattern to search for.\n dbutils: dbutils instance to operate with DBFS.\n\n Returns:\n List of DBFS paths prefixed with '... | [
{
"param": "pattern",
"type": "str"
},
{
"param": "dbutils",
"type": "Any"
}
] | {
"returns": [
{
"docstring": "List of DBFS paths prefixed with '/dbfs' that satisfy the glob pattern.",
"docstring_tokens": [
"List",
"of",
"DBFS",
"paths",
"prefixed",
"with",
"'",
"/",
"dbfs",
"'",
"that",
... |
bb422424d0516362502c6e19080d4c3f2fbb0057 | eferm/kedro | kedro/extras/datasets/spark/spark_dataset.py | [
"Apache-2.0"
] | Python | _get_dbutils | Optional[Any] | def _get_dbutils(spark: SparkSession) -> Optional[Any]:
"""Get the instance of 'dbutils' or None if the one could not be found."""
dbutils = globals().get("dbutils")
if dbutils:
return dbutils
try:
from pyspark.dbutils import DBUtils # pylint: disable=import-outside-toplevel
d... | Get the instance of 'dbutils' or None if the one could not be found. | Get the instance of 'dbutils' or None if the one could not be found. | [
"Get",
"the",
"instance",
"of",
"'",
"dbutils",
"'",
"or",
"None",
"if",
"the",
"one",
"could",
"not",
"be",
"found",
"."
] | def _get_dbutils(spark: SparkSession) -> Optional[Any]:
dbutils = globals().get("dbutils")
if dbutils:
return dbutils
try:
from pyspark.dbutils import DBUtils
dbutils = DBUtils(spark)
except ImportError:
try:
import IPython
except ImportError:
... | [
"def",
"_get_dbutils",
"(",
"spark",
":",
"SparkSession",
")",
"->",
"Optional",
"[",
"Any",
"]",
":",
"dbutils",
"=",
"globals",
"(",
")",
".",
"get",
"(",
"\"dbutils\"",
")",
"if",
"dbutils",
":",
"return",
"dbutils",
"try",
":",
"from",
"pyspark",
"... | Get the instance of 'dbutils' or None if the one could not be found. | [
"Get",
"the",
"instance",
"of",
"'",
"dbutils",
"'",
"or",
"None",
"if",
"the",
"one",
"could",
"not",
"be",
"found",
"."
] | [
"\"\"\"Get the instance of 'dbutils' or None if the one could not be found.\"\"\"",
"# pylint: disable=import-outside-toplevel",
"# pylint: disable=import-error,import-outside-toplevel"
] | [
{
"param": "spark",
"type": "SparkSession"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "spark",
"type": "SparkSession",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bb422424d0516362502c6e19080d4c3f2fbb0057 | eferm/kedro | kedro/extras/datasets/spark/spark_dataset.py | [
"Apache-2.0"
] | Python | hdfs_glob | List[str] | def hdfs_glob(self, pattern: str) -> List[str]:
"""Perform a glob search in HDFS using the provided pattern.
Args:
pattern: Glob pattern to search for.
Returns:
List of HDFS paths that satisfy the glob pattern.
"""
prefix = _parse_glob_pattern(pattern) o... | Perform a glob search in HDFS using the provided pattern.
Args:
pattern: Glob pattern to search for.
Returns:
List of HDFS paths that satisfy the glob pattern.
| Perform a glob search in HDFS using the provided pattern. | [
"Perform",
"a",
"glob",
"search",
"in",
"HDFS",
"using",
"the",
"provided",
"pattern",
"."
] | def hdfs_glob(self, pattern: str) -> List[str]:
prefix = _parse_glob_pattern(pattern) or "/"
matched = set()
try:
for dpath, _, fnames in self.walk(prefix):
if fnmatch(dpath, pattern):
matched.add(dpath)
matched |= set(
... | [
"def",
"hdfs_glob",
"(",
"self",
",",
"pattern",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"prefix",
"=",
"_parse_glob_pattern",
"(",
"pattern",
")",
"or",
"\"/\"",
"matched",
"=",
"set",
"(",
")",
"try",
":",
"for",
"dpath",
",",
"_",
"... | Perform a glob search in HDFS using the provided pattern. | [
"Perform",
"a",
"glob",
"search",
"in",
"HDFS",
"using",
"the",
"provided",
"pattern",
"."
] | [
"\"\"\"Perform a glob search in HDFS using the provided pattern.\n\n Args:\n pattern: Glob pattern to search for.\n\n Returns:\n List of HDFS paths that satisfy the glob pattern.\n \"\"\"",
"# pragma: no cover",
"# HdfsError is raised by `self.walk()` if prefix does no... | [
{
"param": "self",
"type": null
},
{
"param": "pattern",
"type": "str"
}
] | {
"returns": [
{
"docstring": "List of HDFS paths that satisfy the glob pattern.",
"docstring_tokens": [
"List",
"of",
"HDFS",
"paths",
"that",
"satisfy",
"the",
"glob",
"pattern",
"."
],
"type": null
}
]... |
5af011ef1389a8bf174cdb664827859f18a0a055 | eferm/kedro | kedro/templates/project/{{ cookiecutter.repo_name }}/kedro_cli.py | [
"Apache-2.0"
] | Python | _reformat_load_versions | Dict[str, str] | def _reformat_load_versions( # pylint: disable=unused-argument
ctx, param, value
) -> Dict[str, str]:
"""Reformat data structure from tuple to dictionary for `load-version`.
E.g ('dataset1:time1', 'dataset2:time2') -> {"dataset1": "time1", "dataset2": "time2"}.
"""
load_versions_dict = {}
... | Reformat data structure from tuple to dictionary for `load-version`.
E.g ('dataset1:time1', 'dataset2:time2') -> {"dataset1": "time1", "dataset2": "time2"}.
| Reformat data structure from tuple to dictionary for `load-version`. | [
"Reformat",
"data",
"structure",
"from",
"tuple",
"to",
"dictionary",
"for",
"`",
"load",
"-",
"version",
"`",
"."
] | def _reformat_load_versions(
ctx, param, value
) -> Dict[str, str]:
load_versions_dict = {}
for load_version in value:
load_version_list = load_version.split(":", 1)
if len(load_version_list) != 2:
raise KedroCliError(
f"Expected the form of `load_version` to be... | [
"def",
"_reformat_load_versions",
"(",
"ctx",
",",
"param",
",",
"value",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"load_versions_dict",
"=",
"{",
"}",
"for",
"load_version",
"in",
"value",
":",
"load_version_list",
"=",
"load_version",
".",
"s... | Reformat data structure from tuple to dictionary for `load-version`. | [
"Reformat",
"data",
"structure",
"from",
"tuple",
"to",
"dictionary",
"for",
"`",
"load",
"-",
"version",
"`",
"."
] | [
"# pylint: disable=unused-argument",
"\"\"\"Reformat data structure from tuple to dictionary for `load-version`.\n E.g ('dataset1:time1', 'dataset2:time2') -> {\"dataset1\": \"time1\", \"dataset2\": \"time2\"}.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "param",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": null,
"docstring": null,
"docstring_tokens": [... |
aad38fe8b1db4505a12ef55b6241a5b8c7f06447 | eferm/kedro | kedro/runner/parallel_runner.py | [
"Apache-2.0"
] | Python | save | null | def save(self, data: Any):
"""Calls save method of a shared MemoryDataSet in SyncManager.
"""
try:
self.shared_memory_dataset.save(data)
except Exception as exc: # pylint: disable=broad-except
# Checks if the error is due to serialisation or not
try:
... | Calls save method of a shared MemoryDataSet in SyncManager.
| Calls save method of a shared MemoryDataSet in SyncManager. | [
"Calls",
"save",
"method",
"of",
"a",
"shared",
"MemoryDataSet",
"in",
"SyncManager",
"."
] | def save(self, data: Any):
try:
self.shared_memory_dataset.save(data)
except Exception as exc:
try:
pickle.dumps(data)
except Exception:
raise DataSetError(
"{} cannot be serialized. ParallelRunner implicit memor... | [
"def",
"save",
"(",
"self",
",",
"data",
":",
"Any",
")",
":",
"try",
":",
"self",
".",
"shared_memory_dataset",
".",
"save",
"(",
"data",
")",
"except",
"Exception",
"as",
"exc",
":",
"try",
":",
"pickle",
".",
"dumps",
"(",
"data",
")",
"except",
... | Calls save method of a shared MemoryDataSet in SyncManager. | [
"Calls",
"save",
"method",
"of",
"a",
"shared",
"MemoryDataSet",
"in",
"SyncManager",
"."
] | [
"\"\"\"Calls save method of a shared MemoryDataSet in SyncManager.\n \"\"\"",
"# pylint: disable=broad-except",
"# Checks if the error is due to serialisation or not",
"# SKIP_IF_NO_SPARK"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": "Any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "Any",
"docstring": null,
"docstring_tokens": ... |
aad38fe8b1db4505a12ef55b6241a5b8c7f06447 | eferm/kedro | kedro/runner/parallel_runner.py | [
"Apache-2.0"
] | Python | _run_node_synchronization | Node | def _run_node_synchronization(
node: Node, catalog: DataCatalog, is_async: bool = False, run_id: str = None
) -> Node:
"""Run a single `Node` with inputs from and outputs to the `catalog`.
`KedroContext` class is initialized in every subprocess because of Windows
(latest OSX with Python 3.8) limitation.... | Run a single `Node` with inputs from and outputs to the `catalog`.
`KedroContext` class is initialized in every subprocess because of Windows
(latest OSX with Python 3.8) limitation.
Windows has no "fork", so every subprocess is a brand new process created via "spawn",
and KedroContext needs to be creat... | Run a single `Node` with inputs from and outputs to the `catalog`.
`KedroContext` class is initialized in every subprocess because of Windows
(latest OSX with Python 3.8) limitation.
Windows has no "fork", so every subprocess is a brand new process created via "spawn",
and KedroContext needs to be created in every subp... | [
"Run",
"a",
"single",
"`",
"Node",
"`",
"with",
"inputs",
"from",
"and",
"outputs",
"to",
"the",
"`",
"catalog",
"`",
".",
"`",
"KedroContext",
"`",
"class",
"is",
"initialized",
"in",
"every",
"subprocess",
"because",
"of",
"Windows",
"(",
"latest",
"OS... | def _run_node_synchronization(
node: Node, catalog: DataCatalog, is_async: bool = False, run_id: str = None
) -> Node:
if multiprocessing.get_start_method() == "spawn":
import kedro.framework.context.context as context
context.load_context(Path.cwd())
return run_node(node, catalog, is_... | [
"def",
"_run_node_synchronization",
"(",
"node",
":",
"Node",
",",
"catalog",
":",
"DataCatalog",
",",
"is_async",
":",
"bool",
"=",
"False",
",",
"run_id",
":",
"str",
"=",
"None",
")",
"->",
"Node",
":",
"if",
"multiprocessing",
".",
"get_start_method",
... | Run a single `Node` with inputs from and outputs to the `catalog`. | [
"Run",
"a",
"single",
"`",
"Node",
"`",
"with",
"inputs",
"from",
"and",
"outputs",
"to",
"the",
"`",
"catalog",
"`",
"."
] | [
"\"\"\"Run a single `Node` with inputs from and outputs to the `catalog`.\n `KedroContext` class is initialized in every subprocess because of Windows\n (latest OSX with Python 3.8) limitation.\n Windows has no \"fork\", so every subprocess is a brand new process created via \"spawn\",\n and KedroContex... | [
{
"param": "node",
"type": "Node"
},
{
"param": "catalog",
"type": "DataCatalog"
},
{
"param": "is_async",
"type": "bool"
},
{
"param": "run_id",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The node argument.",
"docstring_tokens": [
"The",
"node",
"argument",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "node",
"type": "Node",
"docstring": "The ``Node`` to run.... |
aad38fe8b1db4505a12ef55b6241a5b8c7f06447 | eferm/kedro | kedro/runner/parallel_runner.py | [
"Apache-2.0"
] | Python | _run | None | def _run( # pylint: disable=too-many-locals,useless-suppression
self, pipeline: Pipeline, catalog: DataCatalog, run_id: str = None
) -> None:
"""The abstract interface for running pipelines.
Args:
pipeline: The ``Pipeline`` to run.
catalog: The ``DataCatalog`` from ... | The abstract interface for running pipelines.
Args:
pipeline: The ``Pipeline`` to run.
catalog: The ``DataCatalog`` from which to fetch data.
run_id: The id of the run.
Raises:
AttributeError: when the provided pipeline is not suitable for
... | The abstract interface for running pipelines. | [
"The",
"abstract",
"interface",
"for",
"running",
"pipelines",
"."
] | def _run(
self, pipeline: Pipeline, catalog: DataCatalog, run_id: str = None
) -> None:
nodes = pipeline.nodes
self._validate_catalog(catalog, pipeline)
self._validate_nodes(nodes)
load_counts = Counter(chain.from_iterable(n.inputs for n in nodes))
node_dependencies... | [
"def",
"_run",
"(",
"self",
",",
"pipeline",
":",
"Pipeline",
",",
"catalog",
":",
"DataCatalog",
",",
"run_id",
":",
"str",
"=",
"None",
")",
"->",
"None",
":",
"nodes",
"=",
"pipeline",
".",
"nodes",
"self",
".",
"_validate_catalog",
"(",
"catalog",
... | The abstract interface for running pipelines. | [
"The",
"abstract",
"interface",
"for",
"running",
"pipelines",
"."
] | [
"# pylint: disable=too-many-locals,useless-suppression",
"\"\"\"The abstract interface for running pipelines.\n\n Args:\n pipeline: The ``Pipeline`` to run.\n catalog: The ``DataCatalog`` from which to fetch data.\n run_id: The id of the run.\n\n Raises:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "pipeline",
"type": "Pipeline"
},
{
"param": "catalog",
"type": "DataCatalog"
},
{
"param": "run_id",
"type": "str"
}
] | {
"returns": [],
"raises": [
{
"docstring": "when the provided pipeline is not suitable for\nparallel execution.",
"docstring_tokens": [
"when",
"the",
"provided",
"pipeline",
"is",
"not",
"suitable",
"for",
"parallel",
... |
3cd3fdb0d4a3cf98442ab90caccd511c415ad4ef | eferm/kedro | tests/framework/hooks/test_context_hooks.py | [
"Apache-2.0"
] | Python | _create_context_with_hooks | <not_specific> | def _create_context_with_hooks(tmp_path, mocker, logging_hooks):
"""Create a context with some Hooks registered.
We do this in a function to support both calling it directly as well as as part of a fixture.
"""
class DummyContextWithHooks(KedroContext):
project_name = "test hooks"
packa... | Create a context with some Hooks registered.
We do this in a function to support both calling it directly as well as as part of a fixture.
| Create a context with some Hooks registered.
We do this in a function to support both calling it directly as well as as part of a fixture. | [
"Create",
"a",
"context",
"with",
"some",
"Hooks",
"registered",
".",
"We",
"do",
"this",
"in",
"a",
"function",
"to",
"support",
"both",
"calling",
"it",
"directly",
"as",
"well",
"as",
"as",
"part",
"of",
"a",
"fixture",
"."
] | def _create_context_with_hooks(tmp_path, mocker, logging_hooks):
class DummyContextWithHooks(KedroContext):
project_name = "test hooks"
package_name = "test_hooks"
project_version = __version__
hooks = (logging_hooks,)
def _get_run_id(self, *args, **kwargs) -> Union[None, str... | [
"def",
"_create_context_with_hooks",
"(",
"tmp_path",
",",
"mocker",
",",
"logging_hooks",
")",
":",
"class",
"DummyContextWithHooks",
"(",
"KedroContext",
")",
":",
"project_name",
"=",
"\"test hooks\"",
"package_name",
"=",
"\"test_hooks\"",
"project_version",
"=",
... | Create a context with some Hooks registered. | [
"Create",
"a",
"context",
"with",
"some",
"Hooks",
"registered",
"."
] | [
"\"\"\"Create a context with some Hooks registered.\n We do this in a function to support both calling it directly as well as as part of a fixture.\n \"\"\""
] | [
{
"param": "tmp_path",
"type": null
},
{
"param": "mocker",
"type": null
},
{
"param": "logging_hooks",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tmp_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mocker",
"type": null,
"docstring": null,
"docstring_toke... |
3cd3fdb0d4a3cf98442ab90caccd511c415ad4ef | eferm/kedro | tests/framework/hooks/test_context_hooks.py | [
"Apache-2.0"
] | Python | _assert_hook_call_record_has_expected_parameters | null | def _assert_hook_call_record_has_expected_parameters(
call_record: logging.LogRecord, expected_parameters: List[str]
):
"""Assert the given call record has all expected parameters."""
for param in expected_parameters:
assert hasattr(call_record, param) | Assert the given call record has all expected parameters. | Assert the given call record has all expected parameters. | [
"Assert",
"the",
"given",
"call",
"record",
"has",
"all",
"expected",
"parameters",
"."
] | def _assert_hook_call_record_has_expected_parameters(
call_record: logging.LogRecord, expected_parameters: List[str]
):
for param in expected_parameters:
assert hasattr(call_record, param) | [
"def",
"_assert_hook_call_record_has_expected_parameters",
"(",
"call_record",
":",
"logging",
".",
"LogRecord",
",",
"expected_parameters",
":",
"List",
"[",
"str",
"]",
")",
":",
"for",
"param",
"in",
"expected_parameters",
":",
"assert",
"hasattr",
"(",
"call_rec... | Assert the given call record has all expected parameters. | [
"Assert",
"the",
"given",
"call",
"record",
"has",
"all",
"expected",
"parameters",
"."
] | [
"\"\"\"Assert the given call record has all expected parameters.\"\"\""
] | [
{
"param": "call_record",
"type": "logging.LogRecord"
},
{
"param": "expected_parameters",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "call_record",
"type": "logging.LogRecord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expected_parameters",
"type": "List[str]",
"d... |
1a022c8caf42cfbcddea3a8c002d777585c3e1be | eferm/kedro | kedro/runner/runner.py | [
"Apache-2.0"
] | Python | _run | None | def _run(
self, pipeline: Pipeline, catalog: DataCatalog, run_id: str = None
) -> None:
"""The abstract interface for running pipelines, assuming that the
inputs have already been checked and normalized by run().
Args:
pipeline: The ``Pipeline`` to run.
catal... | The abstract interface for running pipelines, assuming that the
inputs have already been checked and normalized by run().
Args:
pipeline: The ``Pipeline`` to run.
catalog: The ``DataCatalog`` from which to fetch data.
run_id: The id of the run.
| The abstract interface for running pipelines, assuming that the
inputs have already been checked and normalized by run(). | [
"The",
"abstract",
"interface",
"for",
"running",
"pipelines",
"assuming",
"that",
"the",
"inputs",
"have",
"already",
"been",
"checked",
"and",
"normalized",
"by",
"run",
"()",
"."
] | def _run(
self, pipeline: Pipeline, catalog: DataCatalog, run_id: str = None
) -> None:
pass | [
"def",
"_run",
"(",
"self",
",",
"pipeline",
":",
"Pipeline",
",",
"catalog",
":",
"DataCatalog",
",",
"run_id",
":",
"str",
"=",
"None",
")",
"->",
"None",
":",
"pass"
] | The abstract interface for running pipelines, assuming that the
inputs have already been checked and normalized by run(). | [
"The",
"abstract",
"interface",
"for",
"running",
"pipelines",
"assuming",
"that",
"the",
"inputs",
"have",
"already",
"been",
"checked",
"and",
"normalized",
"by",
"run",
"()",
"."
] | [
"\"\"\"The abstract interface for running pipelines, assuming that the\n inputs have already been checked and normalized by run().\n\n Args:\n pipeline: The ``Pipeline`` to run.\n catalog: The ``DataCatalog`` from which to fetch data.\n run_id: The id of the run.\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "pipeline",
"type": "Pipeline"
},
{
"param": "catalog",
"type": "DataCatalog"
},
{
"param": "run_id",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pipeline",
"type": "Pipeline",
"docstring": "The ``Pipeline`` to ru... |
1a022c8caf42cfbcddea3a8c002d777585c3e1be | eferm/kedro | kedro/runner/runner.py | [
"Apache-2.0"
] | Python | run_node | Node | def run_node(
node: Node, catalog: DataCatalog, is_async: bool = False, run_id: str = None
) -> Node:
"""Run a single `Node` with inputs from and outputs to the `catalog`.
Args:
node: The ``Node`` to run.
catalog: A ``DataCatalog`` containing the node's inputs and outputs.
is_async:... | Run a single `Node` with inputs from and outputs to the `catalog`.
Args:
node: The ``Node`` to run.
catalog: A ``DataCatalog`` containing the node's inputs and outputs.
is_async: If True, the node inputs and outputs are loaded and saved
asynchronously with threads. Defaults to F... | Run a single `Node` with inputs from and outputs to the `catalog`. | [
"Run",
"a",
"single",
"`",
"Node",
"`",
"with",
"inputs",
"from",
"and",
"outputs",
"to",
"the",
"`",
"catalog",
"`",
"."
] | def run_node(
node: Node, catalog: DataCatalog, is_async: bool = False, run_id: str = None
) -> Node:
if is_async:
node = _run_node_async(node, catalog, run_id)
else:
node = _run_node_sequential(node, catalog, run_id)
for name in node.confirms:
catalog.confirm(name)
return no... | [
"def",
"run_node",
"(",
"node",
":",
"Node",
",",
"catalog",
":",
"DataCatalog",
",",
"is_async",
":",
"bool",
"=",
"False",
",",
"run_id",
":",
"str",
"=",
"None",
")",
"->",
"Node",
":",
"if",
"is_async",
":",
"node",
"=",
"_run_node_async",
"(",
"... | Run a single `Node` with inputs from and outputs to the `catalog`. | [
"Run",
"a",
"single",
"`",
"Node",
"`",
"with",
"inputs",
"from",
"and",
"outputs",
"to",
"the",
"`",
"catalog",
"`",
"."
] | [
"\"\"\"Run a single `Node` with inputs from and outputs to the `catalog`.\n\n Args:\n node: The ``Node`` to run.\n catalog: A ``DataCatalog`` containing the node's inputs and outputs.\n is_async: If True, the node inputs and outputs are loaded and saved\n asynchronously with threa... | [
{
"param": "node",
"type": "Node"
},
{
"param": "catalog",
"type": "DataCatalog"
},
{
"param": "is_async",
"type": "bool"
},
{
"param": "run_id",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The node argument.",
"docstring_tokens": [
"The",
"node",
"argument",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "node",
"type": "Node",
"docstring": "The ``Node`` to run.... |
8fdf63207556ca41d90f4c0cc3ef8e89592275b7 | eferm/kedro | kedro/pipeline/pipeline.py | [
"Apache-2.0"
] | Python | only_nodes_with_namespace | "Pipeline" | def only_nodes_with_namespace(self, node_namespace: str) -> "Pipeline":
"""Create a new ``Pipeline`` which will contain only the specified
nodes by namespace.
Args:
node_namespace: One node namespace.
Raises:
ValueError: When pipeline contains no pipeline with t... | Create a new ``Pipeline`` which will contain only the specified
nodes by namespace.
Args:
node_namespace: One node namespace.
Raises:
ValueError: When pipeline contains no pipeline with the specified namespace.
Returns:
A new ``Pipeline`` with nodes... | Create a new ``Pipeline`` which will contain only the specified
nodes by namespace. | [
"Create",
"a",
"new",
"`",
"`",
"Pipeline",
"`",
"`",
"which",
"will",
"contain",
"only",
"the",
"specified",
"nodes",
"by",
"namespace",
"."
] | def only_nodes_with_namespace(self, node_namespace: str) -> "Pipeline":
nodes = [
n
for n in self.nodes
if n.namespace and n.namespace.startswith(node_namespace)
]
if not nodes:
raise ValueError(
"Pipeline does not contain nodes wit... | [
"def",
"only_nodes_with_namespace",
"(",
"self",
",",
"node_namespace",
":",
"str",
")",
"->",
"\"Pipeline\"",
":",
"nodes",
"=",
"[",
"n",
"for",
"n",
"in",
"self",
".",
"nodes",
"if",
"n",
".",
"namespace",
"and",
"n",
".",
"namespace",
".",
"startswit... | Create a new ``Pipeline`` which will contain only the specified
nodes by namespace. | [
"Create",
"a",
"new",
"`",
"`",
"Pipeline",
"`",
"`",
"which",
"will",
"contain",
"only",
"the",
"specified",
"nodes",
"by",
"namespace",
"."
] | [
"\"\"\"Create a new ``Pipeline`` which will contain only the specified\n nodes by namespace.\n\n Args:\n node_namespace: One node namespace.\n\n Raises:\n ValueError: When pipeline contains no pipeline with the specified namespace.\n\n Returns:\n A new ``... | [
{
"param": "self",
"type": null
},
{
"param": "node_namespace",
"type": "str"
}
] | {
"returns": [
{
"docstring": "A new ``Pipeline`` with nodes starting with a specified namespace.",
"docstring_tokens": [
"A",
"new",
"`",
"`",
"Pipeline",
"`",
"`",
"with",
"nodes",
"starting",
"with",
"a"... |
8fdf63207556ca41d90f4c0cc3ef8e89592275b7 | eferm/kedro | kedro/pipeline/pipeline.py | [
"Apache-2.0"
] | Python | _get_nodes_with_inputs_transcode_compatible | Set[Node] | def _get_nodes_with_inputs_transcode_compatible(
self, datasets: Set[str]
) -> Set[Node]:
"""Retrieves nodes that use the given `datasets` as inputs.
If provided a name, but no format, for a transcoded dataset, it
includes all nodes that use inputs with that name, otherwise it
... | Retrieves nodes that use the given `datasets` as inputs.
If provided a name, but no format, for a transcoded dataset, it
includes all nodes that use inputs with that name, otherwise it
matches to the fully-qualified name only (i.e. name@format).
Raises:
ValueError: if any of... | Retrieves nodes that use the given `datasets` as inputs.
If provided a name, but no format, for a transcoded dataset, it
includes all nodes that use inputs with that name, otherwise it
matches to the fully-qualified name only . | [
"Retrieves",
"nodes",
"that",
"use",
"the",
"given",
"`",
"datasets",
"`",
"as",
"inputs",
".",
"If",
"provided",
"a",
"name",
"but",
"no",
"format",
"for",
"a",
"transcoded",
"dataset",
"it",
"includes",
"all",
"nodes",
"that",
"use",
"inputs",
"with",
... | def _get_nodes_with_inputs_transcode_compatible(
self, datasets: Set[str]
) -> Set[Node]:
missing = sorted(
datasets - self.data_sets() - self._transcode_compatible_names()
)
if missing:
raise ValueError(
"Pipeline does not contain data_sets na... | [
"def",
"_get_nodes_with_inputs_transcode_compatible",
"(",
"self",
",",
"datasets",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"Set",
"[",
"Node",
"]",
":",
"missing",
"=",
"sorted",
"(",
"datasets",
"-",
"self",
".",
"data_sets",
"(",
")",
"-",
"self",
"."... | Retrieves nodes that use the given `datasets` as inputs. | [
"Retrieves",
"nodes",
"that",
"use",
"the",
"given",
"`",
"datasets",
"`",
"as",
"inputs",
"."
] | [
"\"\"\"Retrieves nodes that use the given `datasets` as inputs.\n If provided a name, but no format, for a transcoded dataset, it\n includes all nodes that use inputs with that name, otherwise it\n matches to the fully-qualified name only (i.e. name@format).\n\n Raises:\n Valu... | [
{
"param": "self",
"type": null
},
{
"param": "datasets",
"type": "Set[str]"
}
] | {
"returns": [
{
"docstring": "Set of ``Nodes`` that use the given datasets as inputs.",
"docstring_tokens": [
"Set",
"of",
"`",
"`",
"Nodes",
"`",
"`",
"that",
"use",
"the",
"given",
"datasets",
"a... |
8fdf63207556ca41d90f4c0cc3ef8e89592275b7 | eferm/kedro | kedro/pipeline/pipeline.py | [
"Apache-2.0"
] | Python | _get_nodes_with_outputs_transcode_compatible | Set[Node] | def _get_nodes_with_outputs_transcode_compatible(
self, datasets: Set[str]
) -> Set[Node]:
"""Retrieves nodes that output to the given `datasets`.
If provided a name, but no format, for a transcoded dataset, it
includes the node that outputs to that name, otherwise it matches
... | Retrieves nodes that output to the given `datasets`.
If provided a name, but no format, for a transcoded dataset, it
includes the node that outputs to that name, otherwise it matches
to the fully-qualified name only (i.e. name@format).
Raises:
ValueError: if any of the given... | Retrieves nodes that output to the given `datasets`.
If provided a name, but no format, for a transcoded dataset, it
includes the node that outputs to that name, otherwise it matches
to the fully-qualified name only . | [
"Retrieves",
"nodes",
"that",
"output",
"to",
"the",
"given",
"`",
"datasets",
"`",
".",
"If",
"provided",
"a",
"name",
"but",
"no",
"format",
"for",
"a",
"transcoded",
"dataset",
"it",
"includes",
"the",
"node",
"that",
"outputs",
"to",
"that",
"name",
... | def _get_nodes_with_outputs_transcode_compatible(
self, datasets: Set[str]
) -> Set[Node]:
missing = sorted(
datasets - self.data_sets() - self._transcode_compatible_names()
)
if missing:
raise ValueError(
"Pipeline does not contain data_sets n... | [
"def",
"_get_nodes_with_outputs_transcode_compatible",
"(",
"self",
",",
"datasets",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"Set",
"[",
"Node",
"]",
":",
"missing",
"=",
"sorted",
"(",
"datasets",
"-",
"self",
".",
"data_sets",
"(",
")",
"-",
"self",
".... | Retrieves nodes that output to the given `datasets`. | [
"Retrieves",
"nodes",
"that",
"output",
"to",
"the",
"given",
"`",
"datasets",
"`",
"."
] | [
"\"\"\"Retrieves nodes that output to the given `datasets`.\n If provided a name, but no format, for a transcoded dataset, it\n includes the node that outputs to that name, otherwise it matches\n to the fully-qualified name only (i.e. name@format).\n\n Raises:\n ValueError: if... | [
{
"param": "self",
"type": null
},
{
"param": "datasets",
"type": "Set[str]"
}
] | {
"returns": [
{
"docstring": "Set of ``Nodes`` that output to the given datasets.",
"docstring_tokens": [
"Set",
"of",
"`",
"`",
"Nodes",
"`",
"`",
"that",
"output",
"to",
"the",
"given",
"datasets... |
8fdf63207556ca41d90f4c0cc3ef8e89592275b7 | eferm/kedro | kedro/pipeline/pipeline.py | [
"Apache-2.0"
] | Python | _validate_transcoded_inputs_outputs | None | def _validate_transcoded_inputs_outputs(nodes: List[Node]) -> None:
"""Users should not be allowed to refer to a transcoded dataset both
with and without the separator.
"""
all_inputs_outputs = set(
chain(
chain.from_iterable(node.inputs for node in nodes),
chain.from_ite... | Users should not be allowed to refer to a transcoded dataset both
with and without the separator.
| Users should not be allowed to refer to a transcoded dataset both
with and without the separator. | [
"Users",
"should",
"not",
"be",
"allowed",
"to",
"refer",
"to",
"a",
"transcoded",
"dataset",
"both",
"with",
"and",
"without",
"the",
"separator",
"."
] | def _validate_transcoded_inputs_outputs(nodes: List[Node]) -> None:
all_inputs_outputs = set(
chain(
chain.from_iterable(node.inputs for node in nodes),
chain.from_iterable(node.outputs for node in nodes),
)
)
invalid = set()
for dataset_name in all_inputs_outputs... | [
"def",
"_validate_transcoded_inputs_outputs",
"(",
"nodes",
":",
"List",
"[",
"Node",
"]",
")",
"->",
"None",
":",
"all_inputs_outputs",
"=",
"set",
"(",
"chain",
"(",
"chain",
".",
"from_iterable",
"(",
"node",
".",
"inputs",
"for",
"node",
"in",
"nodes",
... | Users should not be allowed to refer to a transcoded dataset both
with and without the separator. | [
"Users",
"should",
"not",
"be",
"allowed",
"to",
"refer",
"to",
"a",
"transcoded",
"dataset",
"both",
"with",
"and",
"without",
"the",
"separator",
"."
] | [
"\"\"\"Users should not be allowed to refer to a transcoded dataset both\n with and without the separator.\n \"\"\""
] | [
{
"param": "nodes",
"type": "List[Node]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "nodes",
"type": "List[Node]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eb781d85c3e0bad4b262418b9481039e82a482b3 | eferm/kedro | kedro/framework/hooks/manager.py | [
"Apache-2.0"
] | Python | _create_hook_manager | PluginManager | def _create_hook_manager() -> PluginManager:
"""Create a new PluginManager instance and register Kedro's hook specs.
"""
manager = PluginManager(HOOK_NAMESPACE)
manager.add_hookspecs(NodeSpecs)
manager.add_hookspecs(PipelineSpecs)
manager.add_hookspecs(DataCatalogSpecs)
return manager | Create a new PluginManager instance and register Kedro's hook specs.
| Create a new PluginManager instance and register Kedro's hook specs. | [
"Create",
"a",
"new",
"PluginManager",
"instance",
"and",
"register",
"Kedro",
"'",
"s",
"hook",
"specs",
"."
] | def _create_hook_manager() -> PluginManager:
manager = PluginManager(HOOK_NAMESPACE)
manager.add_hookspecs(NodeSpecs)
manager.add_hookspecs(PipelineSpecs)
manager.add_hookspecs(DataCatalogSpecs)
return manager | [
"def",
"_create_hook_manager",
"(",
")",
"->",
"PluginManager",
":",
"manager",
"=",
"PluginManager",
"(",
"HOOK_NAMESPACE",
")",
"manager",
".",
"add_hookspecs",
"(",
"NodeSpecs",
")",
"manager",
".",
"add_hookspecs",
"(",
"PipelineSpecs",
")",
"manager",
".",
... | Create a new PluginManager instance and register Kedro's hook specs. | [
"Create",
"a",
"new",
"PluginManager",
"instance",
"and",
"register",
"Kedro",
"'",
"s",
"hook",
"specs",
"."
] | [
"\"\"\"Create a new PluginManager instance and register Kedro's hook specs.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc0bd89210ea455cf8f2a8acfd58ccebecfdde0b | eferm/kedro | tests/framework/cli/conftest.py | [
"Apache-2.0"
] | Python | fake_kedro_cli | null | def fake_kedro_cli(dummy_project): # pylint: disable=unused-argument
"""
A small helper to pass kedro_cli into tests without importing.
It only becomes available after `dummy_project` fixture is applied,
that's why it can't be done on module level.
"""
yield import_module("kedro_cli") |
A small helper to pass kedro_cli into tests without importing.
It only becomes available after `dummy_project` fixture is applied,
that's why it can't be done on module level.
| A small helper to pass kedro_cli into tests without importing.
It only becomes available after `dummy_project` fixture is applied,
that's why it can't be done on module level. | [
"A",
"small",
"helper",
"to",
"pass",
"kedro_cli",
"into",
"tests",
"without",
"importing",
".",
"It",
"only",
"becomes",
"available",
"after",
"`",
"dummy_project",
"`",
"fixture",
"is",
"applied",
"that",
"'",
"s",
"why",
"it",
"can",
"'",
"t",
"be",
"... | def fake_kedro_cli(dummy_project):
yield import_module("kedro_cli") | [
"def",
"fake_kedro_cli",
"(",
"dummy_project",
")",
":",
"yield",
"import_module",
"(",
"\"kedro_cli\"",
")"
] | A small helper to pass kedro_cli into tests without importing. | [
"A",
"small",
"helper",
"to",
"pass",
"kedro_cli",
"into",
"tests",
"without",
"importing",
"."
] | [
"# pylint: disable=unused-argument",
"\"\"\"\n A small helper to pass kedro_cli into tests without importing.\n It only becomes available after `dummy_project` fixture is applied,\n that's why it can't be done on module level.\n \"\"\""
] | [
{
"param": "dummy_project",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dummy_project",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
37e4b8080b4eac977442f68f5defef8d0b6cd28e | eferm/kedro | kedro/pipeline/modular_pipeline.py | [
"Apache-2.0"
] | Python | pipeline | Pipeline | def pipeline(
pipe: Pipeline,
*,
inputs: Dict[str, str] = None,
outputs: Dict[str, str] = None,
parameters: Dict[str, str] = None,
namespace: str = None,
) -> Pipeline:
"""Create a copy of the pipeline and its nodes,
with some dataset names and node names modified.
Args:
pip... | Create a copy of the pipeline and its nodes,
with some dataset names and node names modified.
Args:
pipe: Original modular pipeline to integrate
inputs: A map of the existing input name to the new one.
Must only refer to the pipeline's free inputs.
outputs: A map of the exis... | Create a copy of the pipeline and its nodes,
with some dataset names and node names modified. | [
"Create",
"a",
"copy",
"of",
"the",
"pipeline",
"and",
"its",
"nodes",
"with",
"some",
"dataset",
"names",
"and",
"node",
"names",
"modified",
"."
] | def pipeline(
pipe: Pipeline,
*,
inputs: Dict[str, str] = None,
outputs: Dict[str, str] = None,
parameters: Dict[str, str] = None,
namespace: str = None,
) -> Pipeline:
inputs = copy.deepcopy(inputs) or {}
outputs = copy.deepcopy(outputs) or {}
parameters = copy.deepcopy(parameters) ... | [
"def",
"pipeline",
"(",
"pipe",
":",
"Pipeline",
",",
"*",
",",
"inputs",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
"=",
"None",
",",
"outputs",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
"=",
"None",
",",
"parameters",
":",
"Dict",
"[",
"str",
... | Create a copy of the pipeline and its nodes,
with some dataset names and node names modified. | [
"Create",
"a",
"copy",
"of",
"the",
"pipeline",
"and",
"its",
"nodes",
"with",
"some",
"dataset",
"names",
"and",
"node",
"names",
"modified",
"."
] | [
"\"\"\"Create a copy of the pipeline and its nodes,\n with some dataset names and node names modified.\n\n Args:\n pipe: Original modular pipeline to integrate\n inputs: A map of the existing input name to the new one.\n Must only refer to the pipeline's free inputs.\n outputs:... | [
{
"param": "pipe",
"type": "Pipeline"
},
{
"param": "inputs",
"type": "Dict[str, str]"
},
{
"param": "outputs",
"type": "Dict[str, str]"
},
{
"param": "parameters",
"type": "Dict[str, str]"
},
{
"param": "namespace",
"type": "str"
}
] | {
"returns": [
{
"docstring": "A new ``Pipeline`` object with the new nodes, modified as requested.",
"docstring_tokens": [
"A",
"new",
"`",
"`",
"Pipeline",
"`",
"`",
"object",
"with",
"the",
"new",
"nodes... |
9431529cf50fc1176f67bad767a28459a35f5742 | eferm/kedro | kedro/io/transformers.py | [
"Apache-2.0"
] | Python | load | Any | def load(self, data_set_name: str, load: Callable[[], Any]) -> Any:
"""Wrap the loading of a dataset.
Call ``load`` to get the data from the data set / next transformer.
Args:
data_set_name: The name of the data set being loaded.
load: A callback to retrieve the data bei... | Wrap the loading of a dataset.
Call ``load`` to get the data from the data set / next transformer.
Args:
data_set_name: The name of the data set being loaded.
load: A callback to retrieve the data being loaded from the
data set / next transformer.
Return... | Wrap the loading of a dataset.
Call ``load`` to get the data from the data set / next transformer. | [
"Wrap",
"the",
"loading",
"of",
"a",
"dataset",
".",
"Call",
"`",
"`",
"load",
"`",
"`",
"to",
"get",
"the",
"data",
"from",
"the",
"data",
"set",
"/",
"next",
"transformer",
"."
] | def load(self, data_set_name: str, load: Callable[[], Any]) -> Any:
return load() | [
"def",
"load",
"(",
"self",
",",
"data_set_name",
":",
"str",
",",
"load",
":",
"Callable",
"[",
"[",
"]",
",",
"Any",
"]",
")",
"->",
"Any",
":",
"return",
"load",
"(",
")"
] | Wrap the loading of a dataset. | [
"Wrap",
"the",
"loading",
"of",
"a",
"dataset",
"."
] | [
"\"\"\"Wrap the loading of a dataset.\n Call ``load`` to get the data from the data set / next transformer.\n\n Args:\n data_set_name: The name of the data set being loaded.\n load: A callback to retrieve the data being loaded from the\n data set / next transformer... | [
{
"param": "self",
"type": null
},
{
"param": "data_set_name",
"type": "str"
},
{
"param": "load",
"type": "Callable[[], Any]"
}
] | {
"returns": [
{
"docstring": "The loaded data.",
"docstring_tokens": [
"The",
"loaded",
"data",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_toke... |
ca77174f0296b8a95e3772809b8451bb9b34fcd3 | eferm/kedro | tests/template/conftest.py | [
"Apache-2.0"
] | Python | fake_kedro_cli | <not_specific> | def fake_kedro_cli(fake_repo):
"""
A small helper to pass kedro_cli into tests without importing.
It only becomes available after `fake_repo` fixture is applied,
that's why it can't be done on module level.
"""
import kedro_cli # pylint: disable=import-error
return kedro_cli |
A small helper to pass kedro_cli into tests without importing.
It only becomes available after `fake_repo` fixture is applied,
that's why it can't be done on module level.
| A small helper to pass kedro_cli into tests without importing.
It only becomes available after `fake_repo` fixture is applied,
that's why it can't be done on module level. | [
"A",
"small",
"helper",
"to",
"pass",
"kedro_cli",
"into",
"tests",
"without",
"importing",
".",
"It",
"only",
"becomes",
"available",
"after",
"`",
"fake_repo",
"`",
"fixture",
"is",
"applied",
"that",
"'",
"s",
"why",
"it",
"can",
"'",
"t",
"be",
"done... | def fake_kedro_cli(fake_repo):
import kedro_cli
return kedro_cli | [
"def",
"fake_kedro_cli",
"(",
"fake_repo",
")",
":",
"import",
"kedro_cli",
"return",
"kedro_cli"
] | A small helper to pass kedro_cli into tests without importing. | [
"A",
"small",
"helper",
"to",
"pass",
"kedro_cli",
"into",
"tests",
"without",
"importing",
"."
] | [
"\"\"\"\n A small helper to pass kedro_cli into tests without importing.\n It only becomes available after `fake_repo` fixture is applied,\n that's why it can't be done on module level.\n \"\"\"",
"# pylint: disable=import-error"
] | [
{
"param": "fake_repo",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fake_repo",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9f3a7ff1503a8e6df51bc5c0aea11724672b52 | eferm/kedro | kedro/io/core.py | [
"Apache-2.0"
] | Python | parse_dataset_definition | Tuple[Type[AbstractDataSet], Dict[str, Any]] | def parse_dataset_definition(
config: Dict[str, Any], load_version: str = None, save_version: str = None
) -> Tuple[Type[AbstractDataSet], Dict[str, Any]]:
"""Parse and instantiate a dataset class using the configuration provided.
Args:
config: Data set config dictionary. It *must* contain the `typ... | Parse and instantiate a dataset class using the configuration provided.
Args:
config: Data set config dictionary. It *must* contain the `type` key
with fully qualified class name.
load_version: Version string to be used for ``load`` operation if
the data set is versioned... | Parse and instantiate a dataset class using the configuration provided. | [
"Parse",
"and",
"instantiate",
"a",
"dataset",
"class",
"using",
"the",
"configuration",
"provided",
"."
] | def parse_dataset_definition(
config: Dict[str, Any], load_version: str = None, save_version: str = None
) -> Tuple[Type[AbstractDataSet], Dict[str, Any]]:
save_version = save_version or generate_timestamp()
config = copy.deepcopy(config)
if "type" not in config:
raise DataSetError("`type` is mi... | [
"def",
"parse_dataset_definition",
"(",
"config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"load_version",
":",
"str",
"=",
"None",
",",
"save_version",
":",
"str",
"=",
"None",
")",
"->",
"Tuple",
"[",
"Type",
"[",
"AbstractDataSet",
"]",
",",
"... | Parse and instantiate a dataset class using the configuration provided. | [
"Parse",
"and",
"instantiate",
"a",
"dataset",
"class",
"using",
"the",
"configuration",
"provided",
"."
] | [
"\"\"\"Parse and instantiate a dataset class using the configuration provided.\n\n Args:\n config: Data set config dictionary. It *must* contain the `type` key\n with fully qualified class name.\n load_version: Version string to be used for ``load`` operation if\n the data... | [
{
"param": "config",
"type": "Dict[str, Any]"
},
{
"param": "load_version",
"type": "str"
},
{
"param": "save_version",
"type": "str"
}
] | {
"returns": [
{
"docstring": "(Dataset class object, configuration dictionary)",
"docstring_tokens": [
"(",
"Dataset",
"class",
"object",
"configuration",
"dictionary",
")"
],
"type": "2-tuple"
}
],
"raises": [
{
"d... |
6a9f3a7ff1503a8e6df51bc5c0aea11724672b52 | eferm/kedro | kedro/io/core.py | [
"Apache-2.0"
] | Python | exists | bool | def exists(self) -> bool:
"""Checks whether a data set's output already exists by calling
the provided _exists() method.
Returns:
Flag indicating whether the output already exists.
Raises:
DataSetError: when underlying exists method raises error.
"""
... | Checks whether a data set's output already exists by calling
the provided _exists() method.
Returns:
Flag indicating whether the output already exists.
Raises:
DataSetError: when underlying exists method raises error.
| Checks whether a data set's output already exists by calling
the provided _exists() method. | [
"Checks",
"whether",
"a",
"data",
"set",
"'",
"s",
"output",
"already",
"exists",
"by",
"calling",
"the",
"provided",
"_exists",
"()",
"method",
"."
] | def exists(self) -> bool:
self._logger.debug("Checking whether target of %s exists", str(self))
try:
return self._exists()
except VersionNotFoundError:
return False
except Exception as exc:
message = "Failed during exists check for data set {}.\n{}".... | [
"def",
"exists",
"(",
"self",
")",
"->",
"bool",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Checking whether target of %s exists\"",
",",
"str",
"(",
"self",
")",
")",
"try",
":",
"return",
"self",
".",
"_exists",
"(",
")",
"except",
"VersionNotFou... | Checks whether a data set's output already exists by calling
the provided _exists() method. | [
"Checks",
"whether",
"a",
"data",
"set",
"'",
"s",
"output",
"already",
"exists",
"by",
"calling",
"the",
"provided",
"_exists",
"()",
"method",
"."
] | [
"\"\"\"Checks whether a data set's output already exists by calling\n the provided _exists() method.\n\n Returns:\n Flag indicating whether the output already exists.\n\n Raises:\n DataSetError: when underlying exists method raises error.\n\n \"\"\"",
"# SKIP_IF_N... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Flag indicating whether the output already exists.",
"docstring_tokens": [
"Flag",
"indicating",
"whether",
"the",
"output",
"already",
"exists",
"."
],
"type": null
}
],
"raises": [
... |
6a9f3a7ff1503a8e6df51bc5c0aea11724672b52 | eferm/kedro | kedro/io/core.py | [
"Apache-2.0"
] | Python | _parse_filepath | Dict[str, str] | def _parse_filepath(filepath: str) -> Dict[str, str]:
"""Split filepath on protocol and path. Based on `fsspec.utils.infer_storage_options`.
Args:
filepath: Either local absolute file path or URL (s3://bucket/file.csv)
Returns:
Parsed filepath.
"""
if (
re.match(r"^[a-zA-Z]... | Split filepath on protocol and path. Based on `fsspec.utils.infer_storage_options`.
Args:
filepath: Either local absolute file path or URL (s3://bucket/file.csv)
Returns:
Parsed filepath.
| Split filepath on protocol and path. | [
"Split",
"filepath",
"on",
"protocol",
"and",
"path",
"."
] | def _parse_filepath(filepath: str) -> Dict[str, str]:
if (
re.match(r"^[a-zA-Z]:[\\/]", filepath)
or re.match(r"^[a-zA-Z0-9]+://", filepath) is None
):
return {"protocol": "file", "path": filepath}
parsed_path = urlsplit(filepath)
protocol = parsed_path.scheme or "file"
if pr... | [
"def",
"_parse_filepath",
"(",
"filepath",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"if",
"(",
"re",
".",
"match",
"(",
"r\"^[a-zA-Z]:[\\\\/]\"",
",",
"filepath",
")",
"or",
"re",
".",
"match",
"(",
"r\"^[a-zA-Z0-9]+://\"",
",",
... | Split filepath on protocol and path. | [
"Split",
"filepath",
"on",
"protocol",
"and",
"path",
"."
] | [
"\"\"\"Split filepath on protocol and path. Based on `fsspec.utils.infer_storage_options`.\n\n Args:\n filepath: Either local absolute file path or URL (s3://bucket/file.csv)\n\n Returns:\n Parsed filepath.\n \"\"\""
] | [
{
"param": "filepath",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filepath",
"type": "str",
"docstring": "Either local absolute file path or URL (s3://bucket/file.csv)",
"docstring_... |
6a9f3a7ff1503a8e6df51bc5c0aea11724672b52 | eferm/kedro | kedro/io/core.py | [
"Apache-2.0"
] | Python | validate_on_forbidden_chars | null | def validate_on_forbidden_chars(**kwargs):
"""Validate that string values do not include white-spaces or ;"""
for key, value in kwargs.items():
if " " in value or ";" in value:
raise DataSetError(
"Neither white-space nor semicolon are allowed in `{}`.".format(key)
... | Validate that string values do not include white-spaces or ; | Validate that string values do not include white-spaces or . | [
"Validate",
"that",
"string",
"values",
"do",
"not",
"include",
"white",
"-",
"spaces",
"or",
"."
] | def validate_on_forbidden_chars(**kwargs):
for key, value in kwargs.items():
if " " in value or ";" in value:
raise DataSetError(
"Neither white-space nor semicolon are allowed in `{}`.".format(key)
) | [
"def",
"validate_on_forbidden_chars",
"(",
"**",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"\" \"",
"in",
"value",
"or",
"\";\"",
"in",
"value",
":",
"raise",
"DataSetError",
"(",
"\"Neither white-sp... | Validate that string values do not include white-spaces or ; | [
"Validate",
"that",
"string",
"values",
"do",
"not",
"include",
"white",
"-",
"spaces",
"or",
";"
] | [
"\"\"\"Validate that string values do not include white-spaces or ;\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
00376d9309f0a8fc67aba4a8d0365c7fa96133ce | eferm/kedro | kedro/config/config.py | [
"Apache-2.0"
] | Python | _load_config | Dict[str, Any] | def _load_config(config_files: List[Path]) -> Dict[str, Any]:
"""Recursively load all configuration files, which satisfy
a given list of glob patterns from a specific path.
Args:
config_files: Configuration files sorted in the order of precedence.
Raises:
ValueError: If 2 or more confi... | Recursively load all configuration files, which satisfy
a given list of glob patterns from a specific path.
Args:
config_files: Configuration files sorted in the order of precedence.
Raises:
ValueError: If 2 or more configuration files contain the same key(s).
Returns:
Resulti... | Recursively load all configuration files, which satisfy
a given list of glob patterns from a specific path. | [
"Recursively",
"load",
"all",
"configuration",
"files",
"which",
"satisfy",
"a",
"given",
"list",
"of",
"glob",
"patterns",
"from",
"a",
"specific",
"path",
"."
] | def _load_config(config_files: List[Path]) -> Dict[str, Any]:
import anyconfig
config = {}
keys_by_filepath = {}
def _check_dups(file1: Path, conf: Dict[str, Any]) -> None:
dups = set()
for file2, keys in keys_by_filepath.items():
common = ", ".join(sorted(conf.keys() & k... | [
"def",
"_load_config",
"(",
"config_files",
":",
"List",
"[",
"Path",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"import",
"anyconfig",
"config",
"=",
"{",
"}",
"keys_by_filepath",
"=",
"{",
"}",
"def",
"_check_dups",
"(",
"file1",
":",
... | Recursively load all configuration files, which satisfy
a given list of glob patterns from a specific path. | [
"Recursively",
"load",
"all",
"configuration",
"files",
"which",
"satisfy",
"a",
"given",
"list",
"of",
"glob",
"patterns",
"from",
"a",
"specific",
"path",
"."
] | [
"\"\"\"Recursively load all configuration files, which satisfy\n a given list of glob patterns from a specific path.\n\n Args:\n config_files: Configuration files sorted in the order of precedence.\n\n Raises:\n ValueError: If 2 or more configuration files contain the same key(s).\n\n Retu... | [
{
"param": "config_files",
"type": "List[Path]"
}
] | {
"returns": [
{
"docstring": "Resulting configuration dictionary.",
"docstring_tokens": [
"Resulting",
"configuration",
"dictionary",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "If 2 or more configuration files contain the same ke... |
00376d9309f0a8fc67aba4a8d0365c7fa96133ce | eferm/kedro | kedro/config/config.py | [
"Apache-2.0"
] | Python | _path_lookup | List[Path] | def _path_lookup(conf_path: Path, patterns: Iterable[str]) -> List[Path]:
"""Return a sorted list of all configuration files from ``conf_path`` or
its subdirectories, which satisfy a given list of glob patterns.
Args:
conf_path: Path to configuration directory.
patterns: List of glob patter... | Return a sorted list of all configuration files from ``conf_path`` or
its subdirectories, which satisfy a given list of glob patterns.
Args:
conf_path: Path to configuration directory.
patterns: List of glob patterns to match the filenames against.
Returns:
Sorted list of ``Path`` ... | Return a sorted list of all configuration files from ``conf_path`` or
its subdirectories, which satisfy a given list of glob patterns. | [
"Return",
"a",
"sorted",
"list",
"of",
"all",
"configuration",
"files",
"from",
"`",
"`",
"conf_path",
"`",
"`",
"or",
"its",
"subdirectories",
"which",
"satisfy",
"a",
"given",
"list",
"of",
"glob",
"patterns",
"."
] | def _path_lookup(conf_path: Path, patterns: Iterable[str]) -> List[Path]:
config_files = set()
conf_path = conf_path.resolve()
for pattern in patterns:
for each in iglob(str(conf_path / pattern), recursive=True):
path = Path(each).resolve()
if path.is_file() and path.suffix i... | [
"def",
"_path_lookup",
"(",
"conf_path",
":",
"Path",
",",
"patterns",
":",
"Iterable",
"[",
"str",
"]",
")",
"->",
"List",
"[",
"Path",
"]",
":",
"config_files",
"=",
"set",
"(",
")",
"conf_path",
"=",
"conf_path",
".",
"resolve",
"(",
")",
"for",
"... | Return a sorted list of all configuration files from ``conf_path`` or
its subdirectories, which satisfy a given list of glob patterns. | [
"Return",
"a",
"sorted",
"list",
"of",
"all",
"configuration",
"files",
"from",
"`",
"`",
"conf_path",
"`",
"`",
"or",
"its",
"subdirectories",
"which",
"satisfy",
"a",
"given",
"list",
"of",
"glob",
"patterns",
"."
] | [
"\"\"\"Return a sorted list of all configuration files from ``conf_path`` or\n its subdirectories, which satisfy a given list of glob patterns.\n\n Args:\n conf_path: Path to configuration directory.\n patterns: List of glob patterns to match the filenames against.\n\n Returns:\n Sorte... | [
{
"param": "conf_path",
"type": "Path"
},
{
"param": "patterns",
"type": "Iterable[str]"
}
] | {
"returns": [
{
"docstring": "Sorted list of ``Path`` objects representing configuration files.",
"docstring_tokens": [
"Sorted",
"list",
"of",
"`",
"`",
"Path",
"`",
"`",
"objects",
"representing",
"configuration... |
00376d9309f0a8fc67aba4a8d0365c7fa96133ce | eferm/kedro | kedro/config/config.py | [
"Apache-2.0"
] | Python | _remove_duplicates | <not_specific> | def _remove_duplicates(items: Iterable[str]):
"""Remove duplicates while preserving the order."""
unique_items = [] # type: List[str]
for item in items:
if item not in unique_items:
unique_items.append(item)
else:
warn(
"Duplicate environment detected... | Remove duplicates while preserving the order. | Remove duplicates while preserving the order. | [
"Remove",
"duplicates",
"while",
"preserving",
"the",
"order",
"."
] | def _remove_duplicates(items: Iterable[str]):
unique_items = []
for item in items:
if item not in unique_items:
unique_items.append(item)
else:
warn(
"Duplicate environment detected! "
"Skipping re-loading from configuration path: {}".for... | [
"def",
"_remove_duplicates",
"(",
"items",
":",
"Iterable",
"[",
"str",
"]",
")",
":",
"unique_items",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"if",
"item",
"not",
"in",
"unique_items",
":",
"unique_items",
".",
"append",
"(",
"item",
")",
"e... | Remove duplicates while preserving the order. | [
"Remove",
"duplicates",
"while",
"preserving",
"the",
"order",
"."
] | [
"\"\"\"Remove duplicates while preserving the order.\"\"\"",
"# type: List[str]"
] | [
{
"param": "items",
"type": "Iterable[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "items",
"type": "Iterable[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73421beb3d68623748935bd8b787da214e0af150 | eerovaher/astroquery | astroquery/xmatch/core.py | [
"BSD-3-Clause"
] | Python | query | <not_specific> | def query(self, cat1, cat2, max_distance,
colRA1=None, colDec1=None, colRA2=None, colDec2=None,
area='allsky', cache=True, get_query_payload=False, **kwargs):
"""
Query the `CDS cross-match service
<http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between
... |
Query the `CDS cross-match service
<http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between
two (potentially big) catalogues.
Parameters
----------
cat1 : str, file or `~astropy.table.Table`
Identifier of the first table. It can either be a URL, t... | Query the `CDS cross-match service
`_ by finding matches between
two (potentially big) catalogues.
Parameters
cat1 : str, file or `~astropy.table.Table`
Identifier of the first table. It can either be a URL, the
payload of a local file being uploaded, a CDS table
identifier (either *simbad* for a view of SIMBAD data ... | [
"Query",
"the",
"`",
"CDS",
"cross",
"-",
"match",
"service",
"`",
"_",
"by",
"finding",
"matches",
"between",
"two",
"(",
"potentially",
"big",
")",
"catalogues",
".",
"Parameters",
"cat1",
":",
"str",
"file",
"or",
"`",
"~astropy",
".",
"table",
".",
... | def query(self, cat1, cat2, max_distance,
colRA1=None, colDec1=None, colRA2=None, colDec2=None,
area='allsky', cache=True, get_query_payload=False, **kwargs):
response = self.query_async(cat1, cat2, max_distance, colRA1, colDec1,
colRA2, colDec2, a... | [
"def",
"query",
"(",
"self",
",",
"cat1",
",",
"cat2",
",",
"max_distance",
",",
"colRA1",
"=",
"None",
",",
"colDec1",
"=",
"None",
",",
"colRA2",
"=",
"None",
",",
"colDec2",
"=",
"None",
",",
"area",
"=",
"'allsky'",
",",
"cache",
"=",
"True",
"... | Query the `CDS cross-match service
<http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between
two (potentially big) catalogues. | [
"Query",
"the",
"`",
"CDS",
"cross",
"-",
"match",
"service",
"<http",
":",
"//",
"cdsxmatch",
".",
"u",
"-",
"strasbg",
".",
"fr",
"/",
"xmatch",
">",
"`",
"_",
"by",
"finding",
"matches",
"between",
"two",
"(",
"potentially",
"big",
")",
"catalogues"... | [
"\"\"\"\n Query the `CDS cross-match service\n <http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between\n two (potentially big) catalogues.\n\n Parameters\n ----------\n cat1 : str, file or `~astropy.table.Table`\n Identifier of the first table. It can... | [
{
"param": "self",
"type": null
},
{
"param": "cat1",
"type": null
},
{
"param": "cat2",
"type": null
},
{
"param": "max_distance",
"type": null
},
{
"param": "colRA1",
"type": null
},
{
"param": "colDec1",
"type": null
},
{
"param": "colRA... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cat1",
"type": null,
"docstring": null,
"docstring_tokens": [... |
73421beb3d68623748935bd8b787da214e0af150 | eerovaher/astroquery | astroquery/xmatch/core.py | [
"BSD-3-Clause"
] | Python | _prepare_area | null | def _prepare_area(self, payload, area):
'''Set the area parameter in the payload'''
if area is None or area == 'allsky':
payload['area'] = 'allsky'
elif isinstance(area, CircleSkyRegion):
payload['area'] = 'cone'
cone_center = area.center
payload['... | Set the area parameter in the payload | Set the area parameter in the payload | [
"Set",
"the",
"area",
"parameter",
"in",
"the",
"payload"
] | def _prepare_area(self, payload, area):
if area is None or area == 'allsky':
payload['area'] = 'allsky'
elif isinstance(area, CircleSkyRegion):
payload['area'] = 'cone'
cone_center = area.center
payload['coneRA'] = cone_center.icrs.ra.deg
paylo... | [
"def",
"_prepare_area",
"(",
"self",
",",
"payload",
",",
"area",
")",
":",
"if",
"area",
"is",
"None",
"or",
"area",
"==",
"'allsky'",
":",
"payload",
"[",
"'area'",
"]",
"=",
"'allsky'",
"elif",
"isinstance",
"(",
"area",
",",
"CircleSkyRegion",
")",
... | Set the area parameter in the payload | [
"Set",
"the",
"area",
"parameter",
"in",
"the",
"payload"
] | [
"'''Set the area parameter in the payload'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "payload",
"type": null
},
{
"param": "area",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "payload",
"type": null,
"docstring": null,
"docstring_tokens"... |
73421beb3d68623748935bd8b787da214e0af150 | eerovaher/astroquery | astroquery/xmatch/core.py | [
"BSD-3-Clause"
] | Python | is_table_available | <not_specific> | def is_table_available(self, table_id):
"""Return True if the passed CDS table identifier is one of the
available VizieR tables, otherwise False.
"""
# table_id can actually be a Table instance, there is no point in
# comparing those to stings
if not isinstance(table_id... | Return True if the passed CDS table identifier is one of the
available VizieR tables, otherwise False.
| Return True if the passed CDS table identifier is one of the
available VizieR tables, otherwise False. | [
"Return",
"True",
"if",
"the",
"passed",
"CDS",
"table",
"identifier",
"is",
"one",
"of",
"the",
"available",
"VizieR",
"tables",
"otherwise",
"False",
"."
] | def is_table_available(self, table_id):
if not isinstance(table_id, str):
return False
if (table_id[:7] == 'vizier:'):
table_id = table_id[7:]
return table_id in self.get_available_tables() | [
"def",
"is_table_available",
"(",
"self",
",",
"table_id",
")",
":",
"if",
"not",
"isinstance",
"(",
"table_id",
",",
"str",
")",
":",
"return",
"False",
"if",
"(",
"table_id",
"[",
":",
"7",
"]",
"==",
"'vizier:'",
")",
":",
"table_id",
"=",
"table_id... | Return True if the passed CDS table identifier is one of the
available VizieR tables, otherwise False. | [
"Return",
"True",
"if",
"the",
"passed",
"CDS",
"table",
"identifier",
"is",
"one",
"of",
"the",
"available",
"VizieR",
"tables",
"otherwise",
"False",
"."
] | [
"\"\"\"Return True if the passed CDS table identifier is one of the\n available VizieR tables, otherwise False.\n\n \"\"\"",
"# table_id can actually be a Table instance, there is no point in",
"# comparing those to stings"
] | [
{
"param": "self",
"type": null
},
{
"param": "table_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "table_id",
"type": null,
"docstring": null,
"docstring_tokens... |
73421beb3d68623748935bd8b787da214e0af150 | eerovaher/astroquery | astroquery/xmatch/core.py | [
"BSD-3-Clause"
] | Python | _parse_text | <not_specific> | def _parse_text(self, text):
"""
Parse a CSV text file that has potentially duplicated header names
"""
header = text.split("\n")[0]
colnames = header.split(",")
for column in colnames:
if colnames.count(column) > 1:
counter = 1
... |
Parse a CSV text file that has potentially duplicated header names
| Parse a CSV text file that has potentially duplicated header names | [
"Parse",
"a",
"CSV",
"text",
"file",
"that",
"has",
"potentially",
"duplicated",
"header",
"names"
] | def _parse_text(self, text):
header = text.split("\n")[0]
colnames = header.split(",")
for column in colnames:
if colnames.count(column) > 1:
counter = 1
while colnames.count(column) > 0:
colnames[colnames.index(column)] = column + ... | [
"def",
"_parse_text",
"(",
"self",
",",
"text",
")",
":",
"header",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"[",
"0",
"]",
"colnames",
"=",
"header",
".",
"split",
"(",
"\",\"",
")",
"for",
"column",
"in",
"colnames",
":",
"if",
"colnames",
... | Parse a CSV text file that has potentially duplicated header names | [
"Parse",
"a",
"CSV",
"text",
"file",
"that",
"has",
"potentially",
"duplicated",
"header",
"names"
] | [
"\"\"\"\n Parse a CSV text file that has potentially duplicated header names\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [... |
7f6163d78d6ea1bab285a2a4c6d2e872a3dbab4d | eerovaher/astroquery | astroquery/utils/url_helpers.py | [
"BSD-3-Clause"
] | Python | urljoin_keep_path | <not_specific> | def urljoin_keep_path(url, path):
"""Join a base URL and a relative or absolute path. The important
difference to :func:`urlparse.urljoin` (or
:func:`urllib.parse.urljoin` on Python 3) is that `urljoin_keep_path`
does not remove the last directory of the path found in the parameter
`url` if it is in... | Join a base URL and a relative or absolute path. The important
difference to :func:`urlparse.urljoin` (or
:func:`urllib.parse.urljoin` on Python 3) is that `urljoin_keep_path`
does not remove the last directory of the path found in the parameter
`url` if it is in relative form. Compare the examples belo... | Join a base URL and a relative or absolute path. The important
difference to :func:`urlparse.urljoin` (or | [
"Join",
"a",
"base",
"URL",
"and",
"a",
"relative",
"or",
"absolute",
"path",
".",
"The",
"important",
"difference",
"to",
":",
"func",
":",
"`",
"urlparse",
".",
"urljoin",
"`",
"(",
"or"
] | def urljoin_keep_path(url, path):
splitted_url = urlsplit(url)
return SplitResult(splitted_url.scheme,
splitted_url.netloc,
join(splitted_url.path, path),
splitted_url.query,
splitted_url.fragment).geturl() | [
"def",
"urljoin_keep_path",
"(",
"url",
",",
"path",
")",
":",
"splitted_url",
"=",
"urlsplit",
"(",
"url",
")",
"return",
"SplitResult",
"(",
"splitted_url",
".",
"scheme",
",",
"splitted_url",
".",
"netloc",
",",
"join",
"(",
"splitted_url",
".",
"path",
... | Join a base URL and a relative or absolute path. | [
"Join",
"a",
"base",
"URL",
"and",
"a",
"relative",
"or",
"absolute",
"path",
"."
] | [
"\"\"\"Join a base URL and a relative or absolute path. The important\n difference to :func:`urlparse.urljoin` (or\n :func:`urllib.parse.urljoin` on Python 3) is that `urljoin_keep_path`\n does not remove the last directory of the path found in the parameter\n `url` if it is in relative form. Compare th... | [
{
"param": "url",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": []... |
dd32b411f6cf6ad9be2c6467eaf891f5b8a02490 | eerovaher/astroquery | astroquery/mast/cutouts.py | [
"BSD-3-Clause"
] | Python | download_cutouts | <not_specific> | def download_cutouts(self, *, coordinates=None, size=5, sector=None, path=".", inflate=True,
objectname=None, moving_target=False, mt_type=None):
"""
Download cutout target pixel file(s) around the given coordinates with indicated size.
Parameters
----------
... |
Download cutout target pixel file(s) around the given coordinates with indicated size.
Parameters
----------
coordinates : str or `astropy.coordinates` object, optional
The target around which to search. It may be specified as a
string or as the appropriate `ast... | Download cutout target pixel file(s) around the given coordinates with indicated size.
Parameters
coordinates : str or `astropy.coordinates` object, optional
The target around which to search. It may be specified as a
string or as the appropriate `astropy.coordinates` object.
If moving_target or objectname is supplie... | [
"Download",
"cutout",
"target",
"pixel",
"file",
"(",
"s",
")",
"around",
"the",
"given",
"coordinates",
"with",
"indicated",
"size",
".",
"Parameters",
"coordinates",
":",
"str",
"or",
"`",
"astropy",
".",
"coordinates",
"`",
"object",
"optional",
"The",
"t... | def download_cutouts(self, *, coordinates=None, size=5, sector=None, path=".", inflate=True,
objectname=None, moving_target=False, mt_type=None):
if moving_target:
if coordinates:
raise InvalidQueryError("Only one of moving_target and coordinates may be speci... | [
"def",
"download_cutouts",
"(",
"self",
",",
"*",
",",
"coordinates",
"=",
"None",
",",
"size",
"=",
"5",
",",
"sector",
"=",
"None",
",",
"path",
"=",
"\".\"",
",",
"inflate",
"=",
"True",
",",
"objectname",
"=",
"None",
",",
"moving_target",
"=",
"... | Download cutout target pixel file(s) around the given coordinates with indicated size. | [
"Download",
"cutout",
"target",
"pixel",
"file",
"(",
"s",
")",
"around",
"the",
"given",
"coordinates",
"with",
"indicated",
"size",
"."
] | [
"\"\"\"\n Download cutout target pixel file(s) around the given coordinates with indicated size.\n\n Parameters\n ----------\n coordinates : str or `astropy.coordinates` object, optional\n The target around which to search. It may be specified as a\n string or as th... | [
{
"param": "self",
"type": null
},
{
"param": "coordinates",
"type": null
},
{
"param": "size",
"type": null
},
{
"param": "sector",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "inflate",
"type": null
},
{
"param": "object... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinates",
"type": null,
"docstring": null,
"docstring_tok... |
3dcfa2284926c826d93cbd508985fe11d95b88b8 | eerovaher/astroquery | astroquery/vamdc/core.py | [
"BSD-3-Clause"
] | Python | species_lookuptable | <not_specific> | def species_lookuptable(self, cache=True):
"""
As a property, you can't turn off caching....
"""
if not hasattr(self, '_lut'):
self._lut = species_lookuptable(cache=cache)
return self._lut |
As a property, you can't turn off caching....
| As a property, you can't turn off caching | [
"As",
"a",
"property",
"you",
"can",
"'",
"t",
"turn",
"off",
"caching"
] | def species_lookuptable(self, cache=True):
if not hasattr(self, '_lut'):
self._lut = species_lookuptable(cache=cache)
return self._lut | [
"def",
"species_lookuptable",
"(",
"self",
",",
"cache",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_lut'",
")",
":",
"self",
".",
"_lut",
"=",
"species_lookuptable",
"(",
"cache",
"=",
"cache",
")",
"return",
"self",
".",
"_lut... | As a property, you can't turn off caching.... | [
"As",
"a",
"property",
"you",
"can",
"'",
"t",
"turn",
"off",
"caching",
"...."
] | [
"\"\"\"\n As a property, you can't turn off caching....\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cache",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cache",
"type": null,
"docstring": null,
"docstring_tokens": ... |
3dcfa2284926c826d93cbd508985fe11d95b88b8 | eerovaher/astroquery | astroquery/vamdc/core.py | [
"BSD-3-Clause"
] | Python | query_molecule | <not_specific> | def query_molecule(self, molecule_name, chem_re_flags=0, cache=True):
"""
Query for the VAMDC data for a specific molecule
Parameters
----------
molecule_name: str
The common name (including unicode characters) or the ordinary
molecular formula (e.g., CH3... |
Query for the VAMDC data for a specific molecule
Parameters
----------
molecule_name: str
The common name (including unicode characters) or the ordinary
molecular formula (e.g., CH3OH for Methanol) of the molecule.
chem_re_flags: int
The re (... | Query for the VAMDC data for a specific molecule
Parameters
str
The common name (including unicode characters) or the ordinary
molecular formula of the molecule.
chem_re_flags: int
The re (regular expression) flags for comparison of the molecule
name with the lookuptable keys
cache: bool
Use the astroquery cache to s... | [
"Query",
"for",
"the",
"VAMDC",
"data",
"for",
"a",
"specific",
"molecule",
"Parameters",
"str",
"The",
"common",
"name",
"(",
"including",
"unicode",
"characters",
")",
"or",
"the",
"ordinary",
"molecular",
"formula",
"of",
"the",
"molecule",
".",
"chem_re_fl... | def query_molecule(self, molecule_name, chem_re_flags=0, cache=True):
myhash = "{0}_re{1}".format(molecule_name, chem_re_flags)
myhashpath = os.path.join(self.CACHE_LOCATION,
myhash)
if os.path.exists(myhashpath) and cache:
with open(myhashpath, 'rb'... | [
"def",
"query_molecule",
"(",
"self",
",",
"molecule_name",
",",
"chem_re_flags",
"=",
"0",
",",
"cache",
"=",
"True",
")",
":",
"myhash",
"=",
"\"{0}_re{1}\"",
".",
"format",
"(",
"molecule_name",
",",
"chem_re_flags",
")",
"myhashpath",
"=",
"os",
".",
"... | Query for the VAMDC data for a specific molecule
Parameters | [
"Query",
"for",
"the",
"VAMDC",
"data",
"for",
"a",
"specific",
"molecule",
"Parameters"
] | [
"\"\"\"\n Query for the VAMDC data for a specific molecule\n\n Parameters\n ----------\n molecule_name: str\n The common name (including unicode characters) or the ordinary\n molecular formula (e.g., CH3OH for Methanol) of the molecule.\n chem_re_flags: int\n... | [
{
"param": "self",
"type": null
},
{
"param": "molecule_name",
"type": null
},
{
"param": "chem_re_flags",
"type": null
},
{
"param": "cache",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "molecule_name",
"type": null,
"docstring": null,
"docstring_t... |
b04830dda8e9b39efac46ea8d3dbfb08ab7feec3 | eerovaher/astroquery | astroquery/vamdc/load_species_table.py | [
"BSD-3-Clause"
] | Python | species_lookuptable | <not_specific> | def species_lookuptable(cache=True):
"""
Get a lookuptable from chemical name + OrdinaryStructuralFormula to VAMDC
id
"""
if not os.path.exists(Conf.cache_location):
os.makedirs(Conf.cache_location)
lut_path = os.path.join(Conf.cache_location,
'species_looku... |
Get a lookuptable from chemical name + OrdinaryStructuralFormula to VAMDC
id
| Get a lookuptable from chemical name + OrdinaryStructuralFormula to VAMDC
id | [
"Get",
"a",
"lookuptable",
"from",
"chemical",
"name",
"+",
"OrdinaryStructuralFormula",
"to",
"VAMDC",
"id"
] | def species_lookuptable(cache=True):
if not os.path.exists(Conf.cache_location):
os.makedirs(Conf.cache_location)
lut_path = os.path.join(Conf.cache_location,
'species_lookuptable.json')
if os.path.exists(lut_path) and cache:
log.info("Loading cached molecular lin... | [
"def",
"species_lookuptable",
"(",
"cache",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"Conf",
".",
"cache_location",
")",
":",
"os",
".",
"makedirs",
"(",
"Conf",
".",
"cache_location",
")",
"lut_path",
"=",
"os",
".",
... | Get a lookuptable from chemical name + OrdinaryStructuralFormula to VAMDC
id | [
"Get",
"a",
"lookuptable",
"from",
"chemical",
"name",
"+",
"OrdinaryStructuralFormula",
"to",
"VAMDC",
"id"
] | [
"\"\"\"\n Get a lookuptable from chemical name + OrdinaryStructuralFormula to VAMDC\n id\n \"\"\"",
"# Retrieve all species from CDMS"
] | [
{
"param": "cache",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0f1b3bef1e21fc982ac28e48b9047c284a8ea310 | eerovaher/astroquery | astroquery/mast/core.py | [
"BSD-3-Clause"
] | Python | _login | <not_specific> | def _login(self, token=None, store_token=False, reenter_token=False):
"""
Log into the MAST portal.
Parameters
----------
token : string, optional
Default is None.
The token to authenticate the user.
This can be generated at
https:... |
Log into the MAST portal.
Parameters
----------
token : string, optional
Default is None.
The token to authenticate the user.
This can be generated at
https://auth.mast.stsci.edu/token?suggested_name=Astroquery&suggested_scope=mast:exclus... | Log into the MAST portal.
Parameters
token : string, optional
Default is None.
The token to authenticate the user. | [
"Log",
"into",
"the",
"MAST",
"portal",
".",
"Parameters",
"token",
":",
"string",
"optional",
"Default",
"is",
"None",
".",
"The",
"token",
"to",
"authenticate",
"the",
"user",
"."
] | def _login(self, token=None, store_token=False, reenter_token=False):
return self._auth_obj.login(token, store_token, reenter_token) | [
"def",
"_login",
"(",
"self",
",",
"token",
"=",
"None",
",",
"store_token",
"=",
"False",
",",
"reenter_token",
"=",
"False",
")",
":",
"return",
"self",
".",
"_auth_obj",
".",
"login",
"(",
"token",
",",
"store_token",
",",
"reenter_token",
")"
] | Log into the MAST portal. | [
"Log",
"into",
"the",
"MAST",
"portal",
"."
] | [
"\"\"\"\n Log into the MAST portal.\n\n Parameters\n ----------\n token : string, optional\n Default is None.\n The token to authenticate the user.\n This can be generated at\n https://auth.mast.stsci.edu/token?suggested_name=Astroquery&suggest... | [
{
"param": "self",
"type": null
},
{
"param": "token",
"type": null
},
{
"param": "store_token",
"type": null
},
{
"param": "reenter_token",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "token",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0f1b3bef1e21fc982ac28e48b9047c284a8ea310 | eerovaher/astroquery | astroquery/mast/core.py | [
"BSD-3-Clause"
] | Python | logout | null | def logout(self):
"""
Log out of current MAST session.
"""
self._auth_obj.logout()
self._authenticated = False |
Log out of current MAST session.
| Log out of current MAST session. | [
"Log",
"out",
"of",
"current",
"MAST",
"session",
"."
] | def logout(self):
self._auth_obj.logout()
self._authenticated = False | [
"def",
"logout",
"(",
"self",
")",
":",
"self",
".",
"_auth_obj",
".",
"logout",
"(",
")",
"self",
".",
"_authenticated",
"=",
"False"
] | Log out of current MAST session. | [
"Log",
"out",
"of",
"current",
"MAST",
"session",
"."
] | [
"\"\"\"\n Log out of current MAST session.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0f1b3bef1e21fc982ac28e48b9047c284a8ea310 | eerovaher/astroquery | astroquery/mast/core.py | [
"BSD-3-Clause"
] | Python | enable_cloud_dataset | null | def enable_cloud_dataset(self, provider="AWS", profile=None, verbose=True):
"""
Enable downloading public files from S3 instead of MAST.
Requires the boto3 library to function.
Parameters
----------
provider : str
Which cloud data provider to use. We may in ... |
Enable downloading public files from S3 instead of MAST.
Requires the boto3 library to function.
Parameters
----------
provider : str
Which cloud data provider to use. We may in the future support multiple providers,
though at the moment this argument i... | Enable downloading public files from S3 instead of MAST.
Requires the boto3 library to function.
Parameters
provider : str
Which cloud data provider to use. We may in the future support multiple providers,
though at the moment this argument is ignored.
profile : str
Profile to use to identify yourself to the cloud p... | [
"Enable",
"downloading",
"public",
"files",
"from",
"S3",
"instead",
"of",
"MAST",
".",
"Requires",
"the",
"boto3",
"library",
"to",
"function",
".",
"Parameters",
"provider",
":",
"str",
"Which",
"cloud",
"data",
"provider",
"to",
"use",
".",
"We",
"may",
... | def enable_cloud_dataset(self, provider="AWS", profile=None, verbose=True):
self._cloud_connection = CloudAccess(provider, profile, verbose) | [
"def",
"enable_cloud_dataset",
"(",
"self",
",",
"provider",
"=",
"\"AWS\"",
",",
"profile",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"self",
".",
"_cloud_connection",
"=",
"CloudAccess",
"(",
"provider",
",",
"profile",
",",
"verbose",
")"
] | Enable downloading public files from S3 instead of MAST. | [
"Enable",
"downloading",
"public",
"files",
"from",
"S3",
"instead",
"of",
"MAST",
"."
] | [
"\"\"\"\n Enable downloading public files from S3 instead of MAST.\n Requires the boto3 library to function.\n\n Parameters\n ----------\n provider : str\n Which cloud data provider to use. We may in the future support multiple providers,\n though at the mom... | [
{
"param": "self",
"type": null
},
{
"param": "provider",
"type": null
},
{
"param": "profile",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "provider",
"type": null,
"docstring": null,
"docstring_tokens... |
0f1b3bef1e21fc982ac28e48b9047c284a8ea310 | eerovaher/astroquery | astroquery/mast/core.py | [
"BSD-3-Clause"
] | Python | disable_cloud_dataset | null | def disable_cloud_dataset(self):
"""
Disables downloading public files from S3 instead of MAST
"""
self._cloud_connection = None |
Disables downloading public files from S3 instead of MAST
| Disables downloading public files from S3 instead of MAST | [
"Disables",
"downloading",
"public",
"files",
"from",
"S3",
"instead",
"of",
"MAST"
] | def disable_cloud_dataset(self):
self._cloud_connection = None | [
"def",
"disable_cloud_dataset",
"(",
"self",
")",
":",
"self",
".",
"_cloud_connection",
"=",
"None"
] | Disables downloading public files from S3 instead of MAST | [
"Disables",
"downloading",
"public",
"files",
"from",
"S3",
"instead",
"of",
"MAST"
] | [
"\"\"\"\n Disables downloading public files from S3 instead of MAST\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c11f502d3d6408b68a2c6eea93b7b07ff39a52 | eerovaher/astroquery | astroquery/esa/hsa/core.py | [
"BSD-3-Clause"
] | Python | download_data | <not_specific> | def download_data(self, *, retrieval_type="OBSERVATION", observation_id=None,
instrument_name=None, filename=None, observation_oid=None,
instrument_oid=None, product_level=None, verbose=False,
download_dir="", cache=True, **kwargs):
"""
D... |
Download data from Herschel
Parameters
----------
observation_id : string, optional
id of the observation to be downloaded
The identifies of the observation we want to retrieve, 10 digits
example: 1342195355
retrieval_type : string, optional,... | Download data from Herschel
Parameters
Returns
File name of downloaded data | [
"Download",
"data",
"from",
"Herschel",
"Parameters",
"Returns",
"File",
"name",
"of",
"downloaded",
"data"
] | def download_data(self, *, retrieval_type="OBSERVATION", observation_id=None,
instrument_name=None, filename=None, observation_oid=None,
instrument_oid=None, product_level=None, verbose=False,
download_dir="", cache=True, **kwargs):
if filename i... | [
"def",
"download_data",
"(",
"self",
",",
"*",
",",
"retrieval_type",
"=",
"\"OBSERVATION\"",
",",
"observation_id",
"=",
"None",
",",
"instrument_name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"observation_oid",
"=",
"None",
",",
"instrument_oid",
"="... | Download data from Herschel
Parameters | [
"Download",
"data",
"from",
"Herschel",
"Parameters"
] | [
"\"\"\"\n Download data from Herschel\n\n Parameters\n ----------\n observation_id : string, optional\n id of the observation to be downloaded\n The identifies of the observation we want to retrieve, 10 digits\n example: 1342195355\n retrieval_type... | [
{
"param": "self",
"type": null
},
{
"param": "retrieval_type",
"type": null
},
{
"param": "observation_id",
"type": null
},
{
"param": "instrument_name",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "observation_oid",
"type": ... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "retrieval_type",
"type": null,
"docstring": null,
"docstring_... |
79c11f502d3d6408b68a2c6eea93b7b07ff39a52 | eerovaher/astroquery | astroquery/esa/hsa/core.py | [
"BSD-3-Clause"
] | Python | query_hsa_tap | <not_specific> | def query_hsa_tap(self, query, *, output_file=None,
output_format="votable", verbose=False):
"""
Launches a synchronous job to query HSA Tabular Access Protocol (TAP) Service
Parameters
----------
query : string
query (adql) to be executed
... |
Launches a synchronous job to query HSA Tabular Access Protocol (TAP) Service
Parameters
----------
query : string
query (adql) to be executed
output_file : string, optional, default None
file name where the results are saved if dumpToFile is True.
... | Launches a synchronous job to query HSA Tabular Access Protocol (TAP) Service
Parameters
query : string
query (adql) to be executed
output_file : string, optional, default None
file name where the results are saved if dumpToFile is True.
Returns
A table object | [
"Launches",
"a",
"synchronous",
"job",
"to",
"query",
"HSA",
"Tabular",
"Access",
"Protocol",
"(",
"TAP",
")",
"Service",
"Parameters",
"query",
":",
"string",
"query",
"(",
"adql",
")",
"to",
"be",
"executed",
"output_file",
":",
"string",
"optional",
"defa... | def query_hsa_tap(self, query, *, output_file=None,
output_format="votable", verbose=False):
job = self._tap.launch_job(query=query, output_file=output_file,
output_format=output_format,
verbose=verbose,
... | [
"def",
"query_hsa_tap",
"(",
"self",
",",
"query",
",",
"*",
",",
"output_file",
"=",
"None",
",",
"output_format",
"=",
"\"votable\"",
",",
"verbose",
"=",
"False",
")",
":",
"job",
"=",
"self",
".",
"_tap",
".",
"launch_job",
"(",
"query",
"=",
"quer... | Launches a synchronous job to query HSA Tabular Access Protocol (TAP) Service
Parameters | [
"Launches",
"a",
"synchronous",
"job",
"to",
"query",
"HSA",
"Tabular",
"Access",
"Protocol",
"(",
"TAP",
")",
"Service",
"Parameters"
] | [
"\"\"\"\n Launches a synchronous job to query HSA Tabular Access Protocol (TAP) Service\n\n Parameters\n ----------\n query : string\n query (adql) to be executed\n output_file : string, optional, default None\n file name where the results are saved if dumpTo... | [
{
"param": "self",
"type": null
},
{
"param": "query",
"type": null
},
{
"param": "output_file",
"type": null
},
{
"param": "output_format",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "query",
"type": null,
"docstring": null,
"docstring_tokens": ... |
79c11f502d3d6408b68a2c6eea93b7b07ff39a52 | eerovaher/astroquery | astroquery/esa/hsa/core.py | [
"BSD-3-Clause"
] | Python | query_observations | <not_specific> | def query_observations(self, coordinate, radius, *, n_obs=10, **kwargs):
"""
Get the observation IDs from a given region
Parameters
----------
coordinate : string / `astropy.coordinates`
the identifier or coordinates around which to query
radius : int / `~ast... |
Get the observation IDs from a given region
Parameters
----------
coordinate : string / `astropy.coordinates`
the identifier or coordinates around which to query
radius : int / `~astropy.units.Quantity`
the radius of the region
n_obs : int, optio... | Get the observation IDs from a given region
Parameters
Returns
A table object with the list of observations in the region | [
"Get",
"the",
"observation",
"IDs",
"from",
"a",
"given",
"region",
"Parameters",
"Returns",
"A",
"table",
"object",
"with",
"the",
"list",
"of",
"observations",
"in",
"the",
"region"
] | def query_observations(self, coordinate, radius, *, n_obs=10, **kwargs):
return self.query_region(coordinate, radius, n_obs=n_obs, columns="observation_id", **kwargs) | [
"def",
"query_observations",
"(",
"self",
",",
"coordinate",
",",
"radius",
",",
"*",
",",
"n_obs",
"=",
"10",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"query_region",
"(",
"coordinate",
",",
"radius",
",",
"n_obs",
"=",
"n_obs",
",",
"col... | Get the observation IDs from a given region
Parameters | [
"Get",
"the",
"observation",
"IDs",
"from",
"a",
"given",
"region",
"Parameters"
] | [
"\"\"\"\n Get the observation IDs from a given region\n\n Parameters\n ----------\n coordinate : string / `astropy.coordinates`\n the identifier or coordinates around which to query\n radius : int / `~astropy.units.Quantity`\n the radius of the region\n ... | [
{
"param": "self",
"type": null
},
{
"param": "coordinate",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "n_obs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinate",
"type": null,
"docstring": null,
"docstring_toke... |
79c11f502d3d6408b68a2c6eea93b7b07ff39a52 | eerovaher/astroquery | astroquery/esa/hsa/core.py | [
"BSD-3-Clause"
] | Python | query_region | <not_specific> | def query_region(self, coordinate, radius, *, n_obs=10, columns='*', **kwargs):
"""
Get the observation metadata from a given region
Parameters
----------
coordinate : string / `astropy.coordinates`
the identifier or coordinates around which to query
radius :... |
Get the observation metadata from a given region
Parameters
----------
coordinate : string / `astropy.coordinates`
the identifier or coordinates around which to query
radius : int / `~astropy.units.Quantity`
the radius of the region
n_obs : int, ... | Get the observation metadata from a given region
Parameters
Returns
A table object with the list of observations in the region | [
"Get",
"the",
"observation",
"metadata",
"from",
"a",
"given",
"region",
"Parameters",
"Returns",
"A",
"table",
"object",
"with",
"the",
"list",
"of",
"observations",
"in",
"the",
"region"
] | def query_region(self, coordinate, radius, *, n_obs=10, columns='*', **kwargs):
r = radius
if not isinstance(radius, u.Quantity):
r = radius*u.deg
coord = commons.parse_coordinates(coordinate).icrs
query = (f"select top {n_obs} {columns} from hsa.v_active_observation "
... | [
"def",
"query_region",
"(",
"self",
",",
"coordinate",
",",
"radius",
",",
"*",
",",
"n_obs",
"=",
"10",
",",
"columns",
"=",
"'*'",
",",
"**",
"kwargs",
")",
":",
"r",
"=",
"radius",
"if",
"not",
"isinstance",
"(",
"radius",
",",
"u",
".",
"Quanti... | Get the observation metadata from a given region
Parameters | [
"Get",
"the",
"observation",
"metadata",
"from",
"a",
"given",
"region",
"Parameters"
] | [
"\"\"\"\n Get the observation metadata from a given region\n\n Parameters\n ----------\n coordinate : string / `astropy.coordinates`\n the identifier or coordinates around which to query\n radius : int / `~astropy.units.Quantity`\n the radius of the region\n ... | [
{
"param": "self",
"type": null
},
{
"param": "coordinate",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "n_obs",
"type": null
},
{
"param": "columns",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinate",
"type": null,
"docstring": null,
"docstring_toke... |
e3b4542123659e51ccd3c643abb41d83d33a25fb | eerovaher/astroquery | astroquery/utils/cleanup_downloads.py | [
"BSD-3-Clause"
] | Python | cleanup_saved_downloads | null | def cleanup_saved_downloads(names):
""" Function to clean up save files.
Parameters
----------
names : str or list of str
Files or directories to clean up. Wildcards are accepted.
"""
if isinstance(names, str):
names = [names]
for path in names:
files = glob.glob(p... | Function to clean up save files.
Parameters
----------
names : str or list of str
Files or directories to clean up. Wildcards are accepted.
| Function to clean up save files.
Parameters
names : str or list of str
Files or directories to clean up. Wildcards are accepted. | [
"Function",
"to",
"clean",
"up",
"save",
"files",
".",
"Parameters",
"names",
":",
"str",
"or",
"list",
"of",
"str",
"Files",
"or",
"directories",
"to",
"clean",
"up",
".",
"Wildcards",
"are",
"accepted",
"."
] | def cleanup_saved_downloads(names):
if isinstance(names, str):
names = [names]
for path in names:
files = glob.glob(path)
for saved_download in files:
try:
shutil.rmtree(saved_download)
except NotADirectoryError:
os.remove(saved_dow... | [
"def",
"cleanup_saved_downloads",
"(",
"names",
")",
":",
"if",
"isinstance",
"(",
"names",
",",
"str",
")",
":",
"names",
"=",
"[",
"names",
"]",
"for",
"path",
"in",
"names",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"path",
")",
"for",
"saved_d... | Function to clean up save files. | [
"Function",
"to",
"clean",
"up",
"save",
"files",
"."
] | [
"\"\"\" Function to clean up save files.\n\n Parameters\n ----------\n names : str or list of str\n Files or directories to clean up. Wildcards are accepted.\n \"\"\""
] | [
{
"param": "names",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "names",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0af95e382a7daa4f816332be801bdcc5bc2bbcb | eerovaher/astroquery | astroquery/gemini/urlhelper.py | [
"BSD-3-Clause"
] | Python | build_url | <not_specific> | def build_url(self, *args, **kwargs):
""" Build a URL with the given args and kwargs as the query parameters.
Parameters
----------
args : list
The arguments to be passed in the URL without a key. Each of
these is simply added as another component of the path in... | Build a URL with the given args and kwargs as the query parameters.
Parameters
----------
args : list
The arguments to be passed in the URL without a key. Each of
these is simply added as another component of the path in the url.
kwargs : dict of key/value para... | Build a URL with the given args and kwargs as the query parameters.
Parameters
args : list
The arguments to be passed in the URL without a key. Each of
these is simply added as another component of the path in the url.
kwargs : dict of key/value parameters for the url
The arguments to be passed in key=value form.
Ret... | [
"Build",
"a",
"URL",
"with",
"the",
"given",
"args",
"and",
"kwargs",
"as",
"the",
"query",
"parameters",
".",
"Parameters",
"args",
":",
"list",
"The",
"arguments",
"to",
"be",
"passed",
"in",
"the",
"URL",
"without",
"a",
"key",
".",
"Each",
"of",
"t... | def build_url(self, *args, **kwargs):
qa_parm = ''
eng_parm = ''
qa_parameters = (
'NotFail',
'AnyQA',
'Pass',
'Lucky',
'Win',
'Usable',
'Undefind',
'Fail'
)
engineering_parameters = (... | [
"def",
"build_url",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"qa_parm",
"=",
"''",
"eng_parm",
"=",
"''",
"qa_parameters",
"=",
"(",
"'NotFail'",
",",
"'AnyQA'",
",",
"'Pass'",
",",
"'Lucky'",
",",
"'Win'",
",",
"'Usable'",
",",
... | Build a URL with the given args and kwargs as the query parameters. | [
"Build",
"a",
"URL",
"with",
"the",
"given",
"args",
"and",
"kwargs",
"as",
"the",
"query",
"parameters",
"."
] | [
"\"\"\" Build a URL with the given args and kwargs as the query parameters.\n\n Parameters\n ----------\n args : list\n The arguments to be passed in the URL without a key. Each of\n these is simply added as another component of the path in the url.\n kwargs : dict... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e44a243f1ffc99d798daecae3866f1e4d260346 | eerovaher/astroquery | astroquery/vo_conesearch/core.py | [
"BSD-3-Clause"
] | Python | query_region | <not_specific> | def query_region(self, coordinates, radius, *, verb=1,
get_query_payload=False, cache=True, verbose=False,
service_url=None, return_astropy_table=True,
use_names_over_ids=False):
"""
Perform Cone Search and returns the result of the
... |
Perform Cone Search and returns the result of the
first successful query.
Parameters
----------
coordinates : str, `astropy.coordinates` object, list, or tuple
Position of the center of the cone to search.
It may be specified as an object from the
... | Perform Cone Search and returns the result of the
first successful query.
Parameters
coordinates : str, `astropy.coordinates` object, list, or tuple
Position of the center of the cone to search.
radius : float or `~astropy.units.quantity.Quantity`
Radius of the cone to search.
If float is given, it is assumed to be... | [
"Perform",
"Cone",
"Search",
"and",
"returns",
"the",
"result",
"of",
"the",
"first",
"successful",
"query",
".",
"Parameters",
"coordinates",
":",
"str",
"`",
"astropy",
".",
"coordinates",
"`",
"object",
"list",
"or",
"tuple",
"Position",
"of",
"the",
"cen... | def query_region(self, coordinates, radius, *, verb=1,
get_query_payload=False, cache=True, verbose=False,
service_url=None, return_astropy_table=True,
use_names_over_ids=False):
request_payload = self._args_to_payload(coordinates, radius, verb)
... | [
"def",
"query_region",
"(",
"self",
",",
"coordinates",
",",
"radius",
",",
"*",
",",
"verb",
"=",
"1",
",",
"get_query_payload",
"=",
"False",
",",
"cache",
"=",
"True",
",",
"verbose",
"=",
"False",
",",
"service_url",
"=",
"None",
",",
"return_astropy... | Perform Cone Search and returns the result of the
first successful query. | [
"Perform",
"Cone",
"Search",
"and",
"returns",
"the",
"result",
"of",
"the",
"first",
"successful",
"query",
"."
] | [
"\"\"\"\n Perform Cone Search and returns the result of the\n first successful query.\n\n Parameters\n ----------\n coordinates : str, `astropy.coordinates` object, list, or tuple\n Position of the center of the cone to search.\n It may be specified as an obj... | [
{
"param": "self",
"type": null
},
{
"param": "coordinates",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "verb",
"type": null
},
{
"param": "get_query_payload",
"type": null
},
{
"param": "cache",
"type": null
},
{
"para... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinates",
"type": null,
"docstring": null,
"docstring_tok... |
4e44a243f1ffc99d798daecae3866f1e4d260346 | eerovaher/astroquery | astroquery/vo_conesearch/core.py | [
"BSD-3-Clause"
] | Python | _parse_result | <not_specific> | def _parse_result(self, response, url, pars={}, verbose=False):
"""
Parse the raw HTTP response and return it as a table.
"""
# Suppress any VOTable related warnings.
if not verbose:
commons.suppress_vo_warnings()
query = []
for key, value in pars.ite... |
Parse the raw HTTP response and return it as a table.
| Parse the raw HTTP response and return it as a table. | [
"Parse",
"the",
"raw",
"HTTP",
"response",
"and",
"return",
"it",
"as",
"a",
"table",
"."
] | def _parse_result(self, response, url, pars={}, verbose=False):
if not verbose:
commons.suppress_vo_warnings()
query = []
for key, value in pars.items():
query.append('{0}={1}'.format(urllib.parse.quote(key),
urllib.parse.quote_pl... | [
"def",
"_parse_result",
"(",
"self",
",",
"response",
",",
"url",
",",
"pars",
"=",
"{",
"}",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"verbose",
":",
"commons",
".",
"suppress_vo_warnings",
"(",
")",
"query",
"=",
"[",
"]",
"for",
"key",... | Parse the raw HTTP response and return it as a table. | [
"Parse",
"the",
"raw",
"HTTP",
"response",
"and",
"return",
"it",
"as",
"a",
"table",
"."
] | [
"\"\"\"\n Parse the raw HTTP response and return it as a table.\n \"\"\"",
"# Suppress any VOTable related warnings.",
"# Parse the result"
] | [
{
"param": "self",
"type": null
},
{
"param": "response",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "pars",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "response",
"type": null,
"docstring": null,
"docstring_tokens... |
4e44a243f1ffc99d798daecae3866f1e4d260346 | eerovaher/astroquery | astroquery/vo_conesearch/core.py | [
"BSD-3-Clause"
] | Python | _validate_url | <not_specific> | def _validate_url(url):
"""Validate Cone Search service URL."""
if url is None:
url = conf.fallback_url
# This is the standard expectation of a service URL
if not url.endswith(('?', '&')):
raise InvalidAccessURL("URL should end with '?' or '&'")
# && in URL can break some queries, ... | Validate Cone Search service URL. | Validate Cone Search service URL. | [
"Validate",
"Cone",
"Search",
"service",
"URL",
"."
] | def _validate_url(url):
if url is None:
url = conf.fallback_url
if not url.endswith(('?', '&')):
raise InvalidAccessURL("URL should end with '?' or '&'")
if url.endswith('&'):
url = url[:-1]
return url | [
"def",
"_validate_url",
"(",
"url",
")",
":",
"if",
"url",
"is",
"None",
":",
"url",
"=",
"conf",
".",
"fallback_url",
"if",
"not",
"url",
".",
"endswith",
"(",
"(",
"'?'",
",",
"'&'",
")",
")",
":",
"raise",
"InvalidAccessURL",
"(",
"\"URL should end ... | Validate Cone Search service URL. | [
"Validate",
"Cone",
"Search",
"service",
"URL",
"."
] | [
"\"\"\"Validate Cone Search service URL.\"\"\"",
"# This is the standard expectation of a service URL",
"# && in URL can break some queries, so remove trailing & if needed",
"# as & will be added back later"
] | [
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c48971fe2f64aeb96b44e132edddb7127e52389a | eerovaher/astroquery | astroquery/hips2fits/core.py | [
"BSD-3-Clause"
] | Python | query | <not_specific> | def query(self, hips, width, height, projection, ra, dec, fov, coordsys="icrs", rotation_angle=Angle(0 * u.deg), format="fits", min_cut=0.5, max_cut=99.5, stretch="linear", cmap="Greys_r", get_query_payload=False, verbose=False):
"""
Query the `CDS hips2fits service <http://alasky.u-strasbg.fr/hips-imag... |
Query the `CDS hips2fits service <http://alasky.u-strasbg.fr/hips-image-services/hips2fits>`_.
If you have not any WCS, you can call this method by passing:
* The width/height size of the output pixel image
* The center of projection in world coordinates (ra, dec)
* The fov ang... | Query the `CDS hips2fits service `_.
If you have not any WCS, you can call this method by passing:
The width/height size of the output pixel image
The center of projection in world coordinates (ra, dec)
The fov angle in world coordinates
The rotation angle of the projection
The name of the projection. All `astropy proj... | [
"Query",
"the",
"`",
"CDS",
"hips2fits",
"service",
"`",
"_",
".",
"If",
"you",
"have",
"not",
"any",
"WCS",
"you",
"can",
"call",
"this",
"method",
"by",
"passing",
":",
"The",
"width",
"/",
"height",
"size",
"of",
"the",
"output",
"pixel",
"image",
... | def query(self, hips, width, height, projection, ra, dec, fov, coordsys="icrs", rotation_angle=Angle(0 * u.deg), format="fits", min_cut=0.5, max_cut=99.5, stretch="linear", cmap="Greys_r", get_query_payload=False, verbose=False):
response = self.query_async(get_query_payload, hips=hips, width=width, height=heig... | [
"def",
"query",
"(",
"self",
",",
"hips",
",",
"width",
",",
"height",
",",
"projection",
",",
"ra",
",",
"dec",
",",
"fov",
",",
"coordsys",
"=",
"\"icrs\"",
",",
"rotation_angle",
"=",
"Angle",
"(",
"0",
"*",
"u",
".",
"deg",
")",
",",
"format",
... | Query the `CDS hips2fits service <http://alasky.u-strasbg.fr/hips-image-services/hips2fits>`_. | [
"Query",
"the",
"`",
"CDS",
"hips2fits",
"service",
"<http",
":",
"//",
"alasky",
".",
"u",
"-",
"strasbg",
".",
"fr",
"/",
"hips",
"-",
"image",
"-",
"services",
"/",
"hips2fits",
">",
"`",
"_",
"."
] | [
"\"\"\"\n Query the `CDS hips2fits service <http://alasky.u-strasbg.fr/hips-image-services/hips2fits>`_.\n\n If you have not any WCS, you can call this method by passing:\n * The width/height size of the output pixel image\n * The center of projection in world coordinates (ra, dec)\n ... | [
{
"param": "self",
"type": null
},
{
"param": "hips",
"type": null
},
{
"param": "width",
"type": null
},
{
"param": "height",
"type": null
},
{
"param": "projection",
"type": null
},
{
"param": "ra",
"type": null
},
{
"param": "dec",
"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hips",
"type": null,
"docstring": null,
"docstring_tokens": [... |
09ddea295a287e609e30c71c30f1ed533a24df02 | eerovaher/astroquery | astroquery/alma/tests/test_alma_remote.py | [
"BSD-3-Clause"
] | Python | alma | <not_specific> | def alma(request):
"""
Returns an alma client class. `--alma-site` pytest option can be used
to have the client run against a specific site
:param request: pytest request fixture
:return: alma client to use in tests
"""
alma = Alma()
alma_site = request.config.getoption('--alma-site',
... |
Returns an alma client class. `--alma-site` pytest option can be used
to have the client run against a specific site
:param request: pytest request fixture
:return: alma client to use in tests
| Returns an alma client class. `--alma-site` pytest option can be used
to have the client run against a specific site | [
"Returns",
"an",
"alma",
"client",
"class",
".",
"`",
"--",
"alma",
"-",
"site",
"`",
"pytest",
"option",
"can",
"be",
"used",
"to",
"have",
"the",
"client",
"run",
"against",
"a",
"specific",
"site"
] | def alma(request):
alma = Alma()
alma_site = request.config.getoption('--alma-site',
'almascience.eso.org')
alma.archive_url = 'https://{}'.format(alma_site)
return alma | [
"def",
"alma",
"(",
"request",
")",
":",
"alma",
"=",
"Alma",
"(",
")",
"alma_site",
"=",
"request",
".",
"config",
".",
"getoption",
"(",
"'--alma-site'",
",",
"'almascience.eso.org'",
")",
"alma",
".",
"archive_url",
"=",
"'https://{}'",
".",
"format",
"... | Returns an alma client class. | [
"Returns",
"an",
"alma",
"client",
"class",
"."
] | [
"\"\"\"\n Returns an alma client class. `--alma-site` pytest option can be used\n to have the client run against a specific site\n :param request: pytest request fixture\n :return: alma client to use in tests\n \"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [
{
"docstring": "alma client to use in tests",
"docstring_tokens": [
"alma",
"client",
"to",
"use",
"in",
"tests"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
... |
caa264aca752d666aa7b90dacd47d5d5076d86bf | eerovaher/astroquery | astroquery/mast/missions.py | [
"BSD-3-Clause"
] | Python | query_region_async | <not_specific> | def query_region_async(self, coordinates, *, radius=3*u.arcmin, limit=5000, offset=0, **kwargs):
"""
Given a sky position and radius, returns a list of matching dataset IDs.
Parameters
----------
coordinates : str or `~astropy.coordinates` object
The target around wh... |
Given a sky position and radius, returns a list of matching dataset IDs.
Parameters
----------
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` obje... | Given a sky position and radius, returns a list of matching dataset IDs.
Parameters
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
radius : str or `~astropy.units.Quantity` object, optional
Defau... | [
"Given",
"a",
"sky",
"position",
"and",
"radius",
"returns",
"a",
"list",
"of",
"matching",
"dataset",
"IDs",
".",
"Parameters",
"coordinates",
":",
"str",
"or",
"`",
"~astropy",
".",
"coordinates",
"`",
"object",
"The",
"target",
"around",
"which",
"to",
... | def query_region_async(self, coordinates, *, radius=3*u.arcmin, limit=5000, offset=0, **kwargs):
self.limit = limit
coordinates = commons.parse_coordinates(coordinates)
radius = coord.Angle(radius, u.arcmin)
params = {'target': [f"{coordinates.ra.deg} {coordinates.dec.deg}"],
... | [
"def",
"query_region_async",
"(",
"self",
",",
"coordinates",
",",
"*",
",",
"radius",
"=",
"3",
"*",
"u",
".",
"arcmin",
",",
"limit",
"=",
"5000",
",",
"offset",
"=",
"0",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"limit",
"=",
"limit",
"coordi... | Given a sky position and radius, returns a list of matching dataset IDs. | [
"Given",
"a",
"sky",
"position",
"and",
"radius",
"returns",
"a",
"list",
"of",
"matching",
"dataset",
"IDs",
"."
] | [
"\"\"\"\n Given a sky position and radius, returns a list of matching dataset IDs.\n\n Parameters\n ----------\n coordinates : str or `~astropy.coordinates` object\n The target around which to search. It may be specified as a\n string or as the appropriate `~astropy... | [
{
"param": "self",
"type": null
},
{
"param": "coordinates",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "limit",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinates",
"type": null,
"docstring": null,
"docstring_tok... |
caa264aca752d666aa7b90dacd47d5d5076d86bf | eerovaher/astroquery | astroquery/mast/missions.py | [
"BSD-3-Clause"
] | Python | query_criteria_async | <not_specific> | def query_criteria_async(self, *, coordinates=None, objectname=None, radius=3*u.arcmin,
limit=5000, offset=0, select_cols=[], **criteria):
"""
Given a set of search criteria, returns a list of mission metadata.
Parameters
----------
coordinates : str... |
Given a set of search criteria, returns a list of mission metadata.
Parameters
----------
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
... | Given a set of search criteria, returns a list of mission metadata.
Parameters
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
objectname : str
The name of the target around which to search.
radiu... | [
"Given",
"a",
"set",
"of",
"search",
"criteria",
"returns",
"a",
"list",
"of",
"mission",
"metadata",
".",
"Parameters",
"coordinates",
":",
"str",
"or",
"`",
"~astropy",
".",
"coordinates",
"`",
"object",
"The",
"target",
"around",
"which",
"to",
"search",
... | def query_criteria_async(self, *, coordinates=None, objectname=None, radius=3*u.arcmin,
limit=5000, offset=0, select_cols=[], **criteria):
self.limit = limit
if objectname or coordinates:
coordinates = utils.parse_input_location(coordinates, objectname)
r... | [
"def",
"query_criteria_async",
"(",
"self",
",",
"*",
",",
"coordinates",
"=",
"None",
",",
"objectname",
"=",
"None",
",",
"radius",
"=",
"3",
"*",
"u",
".",
"arcmin",
",",
"limit",
"=",
"5000",
",",
"offset",
"=",
"0",
",",
"select_cols",
"=",
"[",... | Given a set of search criteria, returns a list of mission metadata. | [
"Given",
"a",
"set",
"of",
"search",
"criteria",
"returns",
"a",
"list",
"of",
"mission",
"metadata",
"."
] | [
"\"\"\"\n Given a set of search criteria, returns a list of mission metadata.\n\n Parameters\n ----------\n coordinates : str or `~astropy.coordinates` object\n The target around which to search. It may be specified as a\n string or as the appropriate `~astropy.coor... | [
{
"param": "self",
"type": null
},
{
"param": "coordinates",
"type": null
},
{
"param": "objectname",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "limit",
"type": null
},
{
"param": "offset",
"type": null
},
{
"param": "... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinates",
"type": null,
"docstring": null,
"docstring_tok... |
8cac67559be0fc768e23af668ac4dc82476901b2 | eerovaher/astroquery | astroquery/heasarc/tests/parametrization.py | [
"BSD-3-Clause"
] | Python | patch_get | <not_specific> | def patch_get(request):
"""
If the mode is not remote, patch `requests.Session` to either return saved local data or run save data new local data
"""
mode = request.param
mp = request.getfixturevalue("monkeypatch")
if mode != "remote":
requests.Session._original_request = requests.Sessi... |
If the mode is not remote, patch `requests.Session` to either return saved local data or run save data new local data
| If the mode is not remote, patch `requests.Session` to either return saved local data or run save data new local data | [
"If",
"the",
"mode",
"is",
"not",
"remote",
"patch",
"`",
"requests",
".",
"Session",
"`",
"to",
"either",
"return",
"saved",
"local",
"data",
"or",
"run",
"save",
"data",
"new",
"local",
"data"
] | def patch_get(request):
mode = request.param
mp = request.getfixturevalue("monkeypatch")
if mode != "remote":
requests.Session._original_request = requests.Session.request
mp.setattr(
requests.Session,
"request",
{"save": save_response_of_get, "local": get... | [
"def",
"patch_get",
"(",
"request",
")",
":",
"mode",
"=",
"request",
".",
"param",
"mp",
"=",
"request",
".",
"getfixturevalue",
"(",
"\"monkeypatch\"",
")",
"if",
"mode",
"!=",
"\"remote\"",
":",
"requests",
".",
"Session",
".",
"_original_request",
"=",
... | If the mode is not remote, patch `requests.Session` to either return saved local data or run save data new local data | [
"If",
"the",
"mode",
"is",
"not",
"remote",
"patch",
"`",
"requests",
".",
"Session",
"`",
"to",
"either",
"return",
"saved",
"local",
"data",
"or",
"run",
"save",
"data",
"new",
"local",
"data"
] | [
"\"\"\"\n If the mode is not remote, patch `requests.Session` to either return saved local data or run save data new local data\n \"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ebf4220f1fae4e8380e528e4dab7c5d7d44e11c4 | eerovaher/astroquery | astroquery/open_exoplanet_catalogue/utils.py | [
"BSD-3-Clause"
] | Python | machine_readable | <not_specific> | def machine_readable(self, separator="\t", missingval="None"):
"""
Creates a string intended for a machine to read (ex, gnuplot)
prints as follows
value(separator)errorplus(separator)errorminus(separator)upperlimit(separator)lowerlimit
if the value does not exist, the missingval... |
Creates a string intended for a machine to read (ex, gnuplot)
prints as follows
value(separator)errorplus(separator)errorminus(separator)upperlimit(separator)lowerlimit
if the value does not exist, the missingval is added instead
Parameters
----------
separator... |
if the value does not exist, the missingval is added instead
Parameters
str
string used to separate values while printing
missingval: str
string to use for NoneType values
Returns
str | [
"if",
"the",
"value",
"does",
"not",
"exist",
"the",
"missingval",
"is",
"added",
"instead",
"Parameters",
"str",
"string",
"used",
"to",
"separate",
"values",
"while",
"printing",
"missingval",
":",
"str",
"string",
"to",
"use",
"for",
"NoneType",
"values",
... | def machine_readable(self, separator="\t", missingval="None"):
temp = ""
if hasattr(self, "value") and self.value is not None:
temp += str(self.value) + separator
else:
temp += missingval + separator
if hasattr(self, "errorplus") and self.errorplus is not None:
... | [
"def",
"machine_readable",
"(",
"self",
",",
"separator",
"=",
"\"\\t\"",
",",
"missingval",
"=",
"\"None\"",
")",
":",
"temp",
"=",
"\"\"",
"if",
"hasattr",
"(",
"self",
",",
"\"value\"",
")",
"and",
"self",
".",
"value",
"is",
"not",
"None",
":",
"te... | Creates a string intended for a machine to read (ex, gnuplot)
prints as follows
value(separator)errorplus(separator)errorminus(separator)upperlimit(separator)lowerlimit | [
"Creates",
"a",
"string",
"intended",
"for",
"a",
"machine",
"to",
"read",
"(",
"ex",
"gnuplot",
")",
"prints",
"as",
"follows",
"value",
"(",
"separator",
")",
"errorplus",
"(",
"separator",
")",
"errorminus",
"(",
"separator",
")",
"upperlimit",
"(",
"se... | [
"\"\"\"\n Creates a string intended for a machine to read (ex, gnuplot)\n prints as follows\n value(separator)errorplus(separator)errorminus(separator)upperlimit(separator)lowerlimit\n\n if the value does not exist, the missingval is added instead\n\n Parameters\n ---------... | [
{
"param": "self",
"type": null
},
{
"param": "separator",
"type": null
},
{
"param": "missingval",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "separator",
"type": null,
"docstring": null,
"docstring_token... |
ebf4220f1fae4e8380e528e4dab7c5d7d44e11c4 | eerovaher/astroquery | astroquery/open_exoplanet_catalogue/utils.py | [
"BSD-3-Clause"
] | Python | asymmetric | <not_specific> | def asymmetric(self):
"""
Notes
-----
Returns true if the errorplus and errorminus are not equal
Returns
-------
bool
"""
return self.errorminus != self.errorplus |
Notes
-----
Returns true if the errorplus and errorminus are not equal
Returns
-------
bool
| Notes
Returns true if the errorplus and errorminus are not equal
Returns
bool | [
"Notes",
"Returns",
"true",
"if",
"the",
"errorplus",
"and",
"errorminus",
"are",
"not",
"equal",
"Returns",
"bool"
] | def asymmetric(self):
return self.errorminus != self.errorplus | [
"def",
"asymmetric",
"(",
"self",
")",
":",
"return",
"self",
".",
"errorminus",
"!=",
"self",
".",
"errorplus"
] | Notes
Returns true if the errorplus and errorminus are not equal | [
"Notes",
"Returns",
"true",
"if",
"the",
"errorplus",
"and",
"errorminus",
"are",
"not",
"equal"
] | [
"\"\"\"\n Notes\n -----\n Returns true if the errorplus and errorminus are not equal\n\n Returns\n -------\n bool\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
57061fd2e6b39c9c31bedd9c808b3d5af40419e4 | eerovaher/astroquery | astroquery/alfalfa/core.py | [
"BSD-3-Clause"
] | Python | query_region | <not_specific> | def query_region(self, coordinates, radius=3. * u.arcmin,
optical_counterpart=False):
"""
Perform object cross-ID in ALFALFA.
Search for objects near position (ra, dec) within some radius.
Parameters
----------
coordinates : str or `astropy.coordina... |
Perform object cross-ID in ALFALFA.
Search for objects near position (ra, dec) within some radius.
Parameters
----------
coordinates : str or `astropy.coordinates` object
The target around which to search. It may be specified as a
string in which case i... | Perform object cross-ID in ALFALFA.
Search for objects near position (ra, dec) within some radius.
Parameters
coordinates : str or `astropy.coordinates` object
The target around which to search. It may be specified as a
string in which case it is resolved using online services or as
the appropriate `astropy.coordinat... | [
"Perform",
"object",
"cross",
"-",
"ID",
"in",
"ALFALFA",
".",
"Search",
"for",
"objects",
"near",
"position",
"(",
"ra",
"dec",
")",
"within",
"some",
"radius",
".",
"Parameters",
"coordinates",
":",
"str",
"or",
"`",
"astropy",
".",
"coordinates",
"`",
... | def query_region(self, coordinates, radius=3. * u.arcmin,
optical_counterpart=False):
coordinates = commons.parse_coordinates(coordinates)
ra = coordinates.ra.degree
dec = coordinates.dec.degree
dr = coord.Angle(radius).deg
cat = self.get_catalog()
if... | [
"def",
"query_region",
"(",
"self",
",",
"coordinates",
",",
"radius",
"=",
"3.",
"*",
"u",
".",
"arcmin",
",",
"optical_counterpart",
"=",
"False",
")",
":",
"coordinates",
"=",
"commons",
".",
"parse_coordinates",
"(",
"coordinates",
")",
"ra",
"=",
"coo... | Perform object cross-ID in ALFALFA. | [
"Perform",
"object",
"cross",
"-",
"ID",
"in",
"ALFALFA",
"."
] | [
"\"\"\"\n Perform object cross-ID in ALFALFA.\n\n Search for objects near position (ra, dec) within some radius.\n\n Parameters\n ----------\n coordinates : str or `astropy.coordinates` object\n The target around which to search. It may be specified as a\n st... | [
{
"param": "self",
"type": null
},
{
"param": "coordinates",
"type": null
},
{
"param": "radius",
"type": null
},
{
"param": "optical_counterpart",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coordinates",
"type": null,
"docstring": null,
"docstring_tok... |
feeb01356d0b5d9394f5fee1c14428750f134ce0 | eerovaher/astroquery | astroquery/utils/tap/taputils.py | [
"BSD-3-Clause"
] | Python | parse_http_response_error | <not_specific> | def parse_http_response_error(responseStr, status):
"""Extracts an HTTP error message from an HTML response.
Parameters
----------
responseStr : HTTP response, mandatory
HTTP response
Returns
-------
A string with the response error message.
"""
pos1 = responseStr.find(TAP_... | Extracts an HTTP error message from an HTML response.
Parameters
----------
responseStr : HTTP response, mandatory
HTTP response
Returns
-------
A string with the response error message.
| Extracts an HTTP error message from an HTML response.
Parameters
responseStr : HTTP response, mandatory
HTTP response
Returns
A string with the response error message. | [
"Extracts",
"an",
"HTTP",
"error",
"message",
"from",
"an",
"HTML",
"response",
".",
"Parameters",
"responseStr",
":",
"HTTP",
"response",
"mandatory",
"HTTP",
"response",
"Returns",
"A",
"string",
"with",
"the",
"response",
"error",
"message",
"."
] | def parse_http_response_error(responseStr, status):
pos1 = responseStr.find(TAP_UTILS_HTTP_ERROR_MSG_START)
if pos1 == -1:
return parse_http_votable_response_error(responseStr, status)
pos2 = responseStr.find('</li>', pos1)
if pos2 == -1:
return parse_http_votable_response_error(response... | [
"def",
"parse_http_response_error",
"(",
"responseStr",
",",
"status",
")",
":",
"pos1",
"=",
"responseStr",
".",
"find",
"(",
"TAP_UTILS_HTTP_ERROR_MSG_START",
")",
"if",
"pos1",
"==",
"-",
"1",
":",
"return",
"parse_http_votable_response_error",
"(",
"responseStr"... | Extracts an HTTP error message from an HTML response. | [
"Extracts",
"an",
"HTTP",
"error",
"message",
"from",
"an",
"HTML",
"response",
"."
] | [
"\"\"\"Extracts an HTTP error message from an HTML response.\n\n Parameters\n ----------\n responseStr : HTTP response, mandatory\n HTTP response\n\n Returns\n -------\n A string with the response error message.\n \"\"\""
] | [
{
"param": "responseStr",
"type": null
},
{
"param": "status",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "responseStr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "status",
"type": null,
"docstring": null,
"docstring_t... |
feeb01356d0b5d9394f5fee1c14428750f134ce0 | eerovaher/astroquery | astroquery/utils/tap/taputils.py | [
"BSD-3-Clause"
] | Python | parse_http_votable_response_error | <not_specific> | def parse_http_votable_response_error(responseStr, status):
"""Extracts an HTTP error message from an VO response.
Parameters
----------
responseStr : HTTP VO response, mandatory
HTTP VO response
Returns
-------
A string with the response error message.
"""
pos1 = responseS... | Extracts an HTTP error message from an VO response.
Parameters
----------
responseStr : HTTP VO response, mandatory
HTTP VO response
Returns
-------
A string with the response error message.
| Extracts an HTTP error message from an VO response.
Parameters
responseStr : HTTP VO response, mandatory
HTTP VO response
Returns
A string with the response error message. | [
"Extracts",
"an",
"HTTP",
"error",
"message",
"from",
"an",
"VO",
"response",
".",
"Parameters",
"responseStr",
":",
"HTTP",
"VO",
"response",
"mandatory",
"HTTP",
"VO",
"response",
"Returns",
"A",
"string",
"with",
"the",
"response",
"error",
"message",
"."
] | def parse_http_votable_response_error(responseStr, status):
pos1 = responseStr.find(TAP_UTILS_HTTP_VOTABLE_ERROR)
if pos1 == -1:
return f"Error {status}:\n{responseStr}"
pos2 = responseStr.find(TAP_UTILS_VOTABLE_INFO, pos1)
if pos2 == -1:
return f"Error {status}:\n{responseStr}"
msg ... | [
"def",
"parse_http_votable_response_error",
"(",
"responseStr",
",",
"status",
")",
":",
"pos1",
"=",
"responseStr",
".",
"find",
"(",
"TAP_UTILS_HTTP_VOTABLE_ERROR",
")",
"if",
"pos1",
"==",
"-",
"1",
":",
"return",
"f\"Error {status}:\\n{responseStr}\"",
"pos2",
"... | Extracts an HTTP error message from an VO response. | [
"Extracts",
"an",
"HTTP",
"error",
"message",
"from",
"an",
"VO",
"response",
"."
] | [
"\"\"\"Extracts an HTTP error message from an VO response.\n\n Parameters\n ----------\n responseStr : HTTP VO response, mandatory\n HTTP VO response\n\n Returns\n -------\n A string with the response error message.\n \"\"\""
] | [
{
"param": "responseStr",
"type": null
},
{
"param": "status",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "responseStr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "status",
"type": null,
"docstring": null,
"docstring_t... |
ebb0d873045a072a1b9e81231672aa3679743364 | NREL/DER-Dispatch | der_dispatch_app/main_app_new.py | [
"BSD-3-Clause"
] | Python | signal_handler | null | def signal_handler(self, signal, frame):
"""
Capture the CTRL+C signal and save everything.
:param signal:
:param frame:
:return:
"""
print('You pressed Ctrl+C! Saving output')
self._res_csvfile.close()
self.vn_file.close()
self._PV_P_csvfi... |
Capture the CTRL+C signal and save everything.
:param signal:
:param frame:
:return:
| Capture the CTRL+C signal and save everything. | [
"Capture",
"the",
"CTRL",
"+",
"C",
"signal",
"and",
"save",
"everything",
"."
] | def signal_handler(self, signal, frame):
print('You pressed Ctrl+C! Saving output')
self._res_csvfile.close()
self.vn_file.close()
self._PV_P_csvfile.close()
self._PV_Q_csvfile.close()
self._PV_node_bus_P_csvfile.close()
self._PV_node_bus_Q_csvfile.close()
... | [
"def",
"signal_handler",
"(",
"self",
",",
"signal",
",",
"frame",
")",
":",
"print",
"(",
"'You pressed Ctrl+C! Saving output'",
")",
"self",
".",
"_res_csvfile",
".",
"close",
"(",
")",
"self",
".",
"vn_file",
".",
"close",
"(",
")",
"self",
".",
"_PV_P_... | Capture the CTRL+C signal and save everything. | [
"Capture",
"the",
"CTRL",
"+",
"C",
"signal",
"and",
"save",
"everything",
"."
] | [
"\"\"\"\n Capture the CTRL+C signal and save everything.\n :param signal:\n :param frame:\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "signal",
"type": null
},
{
"param": "frame",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ebb0d873045a072a1b9e81231672aa3679743364 | NREL/DER-Dispatch | der_dispatch_app/main_app_new.py | [
"BSD-3-Clause"
] | Python | save_plots | <not_specific> | def save_plots(self):
"""
Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
:return:
"""
print("Saving plots to " + self.resFolder)
results0 = pd.read_csv(os.path.join(self.opf_off_folder, "result.csv"), index_col='epoch time')
... |
Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
:return:
| Save plots for comparison. Need to have OPF off run first and the OPF on for comparison. | [
"Save",
"plots",
"for",
"comparison",
".",
"Need",
"to",
"have",
"OPF",
"off",
"run",
"first",
"and",
"the",
"OPF",
"on",
"for",
"comparison",
"."
] | def save_plots(self):
print("Saving plots to " + self.resFolder)
results0 = pd.read_csv(os.path.join(self.opf_off_folder, "result.csv"), index_col='epoch time')
results0.index = pd.to_datetime(results0.index, unit='s')
if not os.path.exists(self.opf_off_folder):
print('No uno... | [
"def",
"save_plots",
"(",
"self",
")",
":",
"print",
"(",
"\"Saving plots to \"",
"+",
"self",
".",
"resFolder",
")",
"results0",
"=",
"pd",
".",
"read_csv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opf_off_folder",
",",
"\"result.csv\"",
... | Save plots for comparison. | [
"Save",
"plots",
"for",
"comparison",
"."
] | [
"\"\"\"\n Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.\n :return:\n \"\"\"",
"# ax.plot(results1[[u'solar_pct']] * 3320.0 * -1)",
"# plt.show()",
"# ax.plot(results1[[u'solar_pct']] * 3320.0 * -1)",
"# plt.show()",
"# plt.show()"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | read_config | <not_specific> | def read_config(config_file, section):
"""Read a zabbix-matrix config file.
:param config_file: config file to read
:type config_file: str
:param section: section to read from the config file
:type section: str
:return: config dictionary
"""
if os.path.isfile(config_file) is False:
... | Read a zabbix-matrix config file.
:param config_file: config file to read
:type config_file: str
:param section: section to read from the config file
:type section: str
:return: config dictionary
| Read a zabbix-matrix config file. | [
"Read",
"a",
"zabbix",
"-",
"matrix",
"config",
"file",
"."
] | def read_config(config_file, section):
if os.path.isfile(config_file) is False:
logging.error('config file "%s" not found', config_file)
config = configparser.ConfigParser()
config.read(config_file)
return {key: value for key, value in config[section].items()} | [
"def",
"read_config",
"(",
"config_file",
",",
"section",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"config_file",
")",
"is",
"False",
":",
"logging",
".",
"error",
"(",
"'config file \"%s\" not found'",
",",
"config_file",
")",
"config",
"=",
... | Read a zabbix-matrix config file. | [
"Read",
"a",
"zabbix",
"-",
"matrix",
"config",
"file",
"."
] | [
"\"\"\"Read a zabbix-matrix config file.\n\n :param config_file: config file to read\n :type config_file: str\n :param section: section to read from the config file\n :type section: str\n :return: config dictionary\n \"\"\""
] | [
{
"param": "config_file",
"type": null
},
{
"param": "section",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": "config file to read",
"docstring_tokens": [
"config",
"fi... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | init | <not_specific> | def init(config):
"""Initializes the ZabbixAPI with the config.
:param config: config to use, as returned by read_config
:type config: dict
:return: ZabbixAPI reference
"""
logging.debug(config)
zapi = ZabbixAPI(config['host'])
zapi.login(config['username'], config['password'])
retu... | Initializes the ZabbixAPI with the config.
:param config: config to use, as returned by read_config
:type config: dict
:return: ZabbixAPI reference
| Initializes the ZabbixAPI with the config. | [
"Initializes",
"the",
"ZabbixAPI",
"with",
"the",
"config",
"."
] | def init(config):
logging.debug(config)
zapi = ZabbixAPI(config['host'])
zapi.login(config['username'], config['password'])
return zapi | [
"def",
"init",
"(",
"config",
")",
":",
"logging",
".",
"debug",
"(",
"config",
")",
"zapi",
"=",
"ZabbixAPI",
"(",
"config",
"[",
"'host'",
"]",
")",
"zapi",
".",
"login",
"(",
"config",
"[",
"'username'",
"]",
",",
"config",
"[",
"'password'",
"]",... | Initializes the ZabbixAPI with the config. | [
"Initializes",
"the",
"ZabbixAPI",
"with",
"the",
"config",
"."
] | [
"\"\"\"Initializes the ZabbixAPI with the config.\n\n :param config: config to use, as returned by read_config\n :type config: dict\n :return: ZabbixAPI reference\n \"\"\""
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": "config to use, as returned by read_config",
"docstring_tokens": [
"con... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | trigger_info | <not_specific> | def trigger_info(zapi, trigger):
"""Retrieves the description, hostname, prevvalue and trigger_id for a
given trigger.
:param zapi: reference to the ZabbixAPI
:type zapi: ZabbixAPI
:param trigger: dictionary of retrieved trigger
:type trigger: dict
:return: description, hostname, prevvalue,... | Retrieves the description, hostname, prevvalue and trigger_id for a
given trigger.
:param zapi: reference to the ZabbixAPI
:type zapi: ZabbixAPI
:param trigger: dictionary of retrieved trigger
:type trigger: dict
:return: description, hostname, prevvalue, trigger_id
| Retrieves the description, hostname, prevvalue and trigger_id for a
given trigger. | [
"Retrieves",
"the",
"description",
"hostname",
"prevvalue",
"and",
"trigger_id",
"for",
"a",
"given",
"trigger",
"."
] | def trigger_info(zapi, trigger):
trigger_id = trigger['triggerid']
priority = PRIORITY[int(trigger['priority'])]
item = zapi.item.get(triggerids=trigger_id)[0]
hostid = item['hostid']
prevvalue = item['prevvalue']
hostname = zapi.host.get(hostids=hostid)[0]['name']
description = re.sub('({HO... | [
"def",
"trigger_info",
"(",
"zapi",
",",
"trigger",
")",
":",
"trigger_id",
"=",
"trigger",
"[",
"'triggerid'",
"]",
"priority",
"=",
"PRIORITY",
"[",
"int",
"(",
"trigger",
"[",
"'priority'",
"]",
")",
"]",
"item",
"=",
"zapi",
".",
"item",
".",
"get"... | Retrieves the description, hostname, prevvalue and trigger_id for a
given trigger. | [
"Retrieves",
"the",
"description",
"hostname",
"prevvalue",
"and",
"trigger_id",
"for",
"a",
"given",
"trigger",
"."
] | [
"\"\"\"Retrieves the description, hostname, prevvalue and trigger_id for a\n given trigger.\n\n :param zapi: reference to the ZabbixAPI\n :type zapi: ZabbixAPI\n :param trigger: dictionary of retrieved trigger\n :type trigger: dict\n :return: description, hostname, prevvalue, trigger_id\n \"\"\... | [
{
"param": "zapi",
"type": null
},
{
"param": "trigger",
"type": null
}
] | {
"returns": [
{
"docstring": "description, hostname, prevvalue, trigger_id",
"docstring_tokens": [
"description",
"hostname",
"prevvalue",
"trigger_id"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zapi",
"type": ... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | ack | <not_specific> | def ack(config, triggerid):
"""Ack the given trigger id.
:param config: config for zapi
:type config: dict
:param triggerid: id of the trigger to ack
:type triggerid: str
"""
zapi = init(config)
event = zapi.event.get(objectids=triggerid)
try:
msg = zapi.event.acknowledge(
... | Ack the given trigger id.
:param config: config for zapi
:type config: dict
:param triggerid: id of the trigger to ack
:type triggerid: str
| Ack the given trigger id. | [
"Ack",
"the",
"given",
"trigger",
"id",
"."
] | def ack(config, triggerid):
zapi = init(config)
event = zapi.event.get(objectids=triggerid)
try:
msg = zapi.event.acknowledge(
eventids=event[-1]['eventid'],
action=2,
message='Acknowledged by the Matrix-Zabbix bot')
return_string = "Trigger {0} acknowledg... | [
"def",
"ack",
"(",
"config",
",",
"triggerid",
")",
":",
"zapi",
"=",
"init",
"(",
"config",
")",
"event",
"=",
"zapi",
".",
"event",
".",
"get",
"(",
"objectids",
"=",
"triggerid",
")",
"try",
":",
"msg",
"=",
"zapi",
".",
"event",
".",
"acknowled... | Ack the given trigger id. | [
"Ack",
"the",
"given",
"trigger",
"id",
"."
] | [
"\"\"\"Ack the given trigger id.\n\n :param config: config for zapi\n :type config: dict\n :param triggerid: id of the trigger to ack\n :type triggerid: str\n \"\"\""
] | [
{
"param": "config",
"type": null
},
{
"param": "triggerid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": "config for zapi",
"docstring_tokens": [
"config",
"for",
"zapi"
],
"default": null,
"is_optional": null
},
{
"identifier": "triggerid... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | _hostgroup_to_id | <not_specific> | def _hostgroup_to_id(zapi, hostgroup):
"""Retrieves the hostgroup id for a given group.
:param zapi: reference to the zabbix api
:type zapi: zabbix api
:param hostgroup: specifies the host group
:type hostgroup: str
:return: list of hosts
"""
groups = zapi.hostgroup.get(monitored_hosts=... | Retrieves the hostgroup id for a given group.
:param zapi: reference to the zabbix api
:type zapi: zabbix api
:param hostgroup: specifies the host group
:type hostgroup: str
:return: list of hosts
| Retrieves the hostgroup id for a given group. | [
"Retrieves",
"the",
"hostgroup",
"id",
"for",
"a",
"given",
"group",
"."
] | def _hostgroup_to_id(zapi, hostgroup):
groups = zapi.hostgroup.get(monitored_hosts=True)
for group in groups:
if group['name'] == hostgroup:
groupid = group['groupid']
break
else:
groupid = None
return groupid | [
"def",
"_hostgroup_to_id",
"(",
"zapi",
",",
"hostgroup",
")",
":",
"groups",
"=",
"zapi",
".",
"hostgroup",
".",
"get",
"(",
"monitored_hosts",
"=",
"True",
")",
"for",
"group",
"in",
"groups",
":",
"if",
"group",
"[",
"'name'",
"]",
"==",
"hostgroup",
... | Retrieves the hostgroup id for a given group. | [
"Retrieves",
"the",
"hostgroup",
"id",
"for",
"a",
"given",
"group",
"."
] | [
"\"\"\"Retrieves the hostgroup id for a given group.\n\n :param zapi: reference to the zabbix api\n :type zapi: zabbix api\n :param hostgroup: specifies the host group\n :type hostgroup: str\n :return: list of hosts\n \"\"\""
] | [
{
"param": "zapi",
"type": null
},
{
"param": "hostgroup",
"type": null
}
] | {
"returns": [
{
"docstring": "list of hosts",
"docstring_tokens": [
"list",
"of",
"hosts"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zapi",
"type": null,
"docstring": "reference to the zabbix api",
"docstri... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | _get_hosts_in_groups | <not_specific> | def _get_hosts_in_groups(zapi, hostgroup):
"""Retrieves the hosts from a specific group.
:param config: config for zapi
:type config: dict
:param hostgroup: specifies the host group
:type hostgroup: str
:return: list of hosts
"""
groupid = _hostgroup_to_id(zapi, hostgroup)
if groupi... | Retrieves the hosts from a specific group.
:param config: config for zapi
:type config: dict
:param hostgroup: specifies the host group
:type hostgroup: str
:return: list of hosts
| Retrieves the hosts from a specific group. | [
"Retrieves",
"the",
"hosts",
"from",
"a",
"specific",
"group",
"."
] | def _get_hosts_in_groups(zapi, hostgroup):
groupid = _hostgroup_to_id(zapi, hostgroup)
if groupid is None:
return
hosts = zapi.host.get(groupids=groupid)
return hosts | [
"def",
"_get_hosts_in_groups",
"(",
"zapi",
",",
"hostgroup",
")",
":",
"groupid",
"=",
"_hostgroup_to_id",
"(",
"zapi",
",",
"hostgroup",
")",
"if",
"groupid",
"is",
"None",
":",
"return",
"hosts",
"=",
"zapi",
".",
"host",
".",
"get",
"(",
"groupids",
... | Retrieves the hosts from a specific group. | [
"Retrieves",
"the",
"hosts",
"from",
"a",
"specific",
"group",
"."
] | [
"\"\"\"Retrieves the hosts from a specific group.\n\n :param config: config for zapi\n :type config: dict\n :param hostgroup: specifies the host group\n :type hostgroup: str\n :return: list of hosts\n \"\"\""
] | [
{
"param": "zapi",
"type": null
},
{
"param": "hostgroup",
"type": null
}
] | {
"returns": [
{
"docstring": "list of hosts",
"docstring_tokens": [
"list",
"of",
"hosts"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zapi",
"type": null,
"docstring": null,
"docstring_tokens": [],
"de... |
f8433e49da1ddd5104c516d280c0e6c297864ec8 | bergzand/matrix-zabbix-bot | zabbix.py | [
"Apache-2.0"
] | Python | _get_itemvalue | <not_specific> | def _get_itemvalue(zapi, hostid, keys):
"""Retrieves the value for a hostid - key combination.
:param zapi: the zabbix api reference
:type zapi: zapi
:param hostid: the id of the host
:type hostid: str
:param keys: keys to retrieve
:type keys: str or list
"""
if isinstance(keys, str... | Retrieves the value for a hostid - key combination.
:param zapi: the zabbix api reference
:type zapi: zapi
:param hostid: the id of the host
:type hostid: str
:param keys: keys to retrieve
:type keys: str or list
| Retrieves the value for a hostid - key combination. | [
"Retrieves",
"the",
"value",
"for",
"a",
"hostid",
"-",
"key",
"combination",
"."
] | def _get_itemvalue(zapi, hostid, keys):
if isinstance(keys, str):
keys = [keys]
data = []
for key in keys:
value = zapi.item.get(hostids=hostid, search={'key_': key})
if value:
data.append(value[0]['lastvalue'])
return data | [
"def",
"_get_itemvalue",
"(",
"zapi",
",",
"hostid",
",",
"keys",
")",
":",
"if",
"isinstance",
"(",
"keys",
",",
"str",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"data",
"=",
"[",
"]",
"for",
"key",
"in",
"keys",
":",
"value",
"=",
"zapi",
".",
... | Retrieves the value for a hostid - key combination. | [
"Retrieves",
"the",
"value",
"for",
"a",
"hostid",
"-",
"key",
"combination",
"."
] | [
"\"\"\"Retrieves the value for a hostid - key combination.\n\n :param zapi: the zabbix api reference\n :type zapi: zapi\n :param hostid: the id of the host\n :type hostid: str\n :param keys: keys to retrieve\n :type keys: str or list\n \"\"\""
] | [
{
"param": "zapi",
"type": null
},
{
"param": "hostid",
"type": null
},
{
"param": "keys",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "zapi",
"type": null,
"docstring": "the zabbix api reference",
"docstring_tokens": [
"the",
"zabbix",
"api",
"reference"
],
"default": null,
"is_optional": null
},
{
... |
9b94768ed7a5bd3ff6c8b93529f9165e28ac7a5a | bergzand/matrix-zabbix-bot | matrix.py | [
"Apache-2.0"
] | Python | read_config | <not_specific> | def read_config(config_file, conf_section='Matrix'):
"""Reads a matrix config file.
:param config_file: path to the config file
:type config_file: str
:param conf_section: section of the config file to read
:type conf_section: str
:return: config dictionary
"""
config_file = os.path.exp... | Reads a matrix config file.
:param config_file: path to the config file
:type config_file: str
:param conf_section: section of the config file to read
:type conf_section: str
:return: config dictionary
| Reads a matrix config file. | [
"Reads",
"a",
"matrix",
"config",
"file",
"."
] | def read_config(config_file, conf_section='Matrix'):
config_file = os.path.expanduser(config_file)
if os.path.isfile(config_file) is False:
raise FileNotFoundError('config file "{0}" not found'.format(
config_file))
config = configparser.ConfigParser()
config.optionxform = str
co... | [
"def",
"read_config",
"(",
"config_file",
",",
"conf_section",
"=",
"'Matrix'",
")",
":",
"config_file",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"config_file",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"config_file",
")",
"is",
"False",
"... | Reads a matrix config file. | [
"Reads",
"a",
"matrix",
"config",
"file",
"."
] | [
"\"\"\"Reads a matrix config file.\n\n :param config_file: path to the config file\n :type config_file: str\n :param conf_section: section of the config file to read\n :type conf_section: str\n :return: config dictionary\n \"\"\""
] | [
{
"param": "config_file",
"type": null
},
{
"param": "conf_section",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": "path to the config file",
"docstring_tokens": [
"path",
"... |
9b94768ed7a5bd3ff6c8b93529f9165e28ac7a5a | bergzand/matrix-zabbix-bot | matrix.py | [
"Apache-2.0"
] | Python | merge_config | <not_specific> | def merge_config(args, config):
"""This function merges the args and the config together.
The command line arguments are prioritized over the configured values.
:param args: command line arguments
:type args: dict
:param config: option from the config file
:type config: dict
:return: dict w... | This function merges the args and the config together.
The command line arguments are prioritized over the configured values.
:param args: command line arguments
:type args: dict
:param config: option from the config file
:type config: dict
:return: dict with values merged
| This function merges the args and the config together.
The command line arguments are prioritized over the configured values. | [
"This",
"function",
"merges",
"the",
"args",
"and",
"the",
"config",
"together",
".",
"The",
"command",
"line",
"arguments",
"are",
"prioritized",
"over",
"the",
"configured",
"values",
"."
] | def merge_config(args, config):
for key, value in args.items():
if value is not None:
config[key] = value
if 'domain' not in config:
config['domain'] = config['homeserver']
return config | [
"def",
"merge_config",
"(",
"args",
",",
"config",
")",
":",
"for",
"key",
",",
"value",
"in",
"args",
".",
"items",
"(",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"config",
"[",
"key",
"]",
"=",
"value",
"if",
"'domain'",
"not",
"in",
"... | This function merges the args and the config together. | [
"This",
"function",
"merges",
"the",
"args",
"and",
"the",
"config",
"together",
"."
] | [
"\"\"\"This function merges the args and the config together.\n The command line arguments are prioritized over the configured values.\n\n :param args: command line arguments\n :type args: dict\n :param config: option from the config file\n :type config: dict\n :return: dict with values merged\n ... | [
{
"param": "args",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [
{
"docstring": "dict with values merged",
"docstring_tokens": [
"dict",
"with",
"values",
"merged"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": "command line ... |
9b94768ed7a5bd3ff6c8b93529f9165e28ac7a5a | bergzand/matrix-zabbix-bot | matrix.py | [
"Apache-2.0"
] | Python | send_message | null | def send_message(config, room):
"""Sends a message into the room. The config dictionary hold the message.
:param config: config dictionary
:type config: dictionary
:param room: reference to the Matrix room
:type room: MatrixClient.room
"""
message = config['message']
logging.debug('send... | Sends a message into the room. The config dictionary hold the message.
:param config: config dictionary
:type config: dictionary
:param room: reference to the Matrix room
:type room: MatrixClient.room
| Sends a message into the room. The config dictionary hold the message. | [
"Sends",
"a",
"message",
"into",
"the",
"room",
".",
"The",
"config",
"dictionary",
"hold",
"the",
"message",
"."
] | def send_message(config, room):
message = config['message']
logging.debug('sending message:\n%s', message)
room.send_html(message, msgtype=config['message_type']) | [
"def",
"send_message",
"(",
"config",
",",
"room",
")",
":",
"message",
"=",
"config",
"[",
"'message'",
"]",
"logging",
".",
"debug",
"(",
"'sending message:\\n%s'",
",",
"message",
")",
"room",
".",
"send_html",
"(",
"message",
",",
"msgtype",
"=",
"conf... | Sends a message into the room. | [
"Sends",
"a",
"message",
"into",
"the",
"room",
"."
] | [
"\"\"\"Sends a message into the room. The config dictionary hold the message.\n\n :param config: config dictionary\n :type config: dictionary\n :param room: reference to the Matrix room\n :type room: MatrixClient.room\n \"\"\""
] | [
{
"param": "config",
"type": null
},
{
"param": "room",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "room",
"type": null,
"docstring": "referenc... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _room_init | <not_specific> | def _room_init(room):
"""Boilerplate code for identifying the room.
:param room: reference to the room
:type room: matrix room object
:return: room_id, zabbix_config
"""
room_id = room.room_id.split(':')[0]
logging.debug('got a message from room: %s', room_id)
if room_id in config:
... | Boilerplate code for identifying the room.
:param room: reference to the room
:type room: matrix room object
:return: room_id, zabbix_config
| Boilerplate code for identifying the room. | [
"Boilerplate",
"code",
"for",
"identifying",
"the",
"room",
"."
] | def _room_init(room):
room_id = room.room_id.split(':')[0]
logging.debug('got a message from room: %s', room_id)
if room_id in config:
zabbix_config = _zabbix_config(room_id)
else:
raise RuntimeError('room_id "{0}" is unkown'.format(room_id))
return (room_id, zabbix_config) | [
"def",
"_room_init",
"(",
"room",
")",
":",
"room_id",
"=",
"room",
".",
"room_id",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"logging",
".",
"debug",
"(",
"'got a message from room: %s'",
",",
"room_id",
")",
"if",
"room_id",
"in",
"config",
":",
... | Boilerplate code for identifying the room. | [
"Boilerplate",
"code",
"for",
"identifying",
"the",
"room",
"."
] | [
"\"\"\"Boilerplate code for identifying the room.\n\n :param room: reference to the room\n :type room: matrix room object\n :return: room_id, zabbix_config\n \"\"\""
] | [
{
"param": "room",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "room",
"type": null,
"docstring": "reference to the room",
"docstring_tokens": [
"reference",
"to",... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_config | <not_specific> | def _zabbix_config(room_id):
"""Returns the zabbix configuration for a given room_id.
:param room_id: the Matrix room id
:type room_id: str
:return: zabbix config directionary
"""
zabbix_realm = config[room_id]
zabbix_config = matrix.read_config(config['config'],
... | Returns the zabbix configuration for a given room_id.
:param room_id: the Matrix room id
:type room_id: str
:return: zabbix config directionary
| Returns the zabbix configuration for a given room_id. | [
"Returns",
"the",
"zabbix",
"configuration",
"for",
"a",
"given",
"room_id",
"."
] | def _zabbix_config(room_id):
zabbix_realm = config[room_id]
zabbix_config = matrix.read_config(config['config'],
zabbix_realm)
logging.debug('using zabbix realm: %s\nconfig:\n%s',
zabbix_realm, zabbix_config)
return zabbix_config | [
"def",
"_zabbix_config",
"(",
"room_id",
")",
":",
"zabbix_realm",
"=",
"config",
"[",
"room_id",
"]",
"zabbix_config",
"=",
"matrix",
".",
"read_config",
"(",
"config",
"[",
"'config'",
"]",
",",
"zabbix_realm",
")",
"logging",
".",
"debug",
"(",
"'using za... | Returns the zabbix configuration for a given room_id. | [
"Returns",
"the",
"zabbix",
"configuration",
"for",
"a",
"given",
"room_id",
"."
] | [
"\"\"\"Returns the zabbix configuration for a given room_id.\n\n :param room_id: the Matrix room id\n :type room_id: str\n :return: zabbix config directionary\n \"\"\""
] | [
{
"param": "room_id",
"type": null
}
] | {
"returns": [
{
"docstring": "zabbix config directionary",
"docstring_tokens": [
"zabbix",
"config",
"directionary"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "room_id",
"type": null,
"docstring": "the Matrix room... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _error | null | def _error(matrix_config, room, error):
"""Error handling function. Prints a traceback to the log and the
title of the error is returned to matrix.
:param matrix_config: the matrix configuration
:type matrix_config: dict
:param room: matrix room reference
:type room: matrix room object
:par... | Error handling function. Prints a traceback to the log and the
title of the error is returned to matrix.
:param matrix_config: the matrix configuration
:type matrix_config: dict
:param room: matrix room reference
:type room: matrix room object
:param error: reference to the exception
:type ... | Error handling function. Prints a traceback to the log and the
title of the error is returned to matrix. | [
"Error",
"handling",
"function",
".",
"Prints",
"a",
"traceback",
"to",
"the",
"log",
"and",
"the",
"title",
"of",
"the",
"error",
"is",
"returned",
"to",
"matrix",
"."
] | def _error(matrix_config, room, error):
logging.error(error, exc_info=True)
message = "{0}<br /><br />Please see my log.".format(
str(error))
matrix_config['message'] = message
matrix.send_message(matrix_config, room) | [
"def",
"_error",
"(",
"matrix_config",
",",
"room",
",",
"error",
")",
":",
"logging",
".",
"error",
"(",
"error",
",",
"exc_info",
"=",
"True",
")",
"message",
"=",
"\"{0}<br /><br />Please see my log.\"",
".",
"format",
"(",
"str",
"(",
"error",
")",
")"... | Error handling function. | [
"Error",
"handling",
"function",
"."
] | [
"\"\"\"Error handling function. Prints a traceback to the log and the\n title of the error is returned to matrix.\n\n :param matrix_config: the matrix configuration\n :type matrix_config: dict\n :param room: matrix room reference\n :type room: matrix room object\n :param error: reference to the ex... | [
{
"param": "matrix_config",
"type": null
},
{
"param": "room",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "matrix_config",
"type": null,
"docstring": "the matrix configuration",
"docstring_tokens": [
"the",
"matrix",
"configuration"
],
"default": null,
"is_optional": null
},
{
... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_help | <not_specific> | def _zabbix_help():
"""Returns the help text for the !zabbix command.
"""
help_text = (
"Usage: !zabbix {arguments}"
"<br /><br />"
"This command returns info about Zabbix (triggers mostly)."
"<br />"
"Currently supported arguments:"
"<br /><br />"
"he... | Returns the help text for the !zabbix command.
| Returns the help text for the !zabbix command. | [
"Returns",
"the",
"help",
"text",
"for",
"the",
"!zabbix",
"command",
"."
] | def _zabbix_help():
help_text = (
"Usage: !zabbix {arguments}"
"<br /><br />"
"This command returns info about Zabbix (triggers mostly)."
"<br />"
"Currently supported arguments:"
"<br /><br />"
"help: shows this message"
"<br />"
"all: retriev... | [
"def",
"_zabbix_help",
"(",
")",
":",
"help_text",
"=",
"(",
"\"Usage: !zabbix {arguments}\"",
"\"<br /><br />\"",
"\"This command returns info about Zabbix (triggers mostly).\"",
"\"<br />\"",
"\"Currently supported arguments:\"",
"\"<br /><br />\"",
"\"help: shows this message\"",
"\... | Returns the help text for the !zabbix command. | [
"Returns",
"the",
"help",
"text",
"for",
"the",
"!zabbix",
"command",
"."
] | [
"\"\"\"Returns the help text for the !zabbix command.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_unacked_triggers | <not_specific> | def _zabbix_unacked_triggers(zabbix_config):
"""Retrieves the unacked triggers from zabbix.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
"""
messages = []
triggers = zabbix.get_unacked_triggers(zabbix_config)
color_config = {... | Retrieves the unacked triggers from zabbix.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
| Retrieves the unacked triggers from zabbix. | [
"Retrieves",
"the",
"unacked",
"triggers",
"from",
"zabbix",
"."
] | def _zabbix_unacked_triggers(zabbix_config):
messages = []
triggers = zabbix.get_unacked_triggers(zabbix_config)
color_config = {}
for key, value in matrix.read_config(config['config'], 'Colors').items():
if key.startswith('zabbix'):
key = key.replace('zabbix_', '')
color... | [
"def",
"_zabbix_unacked_triggers",
"(",
"zabbix_config",
")",
":",
"messages",
"=",
"[",
"]",
"triggers",
"=",
"zabbix",
".",
"get_unacked_triggers",
"(",
"zabbix_config",
")",
"color_config",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"matrix",
".",
"... | Retrieves the unacked triggers from zabbix. | [
"Retrieves",
"the",
"unacked",
"triggers",
"from",
"zabbix",
"."
] | [
"\"\"\"Retrieves the unacked triggers from zabbix.\n\n :param zabbix_config: zabbix configuration\n :type zabbix_config: dict\n :return: messages to return to matrix\n \"\"\""
] | [
{
"param": "zabbix_config",
"type": null
}
] | {
"returns": [
{
"docstring": "messages to return to matrix",
"docstring_tokens": [
"messages",
"to",
"return",
"to",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zabbix_config",
"type": null,
... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_acked_triggers | <not_specific> | def _zabbix_acked_triggers(zabbix_config):
"""Retrieves the acked triggers from zabbix.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
"""
messages = []
triggers = zabbix.get_acked_triggers(zabbix_config)
color_config = {}
... | Retrieves the acked triggers from zabbix.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
| Retrieves the acked triggers from zabbix. | [
"Retrieves",
"the",
"acked",
"triggers",
"from",
"zabbix",
"."
] | def _zabbix_acked_triggers(zabbix_config):
messages = []
triggers = zabbix.get_acked_triggers(zabbix_config)
color_config = {}
for key, value in matrix.read_config(config['config'], 'Colors').items():
if key.startswith('zabbix'):
key = key.replace('zabbix_', '')
color_con... | [
"def",
"_zabbix_acked_triggers",
"(",
"zabbix_config",
")",
":",
"messages",
"=",
"[",
"]",
"triggers",
"=",
"zabbix",
".",
"get_acked_triggers",
"(",
"zabbix_config",
")",
"color_config",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"matrix",
".",
"read... | Retrieves the acked triggers from zabbix. | [
"Retrieves",
"the",
"acked",
"triggers",
"from",
"zabbix",
"."
] | [
"\"\"\"Retrieves the acked triggers from zabbix.\n\n :param zabbix_config: zabbix configuration\n :type zabbix_config: dict\n :return: messages to return to matrix\n \"\"\""
] | [
{
"param": "zabbix_config",
"type": null
}
] | {
"returns": [
{
"docstring": "messages to return to matrix",
"docstring_tokens": [
"messages",
"to",
"return",
"to",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zabbix_config",
"type": null,
... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_all_triggers | <not_specific> | def _zabbix_all_triggers(zabbix_config):
"""Retrieves the all triggers from zabbix regardless of their
status.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
"""
messages = []
triggers = zabbix.get_triggers(zabbix_config)
c... | Retrieves the all triggers from zabbix regardless of their
status.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:return: messages to return to matrix
| Retrieves the all triggers from zabbix regardless of their
status. | [
"Retrieves",
"the",
"all",
"triggers",
"from",
"zabbix",
"regardless",
"of",
"their",
"status",
"."
] | def _zabbix_all_triggers(zabbix_config):
messages = []
triggers = zabbix.get_triggers(zabbix_config)
color_config = {}
for key, value in matrix.read_config(config['config'], 'Colors').items():
if key.startswith('zabbix'):
key = key.replace('zabbix_', '')
color_config[key]... | [
"def",
"_zabbix_all_triggers",
"(",
"zabbix_config",
")",
":",
"messages",
"=",
"[",
"]",
"triggers",
"=",
"zabbix",
".",
"get_triggers",
"(",
"zabbix_config",
")",
"color_config",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"matrix",
".",
"read_config"... | Retrieves the all triggers from zabbix regardless of their
status. | [
"Retrieves",
"the",
"all",
"triggers",
"from",
"zabbix",
"regardless",
"of",
"their",
"status",
"."
] | [
"\"\"\"Retrieves the all triggers from zabbix regardless of their\n status.\n\n :param zabbix_config: zabbix configuration\n :type zabbix_config: dict\n :return: messages to return to matrix\n \"\"\""
] | [
{
"param": "zabbix_config",
"type": null
}
] | {
"returns": [
{
"docstring": "messages to return to matrix",
"docstring_tokens": [
"messages",
"to",
"return",
"to",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zabbix_config",
"type": null,
... |
5537a97283785e954381b68b74364d84fa2a75f6 | bergzand/matrix-zabbix-bot | zabbix_bot.py | [
"Apache-2.0"
] | Python | _zabbix_acknowledge_trigger | <not_specific> | def _zabbix_acknowledge_trigger(zabbix_config, trigger_id):
"""Acknowledges a trigger with the given id.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:param trigger_id: id to acknowledge
:type trigger_id: int
:return: messages to return to matrix
"""
messages = [... | Acknowledges a trigger with the given id.
:param zabbix_config: zabbix configuration
:type zabbix_config: dict
:param trigger_id: id to acknowledge
:type trigger_id: int
:return: messages to return to matrix
| Acknowledges a trigger with the given id. | [
"Acknowledges",
"a",
"trigger",
"with",
"the",
"given",
"id",
"."
] | def _zabbix_acknowledge_trigger(zabbix_config, trigger_id):
messages = []
messages.append(zabbix.ack(zabbix_config, trigger_id))
return "<br />".join(messages) | [
"def",
"_zabbix_acknowledge_trigger",
"(",
"zabbix_config",
",",
"trigger_id",
")",
":",
"messages",
"=",
"[",
"]",
"messages",
".",
"append",
"(",
"zabbix",
".",
"ack",
"(",
"zabbix_config",
",",
"trigger_id",
")",
")",
"return",
"\"<br />\"",
".",
"join",
... | Acknowledges a trigger with the given id. | [
"Acknowledges",
"a",
"trigger",
"with",
"the",
"given",
"id",
"."
] | [
"\"\"\"Acknowledges a trigger with the given id.\n\n :param zabbix_config: zabbix configuration\n :type zabbix_config: dict\n :param trigger_id: id to acknowledge\n :type trigger_id: int\n :return: messages to return to matrix\n \"\"\""
] | [
{
"param": "zabbix_config",
"type": null
},
{
"param": "trigger_id",
"type": null
}
] | {
"returns": [
{
"docstring": "messages to return to matrix",
"docstring_tokens": [
"messages",
"to",
"return",
"to",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "zabbix_config",
"type": null,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.