Skip to content

Commit 0983306

Browse files
committed
Add type annotations to _parse_hostlist
1 parent 92f3ae6 commit 0983306

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

asyncpg/connect_utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,20 @@ def _validate_port_spec(
183183
return port
184184

185185

186-
def _parse_hostlist(hostlist, port, *, unquote=False):
186+
def _parse_hostlist(
187+
hostlist: str,
188+
port: typing.Union[int, typing.List[int]],
189+
*,
190+
unquote: bool = False,
191+
) -> typing.Tuple[typing.List[str], typing.List[int]]:
187192
if ',' in hostlist:
188193
# A comma-separated list of host addresses.
189194
hostspecs = hostlist.split(',')
190195
else:
191196
hostspecs = [hostlist]
192197

193-
hosts = []
194-
hostlist_ports = []
198+
hosts: typing.List[str] = []
199+
hostlist_ports: typing.List[int] = []
195200

196201
if not port:
197202
portspec = os.environ.get('PGPORT')

0 commit comments

Comments
 (0)