Fix typing

This commit is contained in:
Paulus Schoutsen 2018-09-26 18:06:44 +02:00
parent ff9f059e45
commit afdc022c1f

View file

@ -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)