Get the lines for a Python source file from the cache. Update the cache if it doesn't contain an entry for this file already.
(filename, module_globals=None)
| 34 | |
| 35 | |
| 36 | def getlines(filename, module_globals=None): |
| 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.""" |
| 39 | |
| 40 | if filename in cache: |
| 41 | entry = cache[filename] |
| 42 | if len(entry) != 1: |
| 43 | return cache[filename][2] |
| 44 | |
| 45 | try: |
| 46 | return updatecache(filename, module_globals) |
| 47 | except MemoryError: |
| 48 | clearcache() |
| 49 | return [] |
| 50 | |
| 51 | |
| 52 | def checkcache(filename=None): |