in utils/license-headers.py [0:0]
def does_file_need_fix(filepath: str) -> bool:
if not filepath.endswith(".py"):
return False
with open(filepath, mode="r") as f:
first_license_line = None
for line in f:
if line == license_header_lines[0]:
first_license_line = line
break
elif line not in lines_to_keep:
return True
for header_line, line in zip(
license_header_lines, chain((first_license_line,), f)
):
if line != header_line:
return True
return False