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.
@@ -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()
