# Path: lib/Settings.py
# class Settings:
#     def __init__(self,
#                  override_settings_path='settings.cfg'):
#         self.settingsFilePath = override_settings_path
#         self.parser = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
#         self.settings = None
#         self.getSettings()
# 
#     def getSettings(self):
#         self.parser.read('./settings.cfg')
#         self.settings = {section: dict(**self.parser[section]) for section in self.parser.sections()}
# 
#         return self.settings
# 
#     def getServiceIp(self, service):
#         return self.settings['general']['my_ip']


import warnings as global_warnings
from lib.Settings import Settings



class Warnings:
    def __init__(self, *, warnings=None):
        self.warnings = warnings or global_warnings

    def configure(self, *, settings=None):
        action = (settings or Settings().getSettings())['logs']['warning_action']

        self.warnings.filterwarnings(action)
        self.warnings.formatwarning = self._format_warning

    def _format_warning(self, message, category, filename, lineno, line=None):
        return "{cat}: {msg}\n  Warned inside call made in {file}:{line}\n".format(cat=category.__name__,

# Path: lib/Settings.py
# class Settings:
#     def __init__(self,
#                  override_settings_path='settings.cfg'):
#         self.settingsFilePath = override_settings_path
#         self.parser = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
#         self.settings = None
#         self.getSettings()
# 
#     def getSettings(self):
#         self.parser.read('./settings.cfg')
#         self.settings = {section: dict(**self.parser[section]) for section in self.parser.sections()}
# 
#         return self.settings
# 
#     def getServiceIp(self, service):
#         return self.settings['general']['my_ip']


# Path: lib/Wrappers/Warnings.py
import warnings as global_warnings
from lib.Settings import Settings




class Warnings:
    def __init__(self, *, warnings=None):
        self.warnings = warnings or global_warnings

    def configure(self, *, settings=None):
        action = (settings or Settings().getSettings())['logs']['warning_action']

        self.warnings.filterwarnings(action)
        self.warnings.formatwarning = self._format_warning

    def _format_warning(self, message, category, filename, lineno, line=None):
        return "{cat}: {msg}\n  Warned inside call made in {file}:{line}\n".format(cat=category.__name__,

                                                                                   msg=message,