def handleSettingInjectionList(settingInjectionList,
                               settingTree,
                               fallbackSettingTree=None):
    if ObjectHelper.isNotEmptyCollection(
            settingInjectionList) and ObjectHelper.isNotNone(settingTree):
        try:
            done, stuck = handleSettingInjectionListLoop(
                False,
                False,
                settingTree,
                settingInjectionList,
                fallbackSettingTree,
                getSettingInjectionValueIgnoringFallbackSettingTree,
                verifyer=verifyDefaultSettingInjectionListHandler)
        except Exception as exception:
            LogHelper.error(
                handleSettingInjectionList,
                'Not possible to load setting injections properly', exception)
            raise exception
def getSettingTree(settingFilePath,
                   settingTree=None,
                   fallbackSettingFilePath=None,
                   fallbackSettingTree=None,
                   lazyLoad=False,
                   keepDepthInLongString=False,
                   depthStep=c.TAB_UNITS,
                   encoding=c.ENCODING):
    settingInjectionList = []
    fallbackSettingInjectionList = []
    if ObjectHelper.isNotNone(fallbackSettingFilePath):
        innerFallbackSettingTree, fallbackSettingInjectionList = getSettingTree(
            fallbackSettingFilePath,
            lazyLoad=True,
            keepDepthInLongString=keepDepthInLongString,
            depthStep=depthStep,
            encoding=encoding)
    else:
        innerFallbackSettingTree = {}
    with open(settingFilePath, c.READ, encoding=encoding) as settingsFile:
        allSettingLines = settingsFile.readlines()
    longStringCapturing = False
    quoteType = None
    longStringList = None
    depth = 0
    nodeRefference = 0
    nodeKey = c.NOTHING
    if settingTree is None:
        settingTree = {}
    for line, settingLine in enumerate(allSettingLines):
        if SettingHelperHelper.lineAproved(settingLine):
            if longStringCapturing:
                # print('lineAproved')
                if not currentDepth:
                    currentDepth = 0
                longStringList.append(depthStep * c.SPACE +
                                      settingLine if keepDepthInLongString else
                                      settingLine[depth:])
                if quoteType in str(settingLine):
                    longStringList[-1] = c.NOTHING.join(
                        longStringList[-1].split(quoteType))[:-1] + quoteType
                    settingValue = c.NOTHING.join(longStringList)
                    nodeKey = SettingHelperHelper.updateSettingTreeAndReturnNodeKey(
                        settingKey, settingValue, nodeKey, settingTree, False)
                    longStringCapturing = False
                    quoteType = None
                    longStringList = None
            else:
                currentDepth = SettingHelperHelper.getDepth(settingLine)
                isSameDepth = SettingHelperHelper.nextValidLineIsAtTheSameDepthOrLess(
                    currentDepth, line, allSettingLines)
                # print(f'isSameDepth: {isSameDepth}')
                if currentDepth == depth:
                    # print('currentDepth == depth')
                    settingKey, settingValue, nodeKey, longStringCapturing, quoteType, longStringList = SettingHelperHelper.settingTreeInnerLoop(
                        settingLine, nodeKey, settingTree, longStringCapturing,
                        quoteType, longStringList, settingInjectionList,
                        lazyLoad, isSameDepth)
                elif currentDepth > depth:
                    # print('currentDepth > depth')
                    currentNodeRefference = currentDepth // (currentDepth -
                                                             depth)
                    if currentNodeRefference - nodeRefference == 1:
                        settingKey, settingValue, nodeKey, longStringCapturing, quoteType, longStringList = SettingHelperHelper.settingTreeInnerLoop(
                            settingLine, nodeKey, settingTree,
                            longStringCapturing, quoteType, longStringList,
                            settingInjectionList, lazyLoad, isSameDepth)
                        nodeRefference = currentNodeRefference
                        depth = currentDepth
                elif currentDepth < depth:
                    # print('currentDepth < depth')
                    nodeRefference = currentDepth // depthStep  ###- if line.split(':')[0] == currentDepth + c.TAB_UNITS * ' ' +
                    depth = currentDepth
                    # print()
                    # print()
                    # print()
                    # print(str(line))
                    # print(str(nodeKey))
                    # print(str(settingLine))
                    splitedNodeKey = nodeKey.split(c.DOT)[:nodeRefference]
                    splitedNodeKeyLength = len(splitedNodeKey)
                    if splitedNodeKeyLength == 0:
                        nodeKey = c.NOTHING
                    elif splitedNodeKeyLength == 1:
                        nodeKey = splitedNodeKey[0]
                    else:
                        nodeKey = c.DOT.join(splitedNodeKey)
                    settingKey, settingValue, nodeKey, longStringCapturing, quoteType, longStringList = SettingHelperHelper.settingTreeInnerLoop(
                        settingLine, nodeKey, settingTree, longStringCapturing,
                        quoteType, longStringList, settingInjectionList,
                        lazyLoad, isSameDepth)
                    # if ObjectHelper.isNotNone(settingValue) and ObjectHelper.isNotEmpty(settingValue) :
                    depth = currentDepth
    if lazyLoad:
        return settingTree, settingInjectionList
    elif (ObjectHelper.isNotEmptyCollection(innerFallbackSettingTree)
          and ObjectHelper.isNotNone(fallbackSettingFilePath)):
        for fallbackSettingInjection in fallbackSettingInjectionList.copy():
            for settingInjection in settingInjectionList.copy():
                if (fallbackSettingInjection[SettingHelperHelper.SETTING_KEY]
                        == settingInjection[SettingHelperHelper.SETTING_KEY]
                        and fallbackSettingInjection[
                            SettingHelperHelper.SETTING_NODE_KEY]
                        == settingInjection[
                            SettingHelperHelper.SETTING_NODE_KEY]):
                    fallbackSettingInjectionList.remove(
                        fallbackSettingInjection)
        settingInjectionList += fallbackSettingInjectionList
        updateSettingTree(settingTree, innerFallbackSettingTree)
        SettingHelperHelper.handleSettingInjectionList(
            settingInjectionList,
            settingTree,
            fallbackSettingTree=innerFallbackSettingTree)
    SettingHelperHelper.handleSettingInjectionList(
        settingInjectionList,
        settingTree,
        fallbackSettingTree=fallbackSettingTree)
    updateSettingTree(settingTree, fallbackSettingTree)
    return settingTree