Simplify return type for fix_script

We always pass a file path to this function, so assert as much. We want
the return type to be consistent so we can assign the result to
non-Optional types.
This commit is contained in:
Chris Hunt 2020-07-05 12:27:54 -04:00
parent bf45bd77be
commit 50f6f8d69b
1 changed files with 2 additions and 3 deletions

View File

@ -105,13 +105,12 @@ def csv_io_kwargs(mode):
def fix_script(path):
# type: (text_type) -> Optional[bool]
# type: (text_type) -> bool
"""Replace #!python with #!/path/to/python
Return True if file was changed.
"""
# XXX RECORD hashes will need to be updated
if not os.path.isfile(path):
return None
assert os.path.isfile(path)
with open(path, 'rb') as script:
firstline = script.readline()