1 | def fail_acquire_settings(log_printer, settings_names_dict): |
||
2 | """ |
||
3 | This method throws an exception if any setting needs to be acquired. |
||
4 | |||
5 | :param log_printer: Printer responsible for logging the messages. |
||
6 | :param settings: A dictionary with the settings name as key and |
||
7 | a list containing a description in [0] and the |
||
8 | name of the bears who need this setting in [1] |
||
9 | and following. |
||
10 | :raises AssertionError: If any setting is required. |
||
11 | :raises TypeError: If ``settings_names_dict`` is not a dictionary. |
||
12 | """ |
||
13 | if not isinstance(settings_names_dict, dict): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
14 | raise TypeError("The settings_names_dict parameter has to be a " |
||
15 | "dictionary.") |
||
16 | |||
17 | required_settings = settings_names_dict.keys() |
||
18 | if len(required_settings) != 0: |
||
19 | msg = ("During execution, we found that some required " |
||
20 | "settings were not provided. They are:\n") |
||
21 | |||
22 | for name, setting in settings_names_dict.items(): |
||
23 | msg += "{} (from {}) - {}".format(name, setting[1], setting[0]) |
||
24 | |||
25 | log_printer.err(msg) |
||
26 | raise AssertionError |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
27 |