Fix a couple syntax typos

main
kaiyou 6 years ago committed by Alexander Graf
parent 351b05b92d
commit 74a3e87de3
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -2,8 +2,8 @@ import socket
import tenacity import tenacity
@retry(stop=tenacity.stop_after_attempt(100), @tenacity.retry(stop=tenacity.stop_after_attempt(100),
wait=tenacity.wait_random(min=2, max=5)) wait=tenacity.wait_random(min=2, max=5))
def resolve_hostname(hostname): def resolve_hostname(hostname):
""" This function uses system DNS to resolve a hostname. """ This function uses system DNS to resolve a hostname.
It is capable of retrying in case the host is not immediately available It is capable of retrying in case the host is not immediately available
@ -15,6 +15,6 @@ def resolve_address(address):
""" This function is identical to ``resolve_host`` but also supports """ This function is identical to ``resolve_host`` but also supports
resolving an address, i.e. including a port. resolving an address, i.e. including a port.
""" """
hostname, *rest = address.resplit(":", 1) hostname, *rest = address.rsplit(":", 1)
ip_address = resolve_hostname(hostname) ip_address = resolve_hostname(hostname)
return ip_address + "".join(":" + port for port in rest) return ip_address + "".join(":" + port for port in rest)

Loading…
Cancel
Save