File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 8
8
import mimetypes
9
9
import os
10
10
from collections import OrderedDict
11
- from functools import lru_cache
11
+
12
+ try :
13
+ from functools import lru_cache
14
+ except ImportError :
15
+ # Only works for single-argument functions.
16
+ def lru_cache (* args , ** kwargs ):
17
+ cache = {}
18
+ def wrapper (fn ):
19
+ def wrapped (arg ):
20
+ value = cache .get (arg , None )
21
+ if value is not None :
22
+ return value
23
+ value = fn (arg )
24
+ cache [arg ] = value
25
+ return value
26
+ return wrapped
27
+ return wrapper
12
28
13
29
from pip ._vendor import html5lib , requests
14
30
from pip ._vendor .distlib .compat import unescape
Original file line number Diff line number Diff line change @@ -290,12 +290,12 @@ def test_parse_links_caches_same_page():
290
290
page_1 = HTMLPage (
291
291
html_bytes ,
292
292
encoding = None ,
293
- url = 'https://example.com/simple /' ,
293
+ url = 'https://example.com/some-find-links-url /' ,
294
294
)
295
295
page_2 = HTMLPage (
296
296
html_bytes ,
297
297
encoding = None ,
298
- url = 'https://example.com/simple /' ,
298
+ url = 'https://example.com/some-find-links-url /' ,
299
299
)
300
300
301
301
with mock .patch ("pip._internal.index.collector.html5lib.parse" ) as mock_parse :
You can’t perform that action at this time.
0 commit comments