(alias=True)
Goes through call stack and finds constructs matching conf.dbmsHandler.*.
    Returns it or its alias used in txt/common-outputs.txt
Goes through call stack and finds constructs matching conf.dbmsHandler.*.
    Returns it or its alias used in txt/common-outputs.txt
Goes through call stack and finds constructs matching conf . dbmsHandler . * . Returns it or its alias used in txt / common - outputs . txt
def getPartRun(alias=True):
    """
    Goes through call stack and finds constructs matching conf.dbmsHandler.*.
    Returns it or its alias used in txt/common-outputs.txt
    """

    retVal = None
    commonPartsDict = optDict["Enumeration"]

    try:
        stack = [item[4][0] if isinstance(item[4], list) else '' for item in inspect.stack()]

        # Goes backwards through the stack to find the conf.dbmsHandler method
        # calling this function
        for i in xrange(0, len(stack) - 1):
            for regex in (r"self\.(get[^(]+)\(\)", r"conf\.dbmsHandler\.([^(]+)\(\)"):
                match = re.search(regex, stack[i])

                if match:
                    # This is the calling conf.dbmsHandler or self method
                    # (e.g. 'getDbms')
                    retVal = match.groups()[0]
                    break

            if retVal is not None:
                break

    # Reference: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-06/2267.html
    except TypeError:
        pass

    # Return the INI tag to consider for common outputs (e.g. 'Databases')
    if alias:
        return commonPartsDict[retVal][1] if isinstance(commonPartsDict.get(retVal), tuple) else retVal
    else:
        return retVal
def getPartRun ( alias = True ) : retVal = None commonPartsDict = optDict [ "Enumeration" ] try : stack = [ item [ 4 ] [ 0 ] if isinstance ( item [ 4 ] , list ) else '' for item in inspect . stack ( ) ] # Goes backwards through the stack to find the conf.dbmsHandler method # calling this function for i in xrange ( 0 , len ( stack ) - 1 ) : for regex in ( r"self\.(get[^(]+)\(\)" , r"conf\.dbmsHandler\.([^(]+)\(\)" ) : match = re . search ( regex , stack [ i ] ) if match : # This is the calling conf.dbmsHandler or self method # (e.g. 'getDbms') retVal = match . groups ( ) [ 0 ] break if retVal is not None : break # Reference: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-06/2267.html except TypeError : pass # Return the INI tag to consider for common outputs (e.g. 'Databases') if alias : return commonPartsDict [ retVal ] [ 1 ] if isinstance ( commonPartsDict . get ( retVal ) , tuple ) else retVal else : return retVal