def latest(cls) -> "Poll": with get_connection() as connection: poll = database.get_latest_poll(connection) return cls(poll[1], poll[2], poll[0])
def latest(cls) -> "Poll": connection = create_connection() poll = database.get_latest_poll(connection) connection.close() return cls(poll[1], poll[2], poll[0])
def latest(cls) -> 'Poll': with get_connection() as connection: latest_poll = database.get_latest_poll(connection) return cls(latest_poll[1], latest_poll[2], latest_poll[0])
def latest(cls) -> "Poll": with get_connection() as connection: poll = database.get_latest_poll(connection) return cls(title=poll[1], owner=poll[2], _id=poll[0])
def latest(cls) -> "Poll": connection = pool.getconn() poll = database.get_latest_poll() pool.putconn(connection) return cls(poll[1], poll[2], poll[0])