From 32b01bbe948058ba52b0a301b6f7725f882e6f73 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Sun, 18 Aug 2024 17:06:07 +0100 Subject: [PATCH 1/2] Add hash property with setter and getter --- jupyter_ydoc/ybasedoc.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jupyter_ydoc/ybasedoc.py b/jupyter_ydoc/ybasedoc.py index aaebe40..45a70d5 100644 --- a/jupyter_ydoc/ybasedoc.py +++ b/jupyter_ydoc/ybasedoc.py @@ -114,6 +114,26 @@ def dirty(self, value: bool) -> None: """ self._ystate["dirty"] = value + @property + def hash(self) -> Optional[str]: + """ + Returns whether the document hash as computed by contents manager. + + :return: The document hash. + :rtype: Optional[str] + """ + return self._ystate.get("hash") + + @hash.setter + def hash(self, value: str) -> None: + """ + Sets the document hash. + + :param value: The document hash. + :type value: str + """ + self._ystate["hash"] = value + @property def path(self) -> Optional[str]: """ From 7d1b4a2c5680518c2096f5b869f9a130a2375bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:22:21 +0100 Subject: [PATCH 2/2] Fix docstring wording Co-authored-by: David Brochart --- jupyter_ydoc/ybasedoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_ydoc/ybasedoc.py b/jupyter_ydoc/ybasedoc.py index 45a70d5..cf3a2cb 100644 --- a/jupyter_ydoc/ybasedoc.py +++ b/jupyter_ydoc/ybasedoc.py @@ -117,7 +117,7 @@ def dirty(self, value: bool) -> None: @property def hash(self) -> Optional[str]: """ - Returns whether the document hash as computed by contents manager. + Returns the document hash as computed by contents manager. :return: The document hash. :rtype: Optional[str]