Skip to content

Commit

Permalink
schema: fix type for max_elements
Browse files Browse the repository at this point in the history
Those functions can return None, fix their expected type.

Closes: #102
Signed-off-by: Stefan Gula <[email protected]>
Signed-off-by: Samuel Gauthier <[email protected]>
  • Loading branch information
samuel-gauthier committed Aug 2, 2024
1 parent 766ef3c commit 3fc55b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libyang/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3fc55b0

Please sign in to comment.