diff --git a/pontos/updateheader/updateheader.py b/pontos/updateheader/updateheader.py index 7024bf047..660c9bb1c 100644 --- a/pontos/updateheader/updateheader.py +++ b/pontos/updateheader/updateheader.py @@ -223,19 +223,33 @@ def update_file( f"-{year} {company}" ) - with_multi_year = copyright_match.creation_year and copyright_match.modification_year - with_single_year_outdated = not copyright_match.modification_year and int(copyright_match.creation_year) < int(year) - with_multi_year_outdated = with_multi_year and int(copyright_match.modification_year) < int(year) + with_multi_year = ( + copyright_match.creation_year + and isinstance(copyright_match.modification_year, str) + ) + with_single_year_outdated = ( + not copyright_match.modification_year + and int(copyright_match.creation_year) < int(year) + ) + with_multi_year_outdated = with_multi_year and int( + copyright_match.modification_year + ) < int(year) if single_year and with_multi_year: - _substitute_license_text(fp, line, copyright_regex, copyright_term) + _substitute_license_text( + fp, line, copyright_regex, copyright_term + ) print( f"{file}: Changed License Header Copyright Year format to single year " f"{copyright_match.creation_year}-{year} -> " f"{copyright_match.creation_year}" ) - elif not single_year and (with_multi_year_outdated or with_single_year_outdated): - _substitute_license_text(fp, line, copyright_regex, copyright_term) + elif not single_year and ( + with_multi_year_outdated or with_single_year_outdated + ): + _substitute_license_text( + fp, line, copyright_regex, copyright_term + ) print( f"{file}: Changed License Header Copyright Year " f"{copyright_match.modification_year} -> "