task: Get rid of unnecessary __makeTaskList

We can directly convert AsyncTaskCollection objects to a list (though even that is of questionable value since task collections behave list-like enough)
This commit is contained in:
rdb 2021-12-12 13:45:43 +01:00
parent b8c301164a
commit 73a27fa281

View File

@ -274,33 +274,27 @@ class TaskManager:
def getTasksNamed(self, taskName):
"""Returns a list of all tasks, active or sleeping, with the
indicated name. """
return self.__makeTaskList(self.mgr.findTasks(taskName))
return list(self.mgr.findTasks(taskName))
def getTasksMatching(self, taskPattern):
"""Returns a list of all tasks, active or sleeping, with a
name that matches the pattern, which can include standard
shell globbing characters like \\*, ?, and []. """
return self.__makeTaskList(self.mgr.findTasksMatching(GlobPattern(taskPattern)))
return list(self.mgr.findTasksMatching(GlobPattern(taskPattern)))
def getAllTasks(self):
"""Returns list of all tasks, active and sleeping, in
arbitrary order. """
return self.__makeTaskList(self.mgr.getTasks())
return list(self.mgr.getTasks())
def getTasks(self):
"""Returns list of all active tasks in arbitrary order. """
return self.__makeTaskList(self.mgr.getActiveTasks())
return list(self.mgr.getActiveTasks())
def getDoLaters(self):
"""Returns list of all sleeping tasks in arbitrary order. """
return self.__makeTaskList(self.mgr.getSleepingTasks())
def __makeTaskList(self, taskCollection):
l = []
for i in range(taskCollection.getNumTasks()):
l.append(taskCollection.getTask(i))
return l
return list(self.mgr.getSleepingTasks())
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs = None,
sort = None, priority = None, taskChain = None,