Skip to content

Commit

Permalink
Use relative imports everywhere, for consistency.
Browse files Browse the repository at this point in the history
Fix #946.
  • Loading branch information
aaugustin committed May 13, 2021
1 parent 70fadbf commit e44e085
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/api/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Per-Message Deflate
Abstract classes
----------------

.. automodule:: websockets.extensions.base
.. automodule:: websockets.extensions

.. autoclass:: Extension
:members:
Expand Down
7 changes: 3 additions & 4 deletions docs/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ As a consequence, writing an extension requires implementing several classes:
``websockets`` provides abstract base classes for extension factories and
extensions. See the API documentation for details on their methods:

* :class:`~base.ClientExtensionFactory` and
:class:`~base.ServerExtensionFactory` for extension factories,

* :class:`~base.Extension` for extensions.
* :class:`ClientExtensionFactory` and class:`ServerExtensionFactory` for
:extension factories,
* :class:`Extension` for extensions.


4 changes: 4 additions & 0 deletions src/websockets/extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .base import *


__all__ = ["Extension", "ClientExtensionFactory", "ServerExtensionFactory"]
6 changes: 3 additions & 3 deletions src/websockets/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def parse(
*,
mask: bool,
max_size: Optional[int] = None,
extensions: Optional[Sequence["websockets.extensions.base.Extension"]] = None,
extensions: Optional[Sequence["extensions.Extension"]] = None,
) -> Generator[None, None, "Frame"]:
"""
Read a WebSocket frame.
Expand Down Expand Up @@ -172,7 +172,7 @@ def serialize(
self,
*,
mask: bool,
extensions: Optional[Sequence["websockets.extensions.base.Extension"]] = None,
extensions: Optional[Sequence["extensions.Extension"]] = None,
) -> bytes:
"""
Write a WebSocket frame.
Expand Down Expand Up @@ -338,4 +338,4 @@ def check_close(code: int) -> None:


# at the bottom to allow circular import, because Extension depends on Frame
import websockets.extensions.base # isort:skip # noqa
from . import extensions # isort:skip # noqa
6 changes: 3 additions & 3 deletions src/websockets/legacy/framing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def read(
*,
mask: bool,
max_size: Optional[int] = None,
extensions: Optional[Sequence["websockets.extensions.base.Extension"]] = None,
extensions: Optional[Sequence["extensions.Extension"]] = None,
) -> "Frame":
"""
Read a WebSocket frame.
Expand Down Expand Up @@ -102,7 +102,7 @@ def write(
write: Callable[[bytes], Any],
*,
mask: bool,
extensions: Optional[Sequence["websockets.extensions.base.Extension"]] = None,
extensions: Optional[Sequence["extensions.Extension"]] = None,
) -> None:
"""
Write a WebSocket frame.
Expand Down Expand Up @@ -132,4 +132,4 @@ def write(


# at the bottom to allow circular import, because Extension depends on Frame
import websockets.extensions.base # isort:skip # noqa
from .. import extensions # isort:skip # noqa

0 comments on commit e44e085

Please sign in to comment.