Lines Matching defs:cache
16 # The cache. Maps filenames to either a thunk which will provide source code,
18 cache = {}
22 """Clear the cache entirely."""
23 cache.clear()
27 """Get a line for a Python source file from the cache.
28 Update the cache if it doesn't contain an entry for this file already."""
37 """Get the lines for a Python source file from the cache.
38 Update the cache if it doesn't contain an entry for this file already."""
40 if filename in cache:
41 entry = cache[filename]
43 return cache[filename][2]
53 """Discard cache entries that are out of date.
57 filenames = list(cache.keys())
58 elif filename in cache:
64 entry = cache[filename]
66 # lazy cache entry, leave it lazy.
74 cache.pop(filename, None)
77 cache.pop(filename, None)
81 """Update a cache entry and return its list of lines.
82 If something's wrong, print a message, discard the cache entry,
85 if filename in cache:
86 if len(cache[filename]) != 1:
87 cache.pop(filename, None)
101 data = cache[filename][0]()
109 cache[filename] = (
115 return cache[filename][2]
143 cache[filename] = size, mtime, lines, fullname
148 """Seed the cache for filename with module_globals.
153 If there is an entry in the cache already, it is not altered.
155 :return: True if a lazy load is registered in the cache,
160 if filename in cache:
161 if len(cache[filename]) == 1:
180 cache[filename] = (get_lines,)