validationScript.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:bedrock-core 作者: Bedrock-py 项目源码 文件源码
def list_returns(fileToCheck, desiredInterface):
    returnsList = []
    newLine = ""
    with open(fileToCheck, 'r') as pyFile:
        for line in pyFile:
            if line.find("#") == -1:
                newFront = line.find("return")
                if newFront != -1:
                    possibleErrorMessageCheck1 = line.find("'")
                    bracketBefore = line.find("{")
                    lastBracket = line.find("}")
                    newLine = line[possibleErrorMessageCheck1:]
                    possibleErrorMessageCheck2 = newLine.find(" ")
                    if possibleErrorMessageCheck2 == -1:
                        line = line[newFront + 7:]
                        line.split()
                        line = [word.strip(punctuation) for word in line.split()]
                        returnsList.extend(line)
                    elif possibleErrorMessageCheck1 == bracketBefore + 1:
                        line = line[newFront + 7:lastBracket + 1]
                        line.split()
                        returnsList.append(line)
    return returnsList
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号