sphobjinv.cli.paths

sphobjinv CLI path resolution module.

sphobjinv is a toolkit for manipulation and inspection of Sphinx objects.inv files.

Author

Brian Skinn (brian.skinn@gmail.com)

File Created

19 Nov 2020

Copyright

(c) Brian Skinn 2016-2022

Source Repository

https://github.com/bskinn/sphobjinv

Documentation

https://sphobjinv.readthedocs.io/en/stable

License

Code: MIT License

Docs & Docstrings: CC BY 4.0 International License

See LICENSE.txt for full license terms.

Members

resolve_inpath(in_path)

Resolve the input file, handling invalid values.

Currently, only checks for existence and not-directory.

Parameters

in_pathstr – Path to desired input file

Returns

abs_pathstr – Absolute path to indicated file

Raises

FileNotFoundError – If a file is not found at the given path

resolve_outpath(out_path, in_path, params)

Resolve the output location, handling mode-specific defaults.

If the output path or basename are not specified, they are taken as the same as the input file. If the extension is unspecified, it is taken as the appropriate mode-specific value from DEF_OUT_EXT.

If URL is passed, the input directory is taken to be os.getcwd() and the input basename is taken as DEF_BASENAME.

Parameters
  • out_pathstr or None – Output location provided by the user, or None if omitted

  • in_pathstr – For a local input file, its absolute path. For a URL, the (possibly truncated) URL text.

  • paramsdict – Parameters/values mapping from the active subparser

Returns

out_pathstr – Absolute path to the target output file