Skip to content

Commit

Permalink
fix pyright warnings for BaseBatch. __aenter__
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Jun 14, 2024
1 parent 2a2745e commit 34e1261
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion piccolo/engine/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...
Expand Down
2 changes: 1 addition & 1 deletion piccolo/engine/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion piccolo/engine/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 34e1261

Please sign in to comment.