Final typing fixes

This commit is contained in:
Adrien Ferrand 2022-01-19 11:47:34 +01:00
parent 8840618c2d
commit f0f0b4db08
2 changed files with 4 additions and 2 deletions

View file

@ -984,7 +984,9 @@ class ApacheConfigurator(common.Configurator):
for arg in args:
arg_value = self.parser.get_arg(arg)
if arg_value is not None:
addrs.add(obj.Addr.fromstring(arg_value))
addr = obj.Addr.fromstring(arg_value)
if addr is not None:
addrs.add(addr)
is_ssl = False
if self.parser.find_dir("SSLEngine", "on", start=path, exclude=False):

View file

@ -261,7 +261,7 @@ class Addr:
self.ipv6 = ipv6
@classmethod
def fromstring(cls: Type[GenericAddr], str_addr: str) -> GenericAddr:
def fromstring(cls: Type[GenericAddr], str_addr: str) -> Optional[GenericAddr]:
"""Initialize Addr from string."""
if str_addr.startswith('['):
# ipv6 addresses starts with [