Skip to content

Commit f435d1b

Browse files
committed
schema: adds ability to get PRefine within extension parent_node
This patch adds ability to get also PRefine as a valid output using extension parent_node function Signed-off-by: Stefan Gula <steweg@gmail.com>
1 parent 3072af0 commit f435d1b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libyang/schema.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,13 @@ def name(self) -> str:
423423
def module(self) -> Module:
424424
return self._module_from_parsed()
425425

426-
def parent_node(self) -> Optional[Union["PNode", "PIdentity"]]:
426+
def parent_node(self) -> Optional[Union["PNode", "PIdentity", "PRefine"]]:
427427
if self.cdata.parent_stmt == lib.LY_STMT_IDENTITY:
428428
cdata = ffi.cast("struct lysp_ident *", self.cdata.parent)
429429
return PIdentity(self.context, cdata, self.module_parent)
430+
if self.cdata.parent_stmt == lib.LY_STMT_REFINE:
431+
cdata = ffi.cast("struct lysp_refine *", self.cdata.parent)
432+
return PRefine(self.context, cdata, self.module_parent)
430433
if bool(self.cdata.parent_stmt & lib.LY_STMT_NODE_MASK):
431434
try:
432435
return PNode.new(self.context, self.cdata.parent, self.module_parent)

0 commit comments

Comments
 (0)