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

Function get_comment_header

Lib/idlelib/format.py:187–196  ·  view source on GitHub ↗

Return string with leading whitespace and '#' from line or ''. A null return indicates that the line is not a comment line. A non- null return, such as ' #', will be used to find the other lines of a comment block with the same indent.

(line)

Source from the content-addressed store, hash-verified

185 return re.match(r"^([ \t]*)", line).group()
186
187def get_comment_header(line):
188 """Return string with leading whitespace and '#' from line or ''.
189
190 A null return indicates that the line is not a comment line. A non-
191 null return, such as ' #', will be used to find the other lines of
192 a comment block with the same indent.
193 """
194 m = re.match(r"^([ \t]*#*)", line)
195 if m is None: return ""
196 return m.group(1)
197
198
199# Copied from editor.py; importing it would cause an import cycle.

Callers 2

find_paragraphFunction · 0.85

Calls 2

matchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…