Skip to content

Commit a77d713

Browse files
committed
Add version property to Python documents
1 parent 78a27d9 commit a77d713

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

jupyter_ydoc/ybasedoc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ def __init__(self, ydoc: Optional[Y.YDoc] = None):
2929
self._ystate = self._ydoc.get_map("state")
3030
self._subscriptions = {}
3131

32+
@property
33+
@abstractmethod
34+
def version(self):
35+
"""
36+
Returns the version of the document.
37+
38+
:return: Document's version.
39+
:rtype: str
40+
"""
41+
3242
@property
3343
def ystate(self) -> Y.YMap:
3444
"""

jupyter_ydoc/yblob.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ def __init__(self, ydoc: Optional[Y.YDoc] = None):
3838
super().__init__(ydoc)
3939
self._ysource = self._ydoc.get_map("source")
4040

41+
@property
42+
def version(self):
43+
"""
44+
Returns the version of the document.
45+
46+
:return: Document's version.
47+
:rtype: str
48+
"""
49+
return "0.1.0"
50+
4151
def get(self) -> bytes:
4252
"""
4353
Returns the content of the document.

jupyter_ydoc/ynotebook.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ def __init__(self, ydoc: Optional[Y.YDoc] = None):
5757
self._ymeta = self._ydoc.get_map("meta")
5858
self._ycells = self._ydoc.get_array("cells")
5959

60+
@property
61+
def version(self):
62+
"""
63+
Returns the version of the document.
64+
65+
:return: Document's version.
66+
:rtype: str
67+
"""
68+
return "0.1.0"
69+
6070
@property
6171
def ycells(self):
6272
"""

jupyter_ydoc/yunicode.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ def __init__(self, ydoc: Optional[Y.YDoc] = None):
3333
super().__init__(ydoc)
3434
self._ysource = self._ydoc.get_text("source")
3535

36+
@property
37+
def version(self):
38+
"""
39+
Returns the version of the document.
40+
41+
:return: Document's version.
42+
:rtype: str
43+
"""
44+
return "0.1.0"
45+
3646
def get(self) -> str:
3747
"""
3848
Returns the content of the document.

0 commit comments

Comments
 (0)