lookout.style.common

Module Contents

lookout.style.common.merge_dicts(*dicts)[source]

Merge several mappings together; nested values are merged recursively.

Operation is not commutative, each next dictionary overrides values of the previous one for the same keys sequence. (see example). Example: >>> a = {1: 1, 2: {3: 3, 4: 4}} >>> b = {1: 10, 2: {3: 30, 4: 4, 5: 5}} >>> merge_dicts(a, b) >>> {1: 10, 2: {3: 30, 4: 4, 5: 5}} >>> merge_dicts(b, a) >>> {1: 1, 2: {3: 3, 4: 4, 5: 5}}

Returns:New merged dictionary.
lookout.style.common.load_jinja2_template(path:str)[source]

Return a loaded template by the specified file path.

lookout.style.common.huge_progress_bar(sequence:Sequence, log:logging.Logger, get_iter_name:Callable)[source]

Create big multi-line progress bar with the logs.

lookout.style.common.handle_input_arg(input_arg:Union[str, Iterable[str]], log:Optional[logging.Logger]=None)[source]

Process input arguments and return an iterator over input files.

Parameters:
  • input_arg – list of files to process or - to get file paths from stdin.
  • log – Logger if you want to log handling process.
Returns:

An iterator over input files.