MCPcopy Create free account
hub / github.com/BioinfoMachineLearning/FlowDock / extras

Function extras

flowdock/utils/utils.py:15–43  ·  view source on GitHub ↗

Applies optional utilities before the task is started. Utilities: - Ignoring python warnings - Setting tags from command line - Rich config printing :param cfg: A DictConfig object containing the config tree.

(cfg: DictConfig)

Source from the content-addressed store, hash-verified

13
14
15def extras(cfg: DictConfig) -> None:
16 """Applies optional utilities before the task is started.
17
18 Utilities:
19 - Ignoring python warnings
20 - Setting tags from command line
21 - Rich config printing
22
23 :param cfg: A DictConfig object containing the config tree.
24 """
25 # return if no `extras` config
26 if not cfg.get("extras"):
27 log.warning("Extras config not found! <cfg.extras=null>")
28 return
29
30 # disable python warnings
31 if cfg.extras.get("ignore_warnings"):
32 log.info("Disabling python warnings! <cfg.extras.ignore_warnings=True>")
33 warnings.filterwarnings("ignore")
34
35 # prompt user to input tags from command line if none are provided in the config
36 if cfg.extras.get("enforce_tags"):
37 log.info("Enforcing tags! <cfg.extras.enforce_tags=True>")
38 rich_utils.enforce_tags(cfg, save_to_file=True)
39
40 # pretty print config tree using Rich library
41 if cfg.extras.get("print_config"):
42 log.info("Printing config tree with Rich! <cfg.extras.print_config=True>")
43 rich_utils.print_config_tree(cfg, resolve=True, save_to_file=True)
44
45
46def task_wrapper(task_func: Callable) -> Callable:

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected