xerparser.model.predecessors

Classes

Predecessors

Collection of TASKPRED relationship records.

Module Contents

class xerparser.model.predecessors.Predecessors[source]

Collection of TASKPRED relationship records.

Editing API: add_relationship(), remove_relationship() and replace_relationship() modify the collection in place; a subsequent writeXER writes the edited relationships back.

PRED_TYPES = ('PR_FS', 'PR_SS', 'PR_FF', 'PR_SF')[source]
index = 0[source]
task_pred = [][source]
find_by_id(code_id) → xerparser.model.classes.taskpred.TaskPred[source]
get_tsv()[source]
add(params)[source]
next_task_pred_id()[source]

Next free numeric task_pred_id (max existing numeric id + 1).

add_relationship(task_id, pred_task_id, pred_type='PR_FS', lag_hr_cnt=None, comments=None, proj_id=None, pred_proj_id=None, tasks=None)[source]

Add a relationship and return the new TaskPred.

Parameters:
  • task_id – id of the successor activity.

  • pred_task_id – id of the predecessor activity.

  • pred_type – one of PR_FS, PR_SS, PR_FF, PR_SF (default PR_FS).

  • lag_hr_cnt – lag in hours; negative for leads. Optional.

  • comments – optional comment text.

  • proj_id – project of the successor; derived from the task when a Tasks collection is available (the Reader wires one).

  • pred_proj_id – project of the predecessor. Defaults to proj_id; set it explicitly for cross-project links.

  • tasks – Tasks collection used for validation/project lookup. Optional when the Reader wired one automatically.

Returns:

The appended TaskPred relationship.

Raises:

ValueError – on an unknown pred_type, non-numeric lag, unknown task, duplicate relationship, or missing project context.

remove_relationship(rel)[source]

Remove a relationship (TaskPred instance or task_pred_id).

Raises:

ValueError – if the relationship is not in this collection.

replace_relationship(rel, task_id=None, pred_task_id=None, pred_type=None, lag_hr_cnt=None, comments=None, tasks=None)[source]

Atomically re-route a relationship.

Builds the replacement first (so validation failures leave the collection untouched), then swaps it for rel (TaskPred instance or task_pred_id). Unspecified fields are inherited from the old relationship.

property relations: List[xerparser.model.classes.taskpred.TaskPred][source]
property leads[source]
property finish_to_start: List[xerparser.model.classes.taskpred.TaskPred][source]
get_successors(act_id) → List[xerparser.model.classes.taskpred.TaskPred][source]
get_predecessors(act_id) → List[xerparser.model.classes.taskpred.TaskPred][source]
count()[source]
__len__()[source]
__iter__()[source]