Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Oct 1, 2024
1 parent ee37fb1 commit 0cb3235
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pycrdt_websocket/awareness.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import json
import time
from logging import Logger, getLogger
from typing import Any, Callable
from typing import Any, Awaitable, Callable
from uuid import uuid4

# Some magic to avoid 'event loop already running' error.
# See https://github.com/ipython/ipython/issues/11338#issuecomment-646539516
import nest_asyncio
import nest_asyncio # type: ignore
from pycrdt import Decoder, Doc, YMessageType, read_message, write_var_uint

# Some magic to avoid 'event loop already running' error.
# See https://github.com/ipython/ipython/issues/11338#issuecomment-646539516
nest_asyncio.apply()


Expand All @@ -21,16 +21,16 @@
class Awareness:
client_id: int
log: Logger
meta: dict[str, Any]
_states: dict[str, Any]
meta: dict[int, dict[str, Any]]
_states: dict[int, dict[str, Any]]
_subscriptions: list[Callable[[dict[str, Any]], None]]
_user: dict[str, str] | None

def __init__(
self,
ydoc: Doc,
log: Logger | None = None,
on_change: Callable[[bytes], None] | None = None,
on_change: Callable[[bytes], Awaitable[None]] | None = None,
user: dict[str, str] | None = None,
):
self.client_id = ydoc.client_id
Expand All @@ -48,7 +48,7 @@ def __init__(
self._subscriptions = []

@property
def user(self) -> dict[str, str]:
def user(self) -> dict[str, str] | None:
return self._user

@user.setter
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ classifiers = [
]
dependencies = [
"anyio >=3.6.2,<5",
"nest_asyncio",
"sqlite-anyio >=0.2.3,<0.3.0",
"pycrdt >=0.9.0,<0.10.0",
]
Expand Down

0 comments on commit 0cb3235

Please sign in to comment.