def prepare_for_analysis()

in mozci/console/commands/push.py [0:0]


def prepare_for_analysis(push):
    removed_tasks: Dict[str, List[Task]] = {}
    backedoutby: Dict[str, str] = {}
    old_classifications: Dict[str, Dict[str, Dict[str, str]]] = {}

    all_pushes = set(
        [push]
        + [parent for parent in push._iterate_parents(max_depth=MAX_DEPTH)]
        + [child for child in push._iterate_children(max_depth=MAX_DEPTH)]
    )
    for p in all_pushes:
        # Ignore retriggers and backfills on current push/its parents/its children.
        removed_tasks[p.id] = [
            task for task in p.tasks if task.is_backfill or task.is_retrigger
        ]
        p.tasks = [task for task in p.tasks if task not in removed_tasks[p.id]]

        # Pretend push was not backed out.
        backedoutby[p.id] = p.backedoutby
        p.backedoutby = None

        # Pretend push was not finalized yet.
        p._date = datetime.datetime.now().timestamp()

        # Pretend no tasks were classified to run the model without any outside help.
        old_classifications[p.id] = {}
        for task in p.tasks:
            old_classifications[p.id][task.id] = {
                "classification": task.classification,
                "note": task.classification_note,
            }
            task.classification = "not classified"
            task.classification_note = None

    return all_pushes, removed_tasks, backedoutby, old_classifications