| f | import asyncio | f | import asyncio |
| | | |
| class Portal(asyncio.Barrier): | | class Portal(asyncio.Barrier): |
| | | |
| def __init__(self, parties): | | def __init__(self, parties): |
| super().__init__(parties) | | super().__init__(parties) |
| self._topic = None | | self._topic = None |
| | | |
| @property | | @property |
| def topic(self): | | def topic(self): |
| return self._topic | | return self._topic |
| | | |
| async def wait(self, topic=None): | | async def wait(self, topic=None): |
| if topic is not None: | | if topic is not None: |
| self._topic = topic | | self._topic = topic |
| n | idx = await super().wait() | n | result = await super().wait() |
| await asyncio.sleep(0) | | await asyncio.sleep(0) |
| t | return idx | t | return result |
| | | |
| async def reset(self): | | async def reset(self): |
| await super().reset() | | await super().reset() |
| self._topic = None | | self._topic = None |