

def get_snapshottable_plans(project):
    project_plans = list(project.plans)
    if (not project_plans):
        return []
    options = dict(db.session.query(ItemOption.item_id, ItemOption.value).filter(ItemOption.item_id.in_([p.id for p in project_plans]), (ItemOption.name == 'snapshot.allow')))
    plan_list = []
    for plan in project.plans:
        if (plan.status != PlanStatus.active):
            logging.info('Disallowing snapshot on plan [%s] due to status', plan.id)
            continue
        if (plan.snapshot_plan_id is not None):
            logging.info('Disallowing snapshot on plan [%s] because it depends on another plan for its snapshot', plan.id)
            continue
        if (options.get(plan.id, '1') == '0'):
            logging.info('Disallowing snapshot on plan [%s] due to snapshot.allow setting', plan.id)
            continue
        try:
            if (not plan.steps[0].get_implementation().can_snapshot()):
                logging.info('Disallowing snapshot on plan [%s] due to buildstep implementation', plan.id)
                continue
        except IndexError:
            logging.info('Disallowing snapshot on plan [%s] due to invalid buildstep', plan.id)
            continue
        plan_list.append(plan)
    return plan_list

dataset/ETHPy150Open dropbox/changes/changes/api/project_snapshot_index.py get_snapshottable_plans/original