typeddfs.utils.cli_helpο
Utils for getting nice CLI help on DataFrame inputs.
Attention
The exact text used in this module are subject to change.
Note
Two consecutive newlines (\n\n) are used to separate sections.
This is consistent with a number of formats, including Markdown,
reStructuredText, and Typer.
Module Contentsο
- class typeddfs.utils.cli_help.DfCliHelpο
- classmethod help(cls, clazz: Type[typeddfs.abs_dfs.AbsDf]) DfHelpο
Returns info suitable for CLI help.
Display this info as the help description for an argument thatβs a path to a table file that will be read with
typeddfs.abs_dfs.AbsDf.read_file()forclazz.- Parameters
clazz β The
typeddfs.typed_dfs.AbsDfsubclass
- classmethod list_formats(cls, *, flexwf_sep: str = _FLEXWF_SEP, hdf_key: str = _HDF_KEY, toml_aot: str = _TOML_AOT) DfFormatsHelpο
Lists all file formats with descriptions.
For example,
typeddfs.file_formats.FileFormat.odsis βOpenDocument Spreadsheetβ.
- class typeddfs.utils.cli_help.DfFormatHelpο
Help text on a specific file format.
- desc :strο
- fmt :typeddfs.file_formats.FileFormatο
- property all_suffixes(self) Sequence[str]ο
Returns all suffixes, naturally sorted.
- property bare_suffixes(self) Sequence[str]ο
Returns all suffixes, excluding compressed variants (etc.
.gz), naturally sorted.
- get_text(self) strο
Returns a 1-line string of the suffixes and format description.
- class typeddfs.utils.cli_help.DfFormatsHelpο
Help on file formats only.
Initialize self. See help(type(self)) for accurate signature.
- get_long_text(self, *, recommended_only: bool = False, nl: str = '\n', bullet: str = '- ', indent: str = ' ') strο
Returns a multi-line text listing of allowed file formats.
- Parameters
recommended_only β Skip non-recommended file formats
nl β Newline characters; use βnβ, β\nβ, or β β
bullet β Prepended to each item
indent β Spaces for nested indent
- Returns
- Something like::
[[ Supported formats ]]:
.csv[.bz2/.gz/.xz/.zip]: comma-delimited
.parquet/.snappy: Parquet
.h5/.hdf/.hdf5: HDF5 (key βdfβ) [discouraged]
.pickle/.pkl: Python Pickle [discouraged]
- get_short_text(self, *, recommended_only: bool = False) strο
Returns a single-line text listing of allowed file formats.
- Parameters
recommended_only β Skip non-recommended file formats
- Returns
- Something like::
.csv, .tsv/.tab, or .flexwf [.gz,/.xz,/.zip/.bz2]; .feather, .pickle, or .snappy β¦
- class typeddfs.utils.cli_help.DfHelpο
Info on a TypedDf suitable for CLI help.
- clazz :Type[typeddfs.abs_dfs.AbsDf]ο
- formats :DfFormatsHelpο
- get_header_text(self, *, use_doc: bool = True, nl: str = '\n') strο
Returns a multi-line header of the DataFrame name and docstring.
- Parameters
use_doc β Include the docstring, as long as it is not
Nonenl β Newline characters; use βnβ, βnnβ, or β β
- Returns
- Something like::
Path to a Big Table file.
This is a big table for big things.
- get_long_text(self, *, use_doc: bool = True, recommended_only: bool = False, nl: str = '\n', bullet: str = '- ', indent: str = ' ') strο
Returns a multi-line text description of the DataFrame. Includes its required and optional columns, and supported file formats.
- Parameters
use_doc β Include the docstring of the DataFrame type
recommended_only β Only include recommended formats
nl β Newline characters; use βnβ, βnnβ, or β β
bullet β Prepended to each item
indent β Spaces for nested indent
- abstract get_long_typing_text(self) strο
Returns multi-line text on only the required columns / structure.
- get_short_text(self, *, use_doc: bool = True, recommended_only: bool = False, nl: str = '\n') strο
Returns a multi-line description with compressed text.
- Parameters
use_doc β Include the docstring of the DataFrame type
recommended_only β Only include recommended formats
nl β Newline characters; use βnβ, β\nβ, or β β
- abstract get_short_typing_text(self) strο
Returns 1-line text on only the required columns / structure.
- property typing(self) typeddfs.df_typing.DfTypingο