

def resolve_environment(name):
    if (name is None):
        return None
    try:
        eid = int(name)
    except ValueError:
        try:
            env = dbsession.query(models.Environment).filter((models.Environment.name == name)).one()
        except NoResultFound:
            return None
    else:
        try:
            env = dbsession.query(models.Environment).get(name)
        except NoResultFound:
            return None
    return env

dataset/ETHPy150Open kdart/pycopia/storage/pycopia/db/webhelpers.py resolve_environment/VarMisuse@104/120 `eid`->`name`