MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / validate_ipv4_address

Function validate_ipv4_address

tortoise/validators.py:120–130  ·  view source on GitHub ↗

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

(value: Any)

Source from the content-addressed store, hash-verified

118
119
120def validate_ipv4_address(value: Any) -> None:
121 """
122 A validator to validate whether the given value is valid IPv4Address or not.
123
124 :raises ValidationError: if value is invalid IPv4Address.
125 """
126
127 try:
128 ipaddress.IPv4Address(value)
129 except ValueError:
130 raise ValidationError(f"'{value}' is not a valid IPv4 address.")
131
132
133def validate_ipv6_address(value: Any) -> None:

Callers 1

validate_ipv46_addressFunction · 0.85

Calls 1

ValidationErrorClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…