Fix typing
This commit is contained in:
parent
ff9f059e45
commit
afdc022c1f
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
"""Network utilities."""
|
||||
from ipaddress import ip_address, ip_network
|
||||
|
||||
from ipaddress import IPv4Address, IPv6Address, ip_address, ip_network
|
||||
from typing import Union
|
||||
|
||||
# IP addresses of loopback interfaces
|
||||
LOCAL_IPS = (
|
||||
|
@ -16,7 +16,7 @@ LOCAL_NETWORKS = (
|
|||
)
|
||||
|
||||
|
||||
def is_local(address: ip_address) -> bool:
|
||||
def is_local(address: Union[IPv4Address, IPv6Address]) -> bool:
|
||||
"""Check if an address is local."""
|
||||
return address in LOCAL_IPS or \
|
||||
any(address in network for network in LOCAL_NETWORKS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue