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

Method emit_multiline_comment

Tools/cases_generator/cwriter.py:78–94  ·  view source on GitHub ↗
(self, tkn: Token)

Source from the content-addressed store, hash-verified

76 self.out.write(txt)
77
78 def emit_multiline_comment(self, tkn: Token) -> None:
79 self.set_position(tkn)
80 lines = tkn.text.splitlines(True)
81 first = True
82 for line in lines:
83 text = line.lstrip()
84 if first:
85 spaces = 0
86 else:
87 spaces = self.indents[-1]
88 if text.startswith("*"):
89 spaces += 1
90 else:
91 spaces += 3
92 first = False
93 self.out.write(" " * spaces)
94 self.out.write(text)
95
96 def emit_token(self, tkn: Token) -> None:
97 if tkn.kind == "COMMENT" and "\n" in tkn.text:

Callers 1

emit_tokenMethod · 0.95

Calls 5

set_positionMethod · 0.95
splitlinesMethod · 0.45
lstripMethod · 0.45
startswithMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected