module documentation

Main functions to be called by the UI Application classes, after CLI option parsing.

Function dump_json_to_nestedtext Read JSON from stdin or input_files, and send NestedText to stdout.
Function dump_json_to_schema Read JSON from stdin or input_files, and send a NestedText schema to stdout.
Function dump_nestedtext_to_json Read NestedText from stdin or input_files, and send up-typed JSON to stdout.
Function dump_nestedtext_to_toml Read NestedText from stdin or input_files, and send up-typed TOML to stdout.
Function dump_nestedtext_to_yaml Read NestedText from stdin or input_files, and send up-typed YAML to stdout.
Function dump_toml_to_nestedtext Read TOML from stdin or input_files, and send NestedText to stdout.
Function dump_toml_to_schema Read TOML from stdin or input_files, and send a NestedText schema to stdout.
Function dump_yaml_to_nestedtext Read YAML from stdin or input_files, and send NestedText to stdout.
Function dump_yaml_to_schema Read YAML from stdin or input_files, and send a NestedText schema to stdout.
Function jdump Pretty-print the data as JSON, with color if interactive, to stdout.
Function jloads Wrap json.loads so that on failure it tries parsing as JSON Lines.
Function ntdump Pretty-print the data as NestedText, with color if interactive, to stdout.
Function ntload Wrap nestedtext.load with convenient configuration for this module.
Function tdump Pretty-print the data as TOML, with color if interactive, to stdout.
Function ydump Pretty-print the data as YAML, with color if interactive, to stdout.
Constant RICH Undocumented
Constant YAML_EDITOR Undocumented
Function _dump_typed_data_to_schema Undocumented
Function _require_toml_support If TOML support is not installed, raise an exception.
Function _syntax_print Print a syntax-highlighted rendering of the content to terminal.
def dump_json_to_nestedtext(*input_files: LocalPath): (source)

Read JSON from stdin or input_files, and send NestedText to stdout.

Parameters
*input_files:LocalPathLocalPaths with JSON content.
def dump_json_to_schema(*input_files: LocalPath): (source)

Read JSON from stdin or input_files, and send a NestedText schema to stdout.

Parameters
*input_files:LocalPathLocalPaths with JSON content.
def dump_nestedtext_to_json(*input_files: LocalPath, bool_paths=(), null_paths=(), num_paths=()): (source)

Read NestedText from stdin or input_files, and send up-typed JSON to stdout.

Parameters
*input_files:LocalPathLocalPaths with NestedText content.
bool_pathsYAMLPath queries whose matches will be casted to bool.
null_pathsYAMLPath queries whose matches will be casted to None.
num_pathsYAMLPath queries whose matches will be casted to int/float.
def dump_nestedtext_to_toml(*input_files: LocalPath, bool_paths=(), num_paths=(), date_paths=()): (source)

Read NestedText from stdin or input_files, and send up-typed TOML to stdout.

Parameters
*input_files:LocalPathLocalPaths with NestedText content.
bool_pathsYAMLPath queries whose matches will be casted to bool.
num_pathsYAMLPath queries whose matches will be casted to int/float.
date_pathsYAMLPath queries whose matches will be casted to date/datetime/time.
def dump_nestedtext_to_yaml(*input_files: LocalPath, bool_paths=(), null_paths=(), num_paths=(), date_paths=()): (source)

Read NestedText from stdin or input_files, and send up-typed YAML to stdout.

Parameters
*input_files:LocalPathLocalPaths with NestedText content.
bool_pathsYAMLPath queries whose matches will be casted to bool.
null_pathsYAMLPath queries whose matches will be casted to None.
num_pathsYAMLPath queries whose matches will be casted to int/float.
date_pathsYAMLPath queries whose matches will be casted to date/datetime.
def dump_toml_to_nestedtext(*input_files: LocalPath): (source)

Read TOML from stdin or input_files, and send NestedText to stdout.

Parameters
*input_files:LocalPathLocalPaths with TOML content.
def dump_toml_to_schema(*input_files: LocalPath): (source)

Read TOML from stdin or input_files, and send a NestedText schema to stdout.

Parameters
*input_files:LocalPathLocalPaths with TOML content.
def dump_yaml_to_nestedtext(*input_files: LocalPath): (source)

Read YAML from stdin or input_files, and send NestedText to stdout.

Parameters
*input_files:LocalPathLocalPaths with YAML content.
def dump_yaml_to_schema(*input_files: LocalPath): (source)

Read YAML from stdin or input_files, and send a NestedText schema to stdout.

Parameters
*input_files:LocalPathLocalPaths with YAML content.
def jdump(data: dict | list): (source)

Pretty-print the data as JSON, with color if interactive, to stdout.

Parameters
data:dict | listA dict or list to dump as JSON.
def jloads(content: str) -> dict | list: (source)

Wrap json.loads so that on failure it tries parsing as JSON Lines.

# noqa: DAR401 # noqa: DAR402

Parameters
content:strJSON or JSON Lines content.
Returns
dict | listParsed JSON data as a dict or list (usually the former).
Raises
JSONDecodeErrorUnable to parse content as JSON or JSONLines.
def ntdump(data: dict | list): (source)

Pretty-print the data as NestedText, with color if interactive, to stdout.

Parameters
data:dict | listA dict or list to dump as NestedText.
def ntload(file: Any) -> StringyData: (source)

Wrap nestedtext.load with convenient configuration for this module.

Set top-level type constraint to 'any', and assure the type checker the result is StringyData.

Parameters
file:AnyNestedText file-like object, usually a LocalPath or sys.stdin.
Returns
StringyDataParsed NestedText data as a dict or list of strs.
def tdump(data: dict): (source)

Pretty-print the data as TOML, with color if interactive, to stdout.

Parameters
data:dictA dict to dump as TOML.
def ydump(data: dict | list): (source)

Pretty-print the data as YAML, with color if interactive, to stdout.

Parameters
data:dict | listA dict or list to dump as YAML.
Raises
ExceptionUnexpected problem dumping or highlighting data.

Undocumented

Value
RichConsole()
YAML_EDITOR = (source)

Undocumented

Value
mk_yaml_editor()
def _dump_typed_data_to_schema(typed_data: dict | list): (source)

Undocumented

def _require_toml_support(): (source)

If TOML support is not installed, raise an exception.

Raises
ImportErrorThe libraries for TOML support are absent.
def _syntax_print(content: str, syntax: str, console: RichConsole = RICH): (source)

Print a syntax-highlighted rendering of the content to terminal.

Parameters
content:strAny code to be syntax-highlighted.
syntax:strA syntax name recognized by pygments (via rich).
console:RichConsoleAn initialized Rich Console object used to print with.