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

Function getline

Lib/linecache.py:22–29  ·  view source on GitHub ↗

Get a line for a Python source file from the cache. Update the cache if it doesn't contain an entry for this file already.

(filename, lineno, module_globals=None)

Source from the content-addressed store, hash-verified

20
21
22def getline(filename, lineno, module_globals=None):
23 """Get a line for a Python source file from the cache.
24 Update the cache if it doesn't contain an entry for this file already."""
25
26 lines = getlines(filename, module_globals)
27 if 1 <= lineno <= len(lines):
28 return lines[lineno - 1]
29 return ''
30
31
32def getlines(filename, module_globals=None):

Callers 2

test_getlineMethod · 0.85
test_checkcacheMethod · 0.85

Calls 1

getlinesFunction · 0.85

Tested by 2

test_getlineMethod · 0.68
test_checkcacheMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…