File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11import copy
2+ from abc import ABC , abstractmethod
23from typing import Any , Dict
34from uuid import uuid4
45
78from .utils import cast_all
89
910
10- class YBaseDoc :
11+ class YBaseDoc ( ABC ) :
1112 def __init__ (self , ydoc : Y .YDoc ):
1213 self ._ydoc = ydoc
1314 self ._ystate = self ._ydoc .get_map ("state" )
@@ -38,14 +39,17 @@ def dirty(self, value: bool) -> None:
3839 with self ._ydoc .begin_transaction () as t :
3940 self ._ystate .set (t , "dirty" , value )
4041
42+ @abstractmethod
4143 def get (self ):
42- raise RuntimeError ( "Y document get not implemented" )
44+ pass
4345
46+ @abstractmethod
4447 def set (self , value ):
45- raise RuntimeError ( "Y document set not implemented" )
48+ pass
4649
50+ @abstractmethod
4751 def observe (self , callback ):
48- raise RuntimeError ( "Y document observe not implemented" )
52+ pass
4953
5054 def unobserve (self ):
5155 for k , v in self ._subscriptions .items ():
You can’t perform that action at this time.
0 commit comments