MCPcopy
hub / github.com/urllib3/urllib3 / set_and_release

Method set_and_release

src/urllib3/http2/probe.py:51–63  ·  view source on GitHub ↗
(
        self, host: str, port: int, supports_http2: bool | None
    )

Source from the content-addressed store, hash-verified

49 return value
50
51 def set_and_release(
52 self, host: str, port: int, supports_http2: bool | None
53 ) -> None:
54 key = (host, port)
55 key_lock = self._cache_locks[key]
56 with key_lock: # Uses an RLock, so can be locked again from same thread.
57 if supports_http2 is None and self._cache_values[key] is not None:
58 raise ValueError(
59 "Cannot reset HTTP/2 support for origin after value has been set."
60 ) # Defensive: not expected in normal usage
61
62 self._cache_values[key] = supports_http2
63 key_lock.release()
64
65 def _values(self) -> dict[tuple[str, int], bool | None]:
66 """This function is for testing purposes only. Gets the current state of the probe cache"""

Callers 1

connectMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected