MCPcopy
hub / github.com/sphinx-doc/sphinx / read

Method read

sphinx/directives/code.py:242–259  ·  view source on GitHub ↗
(self, location: tuple[str, int] | None = None)

Source from the content-addressed store, hash-verified

240 raise UnicodeError(msg) from exc
241
242 def read(self, location: tuple[str, int] | None = None) -> tuple[str, int]:
243 if 'diff' in self.options:
244 lines = self.show_diff()
245 else:
246 filters = [
247 self.pyobject_filter,
248 self.start_filter,
249 self.end_filter,
250 self.lines_filter,
251 self.dedent_filter,
252 self.prepend_filter,
253 self.append_filter,
254 ]
255 lines = self.read_file(self.filename, location=location)
256 for func in filters:
257 lines = func(lines, location=location)
258
259 return ''.join(lines), len(lines)
260
261 def show_diff(self, location: tuple[str, int] | None = None) -> list[str]:
262 new_lines = self.read_file(self.filename)

Calls 4

show_diffMethod · 0.95
read_fileMethod · 0.95
funcFunction · 0.50
joinMethod · 0.45