style: use 'is not None' for port check (handle port 0 explicitly)

This commit is contained in:
user 2026-04-16 22:25:24 +00:00
parent 0602564b66
commit aa2f05f8c9
No known key found for this signature in database

View file

@ -170,7 +170,7 @@ def validate_url(url: str) -> Tuple[str, str]:
is_ipv6 = addrinfo[0][0] == socket.AF_INET6
ip_host = f"[{validated_ip}]" if is_ipv6 else validated_ip
if port:
if port is not None:
new_netloc = f"{ip_host}:{port}"
else:
new_netloc = ip_host