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 1
1
import copy
2
+ from abc import ABC , abstractmethod
2
3
from typing import Any , Dict
3
4
from uuid import uuid4
4
5
7
8
from .utils import cast_all
8
9
9
10
10
- class YBaseDoc :
11
+ class YBaseDoc ( ABC ) :
11
12
def __init__ (self , ydoc : Y .YDoc ):
12
13
self ._ydoc = ydoc
13
14
self ._ystate = self ._ydoc .get_map ("state" )
@@ -38,14 +39,17 @@ def dirty(self, value: bool) -> None:
38
39
with self ._ydoc .begin_transaction () as t :
39
40
self ._ystate .set (t , "dirty" , value )
40
41
42
+ @abstractmethod
41
43
def get (self ):
42
- raise RuntimeError ( "Y document get not implemented" )
44
+ pass
43
45
46
+ @abstractmethod
44
47
def set (self , value ):
45
- raise RuntimeError ( "Y document set not implemented" )
48
+ pass
46
49
50
+ @abstractmethod
47
51
def observe (self , callback ):
48
- raise RuntimeError ( "Y document observe not implemented" )
52
+ pass
49
53
50
54
def unobserve (self ):
51
55
for k , v in self ._subscriptions .items ():
You can’t perform that action at this time.
0 commit comments