Skip to content

Commit

Permalink
Improve aiopg typing support.
Browse files Browse the repository at this point in the history
aiopg doesn't have a py.typed so mypy can't parse it even though it's
fully typed within the code. Will remove the ignore comment when
aio-libs/aiopg/pull/881 is merged.
  • Loading branch information
andrew-chang-dewitt committed Oct 24, 2021
1 parent bfa2adf commit 5f3ff86
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions db_wrapper/client/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
List,
Dict)

import aiopg # type: ignore
import aiopg
from psycopg2.extras import register_uuid
from psycopg2 import sql

Expand Down Expand Up @@ -58,9 +58,12 @@ async def _execute_query(
params: Optional[Dict[Hashable, Any]] = None,
) -> None:
if params:
await cursor.execute(query, params)
# aiopg incorrectly limits queries to 'str' type
# when execution is deferred to psycopg2, which
# allows strings or sql.Composed objects
await cursor.execute(query, params) # type: ignore
else:
await cursor.execute(query)
await cursor.execute(query) # type: ignore

# PENDS python 3.9 support in pylint
# pylint: disable=unsubscriptable-object
Expand Down

0 comments on commit 5f3ff86

Please sign in to comment.