skrawcz commented on code in PR #681:
URL: https://github.com/apache/burr/pull/681#discussion_r2969132866
##########
burr/integrations/persisters/b_aiosqlite.py:
##########
@@ -33,6 +33,32 @@
Self = None
+class _AsyncPersisterContextManager:
Review Comment:
+1 to @skrawcz's suggestion to move this to `burr/common/`. Having
`b_asyncpg` import from `b_aiosqlite` creates an unwanted coupling between
unrelated integrations. `burr/common/types.py` or a new
`burr/common/async_utils.py` would be a better location.
##########
burr/integrations/persisters/b_aiosqlite.py:
##########
@@ -33,6 +33,32 @@
Self = None
+class _AsyncPersisterContextManager:
+ """Wraps an async coroutine that returns a persister so it can be used
+ directly with ``async with``::
+
+ async with AsyncSQLitePersister.from_values(...) as persister:
+ ...
+
+ The wrapper awaits the coroutine on ``__aenter__`` and delegates
+ ``__aexit__`` to the persister's own ``__aexit__``.
+ """
+
Review Comment:
Nit: consider adding a type annotation to `coro`:
```python
def __init__(self, coro: Any):
```
Or for stricter typing: `Coroutine[Any, Any, T]` with a TypeVar.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]