MCPcopy
hub / github.com/pytest-dev/pytest / indent

Method indent

src/_pytest/_code/source.py:87–93  ·  view source on GitHub ↗

Return a copy of the source object with all lines indented by the given indent-string.

(self, indent: str = " " * 4)

Source from the content-addressed store, hash-verified

85 return source
86
87 def indent(self, indent: str = " " * 4) -> Source:
88 """Return a copy of the source object with all lines indented by the
89 given indent-string."""
90 newsource = Source()
91 newsource.raw_lines = self.raw_lines
92 newsource.lines = [(indent + line) for line in self.lines]
93 return newsource
94
95 def getstatement(self, lineno: int) -> Source:
96 """Return Source statement which contains the given linenumber

Callers 2

_teardown_yield_fixtureFunction · 0.80

Calls 1

SourceClass · 0.85

Tested by 1