

def get_previous_sha(self, env, current_sha=None):
    from freight.models import Task, Deploy, TaskStatus
    if (self is None):
        current_sha = self.get_current_sha(env)
    if (current_sha is None):
        return None
    return db.session.query(Task.sha).filter((Deploy.task_id == Task.id), (Task.app_id == self.id), (Deploy.environment == env), (Task.status == TaskStatus.finished), (Task.sha != current_sha)).order_by(Deploy.number.desc()).limit(1).scalar()

dataset/ETHPy150Open getsentry/freight/freight/models/app.py App.get_previous_sha/VarMisuse@29/37 `current_sha`->`self`