seismicrna.core.arg package
CLI arguments/options: import directly from submodules (e.g. from ..arg.<submodule> import <name>).
Subpackages
Submodules
- seismicrna.core.arg.cli.merge_params(*param_lists: list[Parameter], exclude: Iterable[Parameter] = ())
Merge lists of Click parameters, dropping duplicates.
- seismicrna.core.arg.docdef.auto(*, extra_defaults: dict[str, Any] | None = None, exclude_defaults: Iterable[str] = (), extra_docstrs: dict[str, str] | None = None, return_docstr: str = '')
Combine auto_defaults and auto_docstrs, in that order.
- seismicrna.core.arg.docdef.auto_defaults(extra_defaults: dict[str, Any] | None = None, exclude_defaults: Iterable[str] = ())
Call paramdef and automatically infer default values from the CLI and API. Extra defaults (if needed) may be given as keyword arguments.
- seismicrna.core.arg.docdef.auto_docstrs(extra_docstrs: dict[str, str] | None = None, return_docstr: str = '')
Call param_docstrs and automatically infer descriptions and type annotations about all parameters from the CLI and API. Documentation of any extra parameters may also be given.
- seismicrna.core.arg.docdef.get_docstr_lines(func: Callable, param_lines: list[str], return_docstr: str)
Assemble docstring lines for a function.
- Parameters:
func (
Callable) – Function whose existing docstring and return annotation are used as the basis for the new docstring.param_lines (
list[str]) – Lines describing each parameter, as produced by get_param_lines.return_docstr (
str) – Description of the return value; included only when the function has a return annotation.
- seismicrna.core.arg.docdef.get_param_default(param: Parameter, defaults: dict[str, Any], exclude_defaults: Iterable[str])
Return the parameter, possibly with a new default value.
- seismicrna.core.arg.docdef.param_defaults(defaults: dict[str, Any], exclude_defaults: Iterable[str] = ())
Give the keyword argments of a function default values.
- seismicrna.core.arg.docdef.param_docstrs(docstrs: dict[str, str], return_docstr: str)
Give a function a new docstring where each parameter gets annotated with the text given in the keyword arguments (param_docs).
- Parameters:
docstrs (
dict[str,str]) – Description of each parameter, keyed by namereturn_docstr (
str) – Description of the return value; will occur at end of docstring
- Returns:
Function with new docstring
- Return type:
callable
- class seismicrna.core.arg.glob.GlobPath(exists: bool = False, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: type | None = None, executable: bool = False)
Bases:
PathA click.Path that expands glob patterns via Python’s glob module.
- convert(value, param, ctx)
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.- Parameters:
value – The value to convert.
param – The parameter that is using this type to convert its value. May be
None.ctx – The current context that arrived at this value. May be
None.
- seismicrna.core.arg.glob.expand_ct_pos_5(ctx, param, value)
Pair each glob-expanded path with its associated integer position.
- seismicrna.core.arg.glob.flatten_glob_results(ctx, param, value)
Flatten a multiple=True value where entries may be tuples of paths.