plafosim package

Subpackages

Submodules

Module contents

class plafosim.CustomFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: ArgumentDefaultsHelpFormatter, RawDescriptionHelpFormatter, MetavarTypeHelpFormatter

Metaclass combining multiple formatter classes for argparse.

class _Section(formatter, parent, heading=None)

Bases: object

__init__(formatter, parent, heading=None)
format_help()
__init__(prog, indent_increment=2, max_help_position=24, width=None)
_add_item(func, args)
_dedent()
_expand_help(action)
_fill_text(text, width, indent)
_format_action(action)
_format_action_invocation(action)
_format_actions_usage(actions, groups)
_format_args(action, default_metavar)
_format_text(text)
_format_usage(usage, actions, groups, prefix)
_get_default_metavar_for_optional(action)
_get_default_metavar_for_positional(action)
_get_help_string(action)
_indent()
_iter_indented_subactions(action)
_join_parts(part_strings)
_metavar_formatter(action, default_metavar)
_split_lines(text, width)
add_argument(action)
add_arguments(actions)
add_text(text)
add_usage(usage, actions, groups, prefix=None)
end_section()
format_help()
start_section(heading)
plafosim.add_logging_level(level_name: str, level_num: int, method_name: str | None = None)[source]

Comprehensively adds a new logging level to the logging module and the currently configured logging class.

level_name becomes an attribute of the logging module with the value level_num. method_name becomes a convenience method for both logging itself and the class returned by logging.getLoggerClass() (usually just logging.Logger). If method_name is not specified, level_name.lower() is used.

To avoid accidental clobberings of existing attributes, this method will raise an AttributeError if the level name is already an attribute of the logging module or if the method name is already present.

Taken from https://stackoverflow.com/a/35804945.

Parameters:
  • level_name (str) – The name of the level to add

  • level_num (int) – The number of the level to add

  • method_name (str) – The name of the method for the level to add