Skip to content

Commit 14a8573

Browse files
Add hash property with setter and getter (#262)
* Add hash property with setter and getter * Fix docstring wording Co-authored-by: David Brochart <[email protected]> --------- Co-authored-by: David Brochart <[email protected]>
1 parent 5959a16 commit 14a8573

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

jupyter_ydoc/ybasedoc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,26 @@ def dirty(self, value: bool) -> None:
114114
"""
115115
self._ystate["dirty"] = value
116116

117+
@property
118+
def hash(self) -> Optional[str]:
119+
"""
120+
Returns the document hash as computed by contents manager.
121+
122+
:return: The document hash.
123+
:rtype: Optional[str]
124+
"""
125+
return self._ystate.get("hash")
126+
127+
@hash.setter
128+
def hash(self, value: str) -> None:
129+
"""
130+
Sets the document hash.
131+
132+
:param value: The document hash.
133+
:type value: str
134+
"""
135+
self._ystate["hash"] = value
136+
117137
@property
118138
def path(self) -> Optional[str]:
119139
"""

0 commit comments

Comments
 (0)