Пример #1
0
 def loadLocalConfiguration(self, loadLocalConfig, printRootPathStatus,
                            globalsEverything):
     self.loadLocalConfig = loadLocalConfig
     self.localConfiguration = {}
     if self.loadLocalConfig:
         try:
             self.localConfiguration = self.getSettingTree(
                 settingFilePath=Globals.LOCAL_CONFIGURATION_FILE_NAME,
                 settingTree=None)
         except Exception as exception:
             self.log(
                 f'Failed to load {Globals.LOCAL_CONFIGURATION_FILE_NAME} settings',
                 exception=exception)
         keyQuery = SettingHelper.querySetting(AttributeKey.KW_KEY,
                                               self.localConfiguration)
         keyValueQuery = {}
         for key, value in keyQuery.items():
             KW_DOT_KEY = f'{c.DOT}{AttributeKey.KW_KEY}'
             if key.endswith(KW_DOT_KEY):
                 environmentInjection = SettingHelper.getSetting(
                     key[:-len(KW_DOT_KEY)], self.localConfiguration)
                 if (ObjectHelper.isDictionary(environmentInjection)
                         and AttributeKey.KW_KEY in environmentInjection
                         and AttributeKey.KW_VALUE in environmentInjection
                         and 2 == len(environmentInjection)):
                     EnvironmentHelper.update(
                         environmentInjection[AttributeKey.KW_KEY],
                         environmentInjection[AttributeKey.KW_VALUE])
     log.loadSettings()
     self.printRootPathStatus = printRootPathStatus
     self.globalsEverything = globalsEverything
     self.ignoreModules = IGNORE_MODULES
     self.ignoreResources = IGNORE_REOURCES
     self.activeEnvironment = SettingHelper.getActiveEnvironment()
     if ObjectHelper.isNotEmpty(
             self.localConfiguration) and SettingHelper.getSetting(
                 'print-status', self.localConfiguration):
         SettingHelper.printSettings(self.localConfiguration,
                                     "Local Configuration")
         basicSettingsAsDictionary = {
             'activeEnvironment': self.activeEnvironment,
             'successStatus': self.successStatus,
             'settingStatus': self.settingStatus,
             'debugStatus': self.debugStatus,
             'warningStatus': self.warningStatus,
             'failureStatus': self.failureStatus,
             'errorStatus': self.errorStatus,
             'wrapperStatus': self.wrapperStatus,
             'infoStatus': self.infoStatus,
             'statusStatus': self.statusStatus,
             'logStatus': self.logStatus,
             'globalsEverything': self.globalsEverything,
             'printRootPathStatus': self.printRootPathStatus
         }
         log.prettyPython(self.__class__,
                          f'Basic settings',
                          basicSettingsAsDictionary,
                          logLevel=log.SETTING)
Пример #2
0
 def printTree(self, tree, name, depth=1):
     SettingHelper.printSettings(tree, name, depth=depth)