penguin.common module

class penguin.common.PathHighlightingFormatter(fmt=None, datefmt=None, style='%', level_styles=None, field_styles=None)[source]

Bases: ColoredFormatter

format(record)[source]

Apply level-specific styling to log records.

Parameters:

record – A LogRecord object.

Returns:

The result of logging.Formatter.format().

This method injects ANSI escape sequences that are specific to the level of each log record (because such logic cannot be expressed in the syntax of a log format string). It works by making a copy of the log record, changing the msg field inside the copy and passing the copy into the format() method of the base class.

penguin.common.dict_to_frozenset(d)[source]
penguin.common.frozenset_to_dict(fs)[source]
penguin.common.getColoredLogger(name)[source]

Get or create a coloredlogger at INFO.

penguin.common.get_inits_from_proj(proj_dir)[source]

Given a project directory, find a default init from static/InitFinder.yaml

Raises RuntimeError if no init can be found.

penguin.common.hash_yaml(section_to_hash)[source]
penguin.common.int_to_hex_representer(dumper, data)[source]
penguin.common.literal_presenter(dumper, data)[source]
penguin.common.patch_config(logger, base_config, patch, patch_name='patch', origin_map=None, verbose=False)[source]