/usr/lib/python3/dist-packages/websockets/py35_client.py is in python3-websockets 3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | class Connect:
"""
This class wraps :func:`~websockets.client.connect` on Python ≥ 3.5.
This allows using it as an asynchronous context manager.
"""
def __init__(self, *args, **kwargs):
self.client = self.__class__.__wrapped__(*args, **kwargs)
async def __aenter__(self):
self.websocket = await self
return self.websocket
async def __aexit__(self, exc_type, exc_value, traceback):
await self.websocket.close()
def __await__(self):
return (yield from self.client)
__iter__ = __await__
|