(host: str | bytes, port: int | str)
| 155 | |
| 156 | |
| 157 | def format_host_port(host: str | bytes, port: int | str) -> str: |
| 158 | host = host.decode("ascii") if isinstance(host, bytes) else host |
| 159 | if ":" in host: |
| 160 | return f"[{host}]:{port}" |
| 161 | else: |
| 162 | return f"{host}:{port}" |
| 163 | |
| 164 | |
| 165 | # Twisted's HostnameEndpoint has a good set of configurations: |
no outgoing calls
searching dependent graphs…