Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pip/_vendor/cachecontrol/wrapper.py: 33%

9 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:48 +0000

1# SPDX-FileCopyrightText: 2015 Eric Larson 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4 

5from .adapter import CacheControlAdapter 

6from .cache import DictCache 

7 

8 

9def CacheControl( 

10 sess, 

11 cache=None, 

12 cache_etags=True, 

13 serializer=None, 

14 heuristic=None, 

15 controller_class=None, 

16 adapter_class=None, 

17 cacheable_methods=None, 

18): 

19 

20 cache = DictCache() if cache is None else cache 

21 adapter_class = adapter_class or CacheControlAdapter 

22 adapter = adapter_class( 

23 cache, 

24 cache_etags=cache_etags, 

25 serializer=serializer, 

26 heuristic=heuristic, 

27 controller_class=controller_class, 

28 cacheable_methods=cacheable_methods, 

29 ) 

30 sess.mount("http://", adapter) 

31 sess.mount("https://", adapter) 

32 

33 return sess