@@ -29,7 +29,7 @@ def __init__(self, initial_data: Optional[Dict[str, Any]] = None):
2929 self ._listeners : Dict [str , Set [Callable [[Any ], None ]]] = {}
3030
3131 @staticmethod
32- def parse_pointer (path : str ) -> List [str ]:
32+ def _parse_pointer (path : str ) -> List [str ]:
3333 """Splits a JSON Pointer path into individual unescaped tokens."""
3434 if not path or path == "/" :
3535 return []
@@ -41,7 +41,7 @@ def parse_pointer(path: str) -> List[str]:
4141 return [t .replace ("~1" , "/" ).replace ("~0" , "~" ) for t in tokens ]
4242
4343 @staticmethod
44- def build_pointer (tokens : List [str ]) -> str :
44+ def _build_pointer (tokens : List [str ]) -> str :
4545 """Assembles unescaped tokens back into an absolute JSON Pointer."""
4646 if not tokens :
4747 return "/"
@@ -50,7 +50,7 @@ def build_pointer(tokens: List[str]) -> str:
5050
5151 def get (self , path : str ) -> Any :
5252 """Resolves the JSON Pointer path to its current value."""
53- tokens = self .parse_pointer (path )
53+ tokens = self ._parse_pointer (path )
5454 if not tokens :
5555 return self ._data
5656
@@ -70,7 +70,7 @@ def get(self, path: str) -> Any:
7070
7171 def has_path (self , path : str ) -> bool :
7272 """Checks if a JSON Pointer path physically exists in the data model."""
73- tokens = self .parse_pointer (path )
73+ tokens = self ._parse_pointer (path )
7474 if not tokens :
7575 return True
7676
@@ -90,7 +90,7 @@ def has_path(self, path: str) -> bool:
9090
9191 def set (self , path : str , value : Any ) -> None :
9292 """Sets a value atomically at a JSON Pointer path with auto-vivification."""
93- tokens = self .parse_pointer (path )
93+ tokens = self ._parse_pointer (path )
9494 if not tokens :
9595 self ._data = copy .deepcopy (value )
9696 self ._trigger_listeners ("/" , value )
@@ -138,7 +138,7 @@ def set(self, path: str, value: Any) -> None:
138138 def subscribe (self , path : str , on_change : Callable [[Any ], None ]) -> Subscription :
139139 """Registers a listener to monitor changes reactive to this path."""
140140 # Normalize path pointer
141- norm_path = self .build_pointer (self .parse_pointer (path ))
141+ norm_path = self ._build_pointer (self ._parse_pointer (path ))
142142 self ._listeners .setdefault (norm_path , set ()).add (on_change )
143143
144144 # Return subscription armed with unsubscription and initial value
@@ -161,12 +161,12 @@ def _trigger_cascade(self, tokens: List[str]) -> None:
161161 # 1. Bubble Up: Notify all parent paths
162162 for length in range (len (tokens ) + 1 ):
163163 parent_tokens = tokens [:length ]
164- parent_path = self .build_pointer (parent_tokens )
164+ parent_path = self ._build_pointer (parent_tokens )
165165 self ._trigger_listeners (parent_path , self .get (parent_path ))
166166
167167 # 2. Cascade Down: Find and notify all nested descendants
168168 for registered_path in list (self ._listeners .keys ()):
169- reg_tokens = self .parse_pointer (registered_path )
169+ reg_tokens = self ._parse_pointer (registered_path )
170170 if len (reg_tokens ) > len (tokens ) and reg_tokens [: len (tokens )] == tokens :
171171 self ._trigger_listeners (registered_path , self .get (registered_path ))
172172
0 commit comments