MCPcopy Index your code
hub / github.com/hyperopt/hyperopt / connection_from_string

Function connection_from_string

hyperopt/mongoexp.py:291–302  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

289
290
291def connection_from_string(s):
292 protocol, user, pw, host, port, db, collection, authdb = parse_url(s)
293 if protocol == "mongo":
294 ssh = False
295 elif protocol in ("mongo+ssh", "ssh+mongo"):
296 ssh = True
297 else:
298 raise ValueError("unrecognized protocol for MongoJobs", protocol)
299 connection, tunnel = connection_with_tunnel(
300 dbname=db, ssh=ssh, user=user, pw=pw, host=host, port=port, auth_dbname=authdb
301 )
302 return connection, tunnel, connection[db], connection[db][collection]
303
304
305class MongoJobs:

Callers 1

Calls 2

parse_urlFunction · 0.85
connection_with_tunnelFunction · 0.85

Tested by

no test coverage detected