mirror of https://github.com/pypa/pip
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:
parent
bf45bd77be
commit
50f6f8d69b
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue