Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/validators/_extremes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AbsMax:

def __ge__(self, other: Any):
"""GreaterThanOrEqual."""
return other is not AbsMax
return not isinstance(other, AbsMax)


@total_ordering
Expand All @@ -44,4 +44,4 @@ class AbsMin:

def __le__(self, other: Any):
"""LessThanOrEqual."""
return other is not AbsMin
return not isinstance(other, AbsMin)
4 changes: 3 additions & 1 deletion src/validators/ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def ipv4(
if cidr:
if strict and value.count("/") != 1:
raise ValueError("IPv4 address was expected in CIDR notation")
return IPv4Network(value, strict=not host_bit) and _check_private_ip(value, private)
# Extract IP part for private check when using CIDR notation
ip_part = value.split('/')[0] if '/' in value else value
return IPv4Network(value, strict=not host_bit) and _check_private_ip(ip_part, private)
return IPv4Address(value) and _check_private_ip(value, private)
except (ValueError, AddressValueError, NetmaskValueError):
return False
Expand Down