def update_copyright(path, year):
with open(path, "<STR_LIT:r>") as fobj:<EOL><INDENT>text = fobj.read().rstrip()<EOL><DEDENT>match = COPYRIGHT_REGEX.search(text)<EOL>x = match.start("<STR_LIT>")<EOL>y = match.end("<STR_LIT>")<EOL>if text[y-<NUM_LIT:1>] == "<STR_LIT:U+0020>":  <EOL><INDENT>y -= <NUM_LIT:1><EOL><DEDENT>yearstr = match.group("<STR_LIT>")<EOL>years = set(_parse_years(yearstr)) | {year}<EOL>with open(path, "<STR_LIT:w>") as fobj:<EOL><INDENT>print(text[:x] + _format_years(years) + text[y:], file=fobj)<EOL><DEDENT>
Update a file's copyright statement to include the given year