Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libyang/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,13 @@ def name(self) -> str:
def module(self) -> Module:
return self._module_from_parsed()

def parent_node(self) -> Optional[Union["PNode", "PIdentity"]]:
def parent_node(self) -> Optional[Union["PNode", "PIdentity", "PRefine"]]:
if self.cdata.parent_stmt == lib.LY_STMT_IDENTITY:
cdata = ffi.cast("struct lysp_ident *", self.cdata.parent)
return PIdentity(self.context, cdata, self.module_parent)
if self.cdata.parent_stmt == lib.LY_STMT_REFINE:
cdata = ffi.cast("struct lysp_refine *", self.cdata.parent)
return PRefine(self.context, cdata, self.module_parent)
if bool(self.cdata.parent_stmt & lib.LY_STMT_NODE_MASK):
try:
return PNode.new(self.context, self.cdata.parent, self.module_parent)
Expand Down