MCPcopy
hub / github.com/tortoise/tortoise-orm / validate_ipv46_address

Function validate_ipv46_address

tortoise/validators.py:145–157  ·  view source on GitHub ↗

A validator to validate whether the given value is valid IPv4Address or IPv6Address or not. :raises ValidationError: if value is invalid IPv4Address or IPv6Address.

(value: Any)

Source from the content-addressed store, hash-verified

143
144
145def validate_ipv46_address(value: Any) -> None:
146 """
147 A validator to validate whether the given value is valid IPv4Address or IPv6Address or not.
148
149 :raises ValidationError: if value is invalid IPv4Address or IPv6Address.
150 """
151 try:
152 validate_ipv4_address(value)
153 except ValidationError:
154 try:
155 validate_ipv6_address(value)
156 except ValidationError:
157 raise ValidationError(f"'{value}' is not a valid IPv4 or IPv6 address.")

Callers

nothing calls this directly

Calls 3

ValidationErrorClass · 0.90
validate_ipv4_addressFunction · 0.85
validate_ipv6_addressFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…