MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / fix

Method fix

scripts/fix_headers.py:102–120  ·  view source on GitHub ↗
(self, filename, lines)

Source from the content-addressed store, hash-verified

100
101class PythonHeader:
102 def fix(self, filename, lines):
103 isExecutable = len(lines) > 0 and lines[0].startswith("#!")
104 newLines = []
105
106 if isExecutable:
107 newLines.append("#!/usr/bin/env python")
108
109 for line in generateLicenseSection(filename):
110 newLines.append(line)
111
112 bodyLines = extractBodyLines(lines)
113
114 if len(bodyLines) > 0 and bodyLines[0] != "":
115 newLines.append("")
116 if "import " not in bodyLines[0] and bodyLines[0] != '"""' and not bodyLines[0].startswith("##########"):
117 newLines.append("")
118 newLines += bodyLines
119
120 return newLines
121
122
123class StandardHeader:

Callers 1

mainFunction · 0.45

Calls 2

generateLicenseSectionFunction · 0.85
extractBodyLinesFunction · 0.85

Tested by

no test coverage detected