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

Method get_cached_location

Lib/_pyrepl/reader.py:248–261  ·  view source on GitHub ↗
(self, reader: Reader)

Source from the content-addressed store, hash-verified

246 return not dimensions_changed
247
248 def get_cached_location(self, reader: Reader) -> tuple[int, int]:
249 if self.invalidated:
250 raise ValueError("Cache is invalidated")
251 offset = 0
252 earliest_common_pos = min(reader.pos, self.pos)
253 num_common_lines = len(self.line_end_offsets)
254 while num_common_lines > 0:
255 offset = self.line_end_offsets[num_common_lines - 1]
256 if earliest_common_pos > offset:
257 break
258 num_common_lines -= 1
259 else:
260 offset = 0
261 return offset, num_common_lines
262
263 last_refresh_cache: RefreshCache = field(default_factory=RefreshCache)
264

Callers 1

calc_screenMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected