MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _validate_port_spec

Function _validate_port_spec

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

Source from the content-addressed store, hash-verified

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

Callers 2

_parse_hostlistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected