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] 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]: """