Ejemplo n.º 1
0
def makeMethods(analysis):
    objs = []
    numMethods = 0
    posMethods = []
    for j in range(
            0, len(analysis)
    ):  #start with something that starts w def, ends when run into other def
        if "def" in analysis[j]:
            numMethods = numMethods + 1
            posMethods.append(j)
    for i in range(0, numMethods):
        innerMethod = []  #strings of things in method
        tempName = ""
        tempArgs = []
        if (i == numMethods - 1):
            end = len(analysis)
        else:
            end = posMethods[i + 1] - 1
        for a in range(posMethods[i], end):
            if a == posMethods[i]:
                tempName = analysis[a][4]
                tempArgs = findArgs(tempName)
            else:
                if ("def" not in analysis[a][4]):
                    innerMethod.append(analysis[a])
        organizedInnerMethod = organizeInnerMethod(tempName, innerMethod)
        appendMeMethod = Method(tempName, tempArgs, organizedInnerMethod)

        appendMeMethod.setMethodsCalled(findMethods(organizedInnerMethod))
        appendMeMethod.setBasicMethodsCalled(
            findBasicMethods(organizedInnerMethod))

        appendMeMethod.setDocs(
            makeDocs(appendMeMethod, tempName, tempArgs, organizedInnerMethod))

        objs.append(appendMeMethod)
    return objs