gt4sd.frameworks.granular.arg_parser.utils module

Parsing utilities.

Summary

Functions:

convert_string_to_class

Convert a string into a python object.

str2bool

Convert a string into a bool.

Reference

str2bool(s)[source]

Convert a string into a bool.

Parameters

s (Union[str, bool]) – a string representation of a boolean.

Raises

argparse.ArgumentTypeError – in case the conversion is failing.

Return type

bool

Returns

the converted value.

convert_string_to_class(s)[source]

Convert a string into a python object.

Fallback to ast in case of unexpected strings.

Parameters

s (str) – a string.

Returns

the converted python object.