macropipe.util

Attributes

PythonDataType

Functions

decode_list(→ List[str])

Decode comma-separated strings to a list of strings.

gettype(→ PythonDataType)

Lexical cast from string to type.

ignoreargs(func, count)

Decorator that removes a certain number of arguments from the call.

to_json(→ Optional[str])

Convert Python-encoded dictionary into pure JSON.

Module Contents

type macropipe.util.PythonDataType = type
macropipe.util.decode_list(data: str | List[str]) List[str]

Decode comma-separated strings to a list of strings.

macropipe.util.gettype(name: str) PythonDataType

Lexical cast from string to type. https://stackoverflow.com/a/29831586

TODO: Please verify if pydoc.locate() is a safe call

and/or investigate if a better solution exists.

macropipe.util.ignoreargs(func, count)

Decorator that removes a certain number of arguments from the call. https://stackoverflow.com/a/32922362

macropipe.util.to_json(value: str | None = None, strict: bool = False) str | None

Convert Python-encoded dictionary into pure JSON.

Note: The python_to_json method uses ast.literal_eval() which, while safer

than eval(), still parses arbitrary Python literal expressions from input data. Additionally, map_elements disables Polars’ parallelization.