Fix warning in python script. (#4251)

This commit is contained in:
Steven Perron 2021-04-26 15:37:38 -04:00 committed by GitHub
parent 9f23457eef
commit 1b8341b8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,7 +130,7 @@ def insert_copyright(author, glob, comment_prefix):
update_file = False update_file = False
for line in fileinput.input(file, inplace=1): for line in fileinput.input(file, inplace=1):
emit = True emit = True
if state is 0: if state == 0:
if COPYRIGHT_RE.search(line): if COPYRIGHT_RE.search(line):
state = 1 state = 1
elif skip(line): elif skip(line):
@ -141,7 +141,7 @@ def insert_copyright(author, glob, comment_prefix):
sys.stdout.write(licensed) sys.stdout.write(licensed)
# Assume there isn't a previous license notice. # Assume there isn't a previous license notice.
state = 1 state = 1
elif state is 1: elif state == 1:
if MIT_BEGIN_RE.search(line): if MIT_BEGIN_RE.search(line):
state = 2 state = 2
emit = False emit = False
@ -149,7 +149,7 @@ def insert_copyright(author, glob, comment_prefix):
# Assume an Apache license is preceded by a copyright # Assume an Apache license is preceded by a copyright
# notice. So just emit it like the rest of the file. # notice. So just emit it like the rest of the file.
state = 9 state = 9
elif state is 2: elif state == 2:
# Replace the MIT license with Apache 2 # Replace the MIT license with Apache 2
emit = False emit = False
if MIT_END_RE.search(line): if MIT_END_RE.search(line):