diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1502f9b..83a2f2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black args: ["--line-length", "100"] diff --git a/pycrdt_websocket/asgi_server.py b/pycrdt_websocket/asgi_server.py index 5815a67..71ef284 100644 --- a/pycrdt_websocket/asgi_server.py +++ b/pycrdt_websocket/asgi_server.py @@ -56,8 +56,9 @@ class ASGIServer: def __init__( self, websocket_server: WebsocketServer, - on_connect: Callable[[dict[str, Any], dict[str, Any]], Awaitable[bool] | bool] - | None = None, + on_connect: ( + Callable[[dict[str, Any], dict[str, Any]], Awaitable[bool] | bool] | None + ) = None, on_disconnect: Callable[[dict[str, Any]], Awaitable[None] | None] | None = None, ): """Initialize the object. diff --git a/pycrdt_websocket/ystore.py b/pycrdt_websocket/ystore.py index aa91c38..4133aa2 100644 --- a/pycrdt_websocket/ystore.py +++ b/pycrdt_websocket/ystore.py @@ -33,16 +33,13 @@ class BaseYStore(ABC): @abstractmethod def __init__( self, path: str, metadata_callback: Callable[[], Awaitable[bytes] | bytes] | None = None - ): - ... + ): ... @abstractmethod - async def write(self, data: bytes) -> None: - ... + async def write(self, data: bytes) -> None: ... @abstractmethod - async def read(self) -> AsyncIterator[tuple[bytes, bytes]]: - ... + async def read(self) -> AsyncIterator[tuple[bytes, bytes]]: ... @property def started(self) -> Event: @@ -424,7 +421,7 @@ async def write(self, data: bytes) -> None: async with db.execute( "SELECT yupdate FROM yupdates WHERE path = ?", (self.path,) ) as cursor: - async for update, in cursor: + async for (update,) in cursor: ydoc.apply_update(update) # delete history await db.execute("DELETE FROM yupdates WHERE path = ?", (self.path,))