From f435d1bc0a24d422fb259ca8254b45288f1789b7 Mon Sep 17 00:00:00 2001 From: Stefan Gula Date: Mon, 22 Sep 2025 00:52:49 +0200 Subject: [PATCH] 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 --- libyang/schema.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libyang/schema.py b/libyang/schema.py index 3f3bd4d..5247de2 100644 --- a/libyang/schema.py +++ b/libyang/schema.py @@ -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)