(self, filename, lines)
| 100 | |
| 101 | class 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 | |
| 123 | class StandardHeader: |
no test coverage detected