From 3fc55b05cec8c32bc658289a0e34859313248f41 Mon Sep 17 00:00:00 2001 From: Samuel Gauthier Date: Fri, 2 Aug 2024 13:50:57 +0200 Subject: [PATCH] schema: fix type for max_elements Those functions can return None, fix their expected type. Closes: https://github.com/CESNET/libyang-python/pull/102 Signed-off-by: Stefan Gula Signed-off-by: Samuel Gauthier --- libyang/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libyang/schema.py b/libyang/schema.py index fb0787f..c0985a4 100644 --- a/libyang/schema.py +++ b/libyang/schema.py @@ -1382,7 +1382,7 @@ def defaults(self) -> Iterator[Union[None, bool, int, str, float]]: else: yield val - def max_elements(self) -> int: + def max_elements(self) -> Optional[int]: return ( self.cdata_leaflist.max if self.cdata_leaflist.max != (2**32 - 1) @@ -1506,7 +1506,7 @@ def uniques(self) -> Iterator[List[SNode]]: nodes.append(SNode.new(self.context, node)) yield nodes - def max_elements(self) -> int: + def max_elements(self) -> Optional[int]: return self.cdata_list.max if self.cdata_list.max != (2**32 - 1) else None def min_elements(self) -> int: