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

Method __enter__

pymongo/_csot.py:84–90  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

82 self._tokens: Optional[tuple[Token[Optional[float]], Token[float], Token[float]]] = None
83
84 def __enter__(self) -> None:
85 timeout_token = TIMEOUT.set(self._timeout)
86 prev_deadline = DEADLINE.get()
87 next_deadline = time.monotonic() + self._timeout if self._timeout else float("inf")
88 deadline_token = DEADLINE.set(min(prev_deadline, next_deadline))
89 rtt_token = RTT.set(0.0)
90 self._tokens = (timeout_token, deadline_token, rtt_token)
91
92 def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
93 if self._tokens:

Callers

nothing calls this directly

Calls 2

setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected