Bugfix: replaced module yangson.context with yangson.schemadata

parent 28ff994d
from typing import List, Tuple, Callable, Any from typing import List, Tuple, Callable, Any
from yangson.context import Context
from yangson.schema import SchemaNode from yangson.schema import SchemaNode
from yangson.schemadata import SchemaData
from yangson.instance import InstanceRoute from yangson.instance import InstanceRoute
HandlerSelectorT = Any HandlerSelectorT = Any
...@@ -102,11 +102,11 @@ class StateDataHandlerList: ...@@ -102,11 +102,11 @@ class StateDataHandlerList:
self.handlers = [] self.handlers = []
def register_handler(self, handler: "StateNodeHandlerBase"): def register_handler(self, handler: "StateNodeHandlerBase"):
saddr = Context.path2route(handler.sch_pth) saddr = SchemaData.path2route(handler.sch_pth)
self.handlers.append((saddr, handler)) self.handlers.append((saddr, handler))
def get_handler(self, sch_pth: str, allow_superior: bool = True) -> Callable: def get_handler(self, sch_pth: str, allow_superior: bool = True) -> Callable:
saddr = Context.path2route(sch_pth) saddr = SchemaData.path2route(sch_pth)
if allow_superior: if allow_superior:
while saddr: while saddr:
for h in self.handlers: for h in self.handlers:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment