MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / _validate_port_spec

Function _validate_port_spec

asyncpg/connect_utils.py:174–187  ·  view source on GitHub ↗
(hosts, port)

Source from the content-addressed store, hash-verified

172
173
174def _validate_port_spec(hosts, port):
175 if isinstance(port, list) and len(port) > 1:
176 # If there is a list of ports, its length must
177 # match that of the host list.
178 if len(port) != len(hosts):
179 raise exceptions.ClientConfigurationError(
180 'could not match {} port numbers to {} hosts'.format(
181 len(port), len(hosts)))
182 elif isinstance(port, list) and len(port) == 1:
183 port = [port[0] for _ in range(len(hosts))]
184 else:
185 port = [port for _ in range(len(hosts))]
186
187 return port
188
189
190def _parse_hostlist(hostlist, port, *, unquote=False):

Callers 2

_parse_hostlistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…