MCPcopy Create free account
hub / github.com/mne-tools/mne-python / first_commentable_line

Function first_commentable_line

tools/dev/ensure_headers.py:49–65  ·  view source on GitHub ↗

Find the first line where we can add a comment.

(lines)

Source from the content-addressed store, hash-verified

47
48
49def first_commentable_line(lines):
50 """Find the first line where we can add a comment."""
51 max_len = 100
52 if lines[0].startswith(('"""', 'r"""')):
53 if lines[0].count('"""') == 2:
54 return 1
55 for insert in range(1, min(max_len, len(lines))):
56 if '"""' in lines[insert]:
57 return insert + 1
58 else:
59 raise RuntimeError(
60 f"Failed to find end of file docstring within {max_len} lines"
61 )
62 if lines[0].startswith("#!"):
63 return 1
64 else:
65 return 0
66
67
68def path_multi_author(path):

Callers 1

_ensure_authorFunction · 0.85

Calls 1

countMethod · 0.80

Tested by

no test coverage detected