aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are hereHEADmaster
Diffstat (limited to '.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py')
-rw-r--r--.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py b/.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py
new file mode 100644
index 00000000..f618bc36
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/pip/_vendor/cachecontrol/wrapper.py
@@ -0,0 +1,43 @@
+# SPDX-FileCopyrightText: 2015 Eric Larson
+#
+# SPDX-License-Identifier: Apache-2.0
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Collection
+
+from pip._vendor.cachecontrol.adapter import CacheControlAdapter
+from pip._vendor.cachecontrol.cache import DictCache
+
+if TYPE_CHECKING:
+ from pip._vendor import requests
+
+ from pip._vendor.cachecontrol.cache import BaseCache
+ from pip._vendor.cachecontrol.controller import CacheController
+ from pip._vendor.cachecontrol.heuristics import BaseHeuristic
+ from pip._vendor.cachecontrol.serialize import Serializer
+
+
+def CacheControl(
+ sess: requests.Session,
+ cache: BaseCache | None = None,
+ cache_etags: bool = True,
+ serializer: Serializer | None = None,
+ heuristic: BaseHeuristic | None = None,
+ controller_class: type[CacheController] | None = None,
+ adapter_class: type[CacheControlAdapter] | None = None,
+ cacheable_methods: Collection[str] | None = None,
+) -> requests.Session:
+ cache = DictCache() if cache is None else cache
+ adapter_class = adapter_class or CacheControlAdapter
+ adapter = adapter_class(
+ cache,
+ cache_etags=cache_etags,
+ serializer=serializer,
+ heuristic=heuristic,
+ controller_class=controller_class,
+ cacheable_methods=cacheable_methods,
+ )
+ sess.mount("http://", adapter)
+ sess.mount("https://", adapter)
+
+ return sess