MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_cached_location

Method get_cached_location

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

Source from the content-addressed store, hash-verified

283 return not (dimensions_changed or paste_changed)
284
285 def get_cached_location(self, reader: Reader) -> tuple[int, int]:
286 if self.invalidated:
287 raise ValueError("Cache is invalidated")
288 offset = 0
289 earliest_common_pos = min(reader.pos, self.pos)
290 num_common_lines = len(self.line_end_offsets)
291 while num_common_lines > 0:
292 offset = self.line_end_offsets[num_common_lines - 1]
293 if earliest_common_pos > offset:
294 break
295 num_common_lines -= 1
296 else:
297 offset = 0
298 return offset, num_common_lines
299
300 last_refresh_cache: RefreshCache = field(default_factory=RefreshCache)
301

Callers 1

calc_screenMethod · 0.80

Calls 2

minFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected