MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / partition_node

Function partition_node

pymongo/common.py:153–162  ·  view source on GitHub ↗

Split a host:port string into (host, int(port)) pair.

(node: str)

Source from the content-addressed store, hash-verified

151
152
153def partition_node(node: str) -> tuple[str, int]:
154 """Split a host:port string into (host, int(port)) pair."""
155 host = node
156 port = 27017
157 idx = node.rfind(":")
158 if idx != -1:
159 host, port = node[:idx], int(node[idx + 1 :])
160 if host.startswith("["):
161 host = host[1:-1]
162 return host, port
163
164
165def clean_node(node: str) -> tuple[str, int]:

Callers 5

setUpMethod · 0.90
_init_clientMethod · 0.90
asyncSetUpMethod · 0.90
_init_clientMethod · 0.90
clean_nodeFunction · 0.85

Calls

no outgoing calls

Tested by 2

setUpMethod · 0.72
asyncSetUpMethod · 0.72