Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David Brochart <[email protected]>
  • Loading branch information
brichet and davidbrochart committed Oct 3, 2024
1 parent 3aa8387 commit c1b0496
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
13 changes: 8 additions & 5 deletions jupyter_ydoc/ybasedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ def __init__(self, ydoc: Optional[Doc] = None, awareness: Optional[Awareness] =
:param ydoc: The :class:`pycrdt.Doc` that will hold the data of the document, if provided.
:type ydoc: :class:`pycrdt.Doc`, optional.
:param awareness: The :class:`pycrdt.Awareness` that share non persistent data
between clients.
:type awareness: :class:`pycrdt.Awareness`, optional.
"""
if ydoc is None:
self._ydoc = Doc()
else:
self._ydoc = ydoc

self._awareness = awareness

self._ystate = self._ydoc.get("state", type=Map)
Expand Down Expand Up @@ -80,19 +82,20 @@ def ydoc(self) -> Doc:
@property
def awareness(self) -> Awareness | None:
"""
Return the awareness.
Returns the awareness.
:return: The document's awareness.
:rtype: :class:`pycrdt_websocket.awareness.Awareness`
:rtype: :class:`pycrdt.Awareness` or None.
"""
return self._awareness

@awareness.setter
def awareness(self, value: Awareness):
def awareness(self, value: Awareness) -> None:
"""
Sets the awareness.
:param: The awareness.
:param value: The awareness to set.
:type value: :class:`pycrdt.Awareness`.
"""
self._awareness = value

Expand Down
3 changes: 3 additions & 0 deletions jupyter_ydoc/yblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def __init__(self, ydoc: Optional[Doc] = None, awareness: Optional[Awareness] =
:param ydoc: The :class:`pycrdt.Doc` that will hold the data of the document, if provided.
:type ydoc: :class:`pycrdt.Doc`, optional.
:param awareness: The :class:`pycrdt.Awareness` that share non persistent data
between clients.
:type awareness: :class:`pycrdt.Awareness`, optional.
"""
super().__init__(ydoc, awareness)
self._ysource = self._ydoc.get("source", type=Map)
Expand Down
3 changes: 3 additions & 0 deletions jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def __init__(self, ydoc: Optional[Doc] = None, awareness: Optional[Awareness] =
:param ydoc: The :class:`pycrdt.Doc` that will hold the data of the document, if provided.
:type ydoc: :class:`pycrdt.Doc`, optional.
:param awareness: The :class:`pycrdt.Awareness` that share non persistent data
between clients.
:type awareness: :class:`pycrdt.Awareness`, optional.
"""
super().__init__(ydoc, awareness)
self._ymeta = self._ydoc.get("meta", type=Map)
Expand Down
3 changes: 3 additions & 0 deletions jupyter_ydoc/yunicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def __init__(self, ydoc: Optional[Doc] = None, awareness: Optional[Awareness] =
:param ydoc: The :class:`pycrdt.Doc` that will hold the data of the document, if provided.
:type ydoc: :class:`pycrdt.Doc`, optional.
:param awareness: The :class:`pycrdt.Awareness` that share non persistent data
between clients.
:type awareness: :class:`pycrdt.Awareness`, optional.
"""
super().__init__(ydoc, awareness)
self._ysource = self._ydoc.get("source", type=Text)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dev = [
]
test = [
"pre-commit",
"pytest >=9.16",
"pytest",
"pytest-asyncio",
"websockets >=10.0",
"pycrdt-websocket >=0.14.1,<0.15.0",
Expand Down

0 comments on commit c1b0496

Please sign in to comment.