本文整理匯總了Python中Project.Project.add_engineer方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.add_engineer方法的具體用法?Python Project.add_engineer怎麽用?Python Project.add_engineer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Project.Project
的用法示例。
在下文中一共展示了Project.add_engineer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: read_from_json
# 需要導入模塊: from Project import Project [as 別名]
# 或者: from Project.Project import add_engineer [as 別名]
def read_from_json(filename): # make tasks and return the list
project = Project()
with open('houseproject.json') as data_file:
data = json.load(data_file)
for task in data['Leafs']:
leaf_task = Leaf(task['id'],task['label'],task['description'],
task['original_hours'],task['revised_hours'],
task['percent_complete'],task['est_remaining_hrs'],
int(task['est_remaining_workdays']), task['engineers'])
project.add_task(leaf_task)
for task in data['Sequential']:
seq_task = Sequential(task['id'],task['label'],task['description'],
task['children'])
project.add_task(seq_task)
for task in data['Parallel']:
par_task = Parallel(task['id'], task['label'],task['description'],
task['children'])
project.add_task(par_task)
for engr in data['engineers']:
engineer = Engineer(engr['id'], engr['name'], engr['available_hours'])
project.add_engineer(engineer)
project.initialize()
return project
示例2: test_add_engineer
# 需要導入模塊: from Project import Project [as 別名]
# 或者: from Project.Project import add_engineer [as 別名]
def test_add_engineer(self):
engineer = Engineer(88,"Jameses",5)
project = Project()
project.add_engineer(engineer)
self.assertEqual(len(project.engr_list), 1)
self.assertEqual(project.get_engineer(88), engineer)