本文整理汇总了Python中Task.Task.name方法的典型用法代码示例。如果您正苦于以下问题:Python Task.name方法的具体用法?Python Task.name怎么用?Python Task.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task.Task
的用法示例。
在下文中一共展示了Task.name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: importTasks
# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import name [as 别名]
def importTasks():
# --- Read tasks from files.
global taskList,resourceFileName,taskFileName,dependencyFileName
global resources
fptasks = open(taskFileName,"r")#"tasks.txt","r")
for line in fptasks.readlines():
newTask = Task()
t = line.split(",")
newTask.name = t[1]
newTask.id = int(t[0])
newTask.duration = int(t[2])
adjacencyList[newTask.id] = []
taskList.append(newTask)
fptasks.close()
#---- Read resources
fpresources = open(resourceFileName,"r")#("resources.txt","r")
for line in fpresources.readlines():
r = line.strip().split(",")
newResource = Resource(int(r[0]),r[1])
resources += [newResource]
fpresources.close()
# ---- Read depedencies and create predecessor list -----
fpdependencies = open(dependencyFileName,"r")#("dependencies.txt","r")
for line in fpdependencies.readlines():
line = line.rstrip()
print(line)
x = line.split(",")
if(len(x)>1):
task = getTaskFromId(int(x[0]))
for i in range(1,len(x)):
task.predecessors.append(int(x[i]))
"""if len(x) >1:
z = x[1]
for task in taskList:
if task.id == int(x[0]):
y = z.strip().split(",")
for b in y:
task.predecessors.append(int(b))"""
#print(x[0],task.predecessor)
fpdependencies.close()
# ---- Create successor list ----
for succTask in taskList:
#succTask = getTaskFromId()
for predId in succTask.predecessors:
task = getTaskFromId(predId)
task.successors.append(succTask.id)
adjacencyList[task.id] = task.successors