From 9989e7b82f9fa64521b1feb3e86d8b633d3af24a Mon Sep 17 00:00:00 2001 From: ohemorange Date: Thu, 6 Feb 2025 10:53:22 -0800 Subject: [PATCH] Remove unneeded casts now that Addr.fromstring can't be None (#10167) Now that https://github.com/certbot/certbot/pull/10162 is in --- certbot-nginx/certbot_nginx/_internal/configurator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/certbot-nginx/certbot_nginx/_internal/configurator.py b/certbot-nginx/certbot_nginx/_internal/configurator.py index 3ca133338..5bb5aa152 100644 --- a/certbot-nginx/certbot_nginx/_internal/configurator.py +++ b/certbot-nginx/certbot_nginx/_internal/configurator.py @@ -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()