예제 #1
0
def get(fileNameList, fileNameWithLine, move):
    fileNameList = util.uniqueList(fileNameList)
    result = ""
    contains = any(fileNameWithLine in i for i in fileNameList)
    if (contains):
        index = fileNameList.index(fileNameWithLine)
        if (move=="prev"):
            index = index - 1
            if (index < 0):
                index = len(fileNameList)-1
        elif(move=="next"):    
            index = index + 1
            if (index >= len(fileNameList)):
                index = 0
        else:
            index = -1            

        result = fileNameList[index]
    else:
        (fileName, line) = fileNameWithLine.split(':')
   
        contains = any(fileName in i for i in fileNameList)
        if contains:
            result = [i for i in fileNameList if util.startsWith(i, fileName)][0]
        elif(len(fileNameList)):
            result = fileNameList[-1]
    

    return result
예제 #2
0
def startsWithOk(line):
	okList = ["import ", "sys.path.insert(0, "]
	for ok in okList:
		if util.startsWith(line, ok):
			return True
	return False