Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Attempt to work around python-attrs/attrs#313
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Sep 23, 2021
1 parent 5b2f226 commit 62f8c70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions synapse/storage/util/id_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,15 +657,15 @@ def _update_stream_positions_table_txn(self, txn: Cursor) -> None:
txn.execute(sql, (self._stream_name, self._instance_name, pos))


@attr.s(slots=True)
@attr.s(auto_attribs=True)
class _AsyncCtxManagerWrapper(Generic[T]):
"""Helper class to convert a plain context manager to an async one.
This is mainly useful if you have a plain context manager but the interface
requires an async one.
"""

inner = attr.ib(type=ContextManager[T])
__slots__ = ["inner"]
inner: ContextManager[T]

async def __aenter__(self) -> T:
return self.inner.__enter__()
Expand Down

0 comments on commit 62f8c70

Please sign in to comment.