asyncutils.tools#
Utilities related to the command-line interface and getting metadata for package configuration.
Functions#
|
Parses the shell-escaped string representing the command-line arguments for this module and writes it into a .json path. |
|
|
|
Get the URL of the |
|
Get the format of .json configs this module takes as a string. |
|
Return the command line help as a string containing ANSI color escape sequences. |
|
Essentially the output of |
|
|
|
Load the file at |
|
Open the URL to the documentation of the specified symbol defined in |
|
Print the above format into the specified file and flush it (default |
|
Print the above help into the specified file (default |
Module Contents#
- asyncutils.tools.argstr_to_json(argstr: str, path: asyncutils._internal.types.Openable, /, *, dump: asyncutils._internal.types.DumpType = ..., split: _collections_abc.Callable[[str], _collections_abc.Sequence[str]] = ...) None[source]#
Parses the shell-escaped string representing the command-line arguments for this module and writes it into a .json path.
- asyncutils.tools.argv_to_json(argv: _collections_abc.Sequence[str], path: asyncutils._internal.types.Openable, /, *, dump: asyncutils._internal.types.DumpType = ...) None[source]#
- Writes the sequence of strings, parsed as command-line arguments for this module, into
pathin JSON format.Since this function is ‘environment-agnostic’, it may have unintended behaviour if the arguments passed rely on current configuration, which is not captured.
- asyncutils.tools.find_help_url(obj: Any = ..., /) str[source]#
Get the URL of the
asyncutilsdocumentation page forobj. See the supported calling patterns here.Caution
The URL returned is not guaranteed to work with strings representing non-existent, undocumented or internal symbols.
- asyncutils.tools.get_cfg_json_format() str[source]#
Get the format of .json configs this module takes as a string.
print_cfg_json_format()is perhaps more useful.
- asyncutils.tools.get_cmd_help() str#
Return the command line help as a string containing ANSI color escape sequences.
Implementation detail
This actually a bound method of the library’s argument parser at runtime.
- asyncutils.tools.json_to_argstr(path: asyncutils._internal.types.Openable, /, *, join: _collections_abc.Callable[[list[str]], str] = ...) str[source]#
Essentially the output of
json_to_argv(), but joined into a shell-escaped string withjoin.
- asyncutils.tools.json_to_argv(path: asyncutils._internal.types.Openable, /) list[str][source]#
- Return a list of strings representing the command-line arguments for this module from
pathto the corresponding json file, with as little items as possible.For integer file descriptors aspath, the format is assumed to be plain JSON.The module, should have aload()function that takespathand returns a dict of its contents.Perfect round-trip conversion withargv_to_json()is guaranteed only with no other configuration file active.
- asyncutils.tools.loadf(path: asyncutils._internal.types.Openable, ext: str = ..., /) dict[str, Any][source]#
Load the file at
path, with the specified file extension if indeducible from the file name, into a dictionary using the correct library.
- asyncutils.tools.open_help(obj: Any = ..., /) bool[source]#
Open the URL to the documentation of the specified symbol defined in
asyncutilsvia the default browser, returning success.