Remove unneeded casts now that Addr.fromstring can't be None (#10167)

Now that https://github.com/certbot/certbot/pull/10162 is in
This commit is contained in:
ohemorange 2025-02-06 10:53:22 -08:00 committed by GitHub
parent aafe7ba2f9
commit 9989e7b82f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -731,7 +731,7 @@ class NginxConfigurator(common.Configurator):
assert not vhost.ssl
addrs_to_insert: List[obj.Addr] = [
cast(obj.Addr, obj.Addr.fromstring(f'{addr.get_addr()}:{https_port} ssl'))
obj.Addr.fromstring(f'{addr.get_addr()}:{https_port} ssl')
for addr in vhost.addrs
if addr.get_port() == str(http_port)
]
@ -745,9 +745,9 @@ class NginxConfigurator(common.Configurator):
if not addrs_to_insert:
# there are no existing addresses listening on 80
if vhost.ipv6_enabled():
addrs_to_insert += [cast(obj.Addr, obj.Addr.fromstring(f'[::]:{https_port} ssl'))]
addrs_to_insert += [obj.Addr.fromstring(f'[::]:{https_port} ssl')]
if vhost.ipv4_enabled():
addrs_to_insert += [cast(obj.Addr, obj.Addr.fromstring(f'{https_port} ssl'))]
addrs_to_insert += [obj.Addr.fromstring(f'{https_port} ssl')]
addr_blocks: List[List[str]] = []
ipv6only_set_here: Set[Tuple[str, str]] = set()