From 34e12613bc02898abe8f381340dc77953b95a34f Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Fri, 14 Jun 2024 11:34:01 +0100 Subject: [PATCH] fix pyright warnings for `BaseBatch. __aenter__` --- piccolo/engine/base.py | 2 +- piccolo/engine/postgres.py | 2 +- piccolo/engine/sqlite.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/piccolo/engine/base.py b/piccolo/engine/base.py index 858d21ed6..48f7325aa 100644 --- a/piccolo/engine/base.py +++ b/piccolo/engine/base.py @@ -36,7 +36,7 @@ def validate_savepoint_name(savepoint_name: str) -> None: class BaseBatch(metaclass=ABCMeta): @abstractmethod - async def __aenter__(self, *args, **kwargs): ... + async def __aenter__(self: Self, *args, **kwargs) -> Self: ... @abstractmethod async def __aexit__(self, *args, **kwargs): ... diff --git a/piccolo/engine/postgres.py b/piccolo/engine/postgres.py index 9466bc576..1ac73cbdb 100644 --- a/piccolo/engine/postgres.py +++ b/piccolo/engine/postgres.py @@ -64,7 +64,7 @@ async def __anext__(self) -> t.List[t.Dict]: raise StopAsyncIteration() return response - async def __aenter__(self): + async def __aenter__(self: Self) -> Self: self._transaction = self.connection.transaction() await self._transaction.start() querystring = self.query.querystrings[0] diff --git a/piccolo/engine/sqlite.py b/piccolo/engine/sqlite.py index 741652777..40c30f730 100644 --- a/piccolo/engine/sqlite.py +++ b/piccolo/engine/sqlite.py @@ -344,7 +344,7 @@ async def __anext__(self) -> t.List[t.Dict]: raise StopAsyncIteration() return response - async def __aenter__(self): + async def __aenter__(self: Self) -> Self: querystring = self.query.querystrings[0] template, template_args = querystring.compile_string()