MCPcopy Create free account
hub / github.com/pytest-dev/pytest / _getindent

Method _getindent

src/_pytest/_code/code.py:702–715  ·  view source on GitHub ↗
(self, source: "Source")

Source from the content-addressed store, hash-verified

700 )
701
702 def _getindent(self, source: "Source") -> int:
703 # Figure out indent for the given source.
704 try:
705 s = str(source.getstatement(len(source) - 1))
706 except KeyboardInterrupt:
707 raise
708 except BaseException:
709 try:
710 s = str(source[-1])
711 except KeyboardInterrupt:
712 raise
713 except BaseException:
714 return 0
715 return 4 + (len(s) - len(s.lstrip()))
716
717 def _getentrysource(self, entry: TracebackEntry) -> Optional["Source"]:
718 source = entry.getsource(self.astcache)

Callers 1

get_sourceMethod · 0.95

Calls 1

getstatementMethod · 0.80

Tested by

no test coverage detected