MCPcopy Index your code
hub / github.com/python/cpython / getlines

Function getlines

Lib/linecache.py:32–44  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

30
31
32def getlines(filename, module_globals=None):
33 """Get the lines for a Python source file from the cache.
34 Update the cache if it doesn't contain an entry for this file already."""
35
36 entry = cache.get(filename, None)
37 if entry is not None and len(entry) != 1:
38 return entry[2]
39
40 try:
41 return updatecache(filename, module_globals)
42 except MemoryError:
43 clearcache()
44 return []
45
46
47def _getline_from_code(filename, lineno):

Callers 3

getlineFunction · 0.85
monkeyMethod · 0.85

Calls 3

updatecacheFunction · 0.85
clearcacheFunction · 0.85
getMethod · 0.45

Tested by 2

monkeyMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…