Drop compatibility code for Python 3.8
Python 3.8 support has been removed and now the minimum supported python version is 3.9. Change-Id: Ic1fa1921ef3c66f5fd32a4e6e23dc843bc877f42
This commit is contained in:
@@ -144,19 +144,10 @@ def get_noscope_ipv6(address):
|
|||||||
|
|
||||||
.. versionadded: 7.3.0:
|
.. versionadded: 7.3.0:
|
||||||
"""
|
"""
|
||||||
# TODO(egarciar): Scope was added for IPv6Address on Python 3.9. Same for
|
_ipv6 = ipaddress.IPv6Address(address)
|
||||||
# the removesuffix str method. Remove try/except when minimum required
|
if _ipv6.scope_id:
|
||||||
# version for Python is 3.9
|
address = address.removesuffix('%' + _ipv6.scope_id)
|
||||||
try:
|
return address
|
||||||
_ipv6 = ipaddress.IPv6Address(address)
|
|
||||||
if _ipv6.scope_id:
|
|
||||||
address = address.removesuffix('%' + _ipv6.scope_id)
|
|
||||||
return address
|
|
||||||
except (ipaddress.AddressValueError, AttributeError):
|
|
||||||
if is_valid_ipv6(address):
|
|
||||||
parts = address.rsplit("%", 1)
|
|
||||||
return parts[0]
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
def is_valid_cidr(address):
|
def is_valid_cidr(address):
|
||||||
|
|||||||
Reference in New Issue
Block a user