From 50f6f8d69b0a63bed9335cba43cfb73bd2fbd416 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sun, 5 Jul 2020 12:27:54 -0400 Subject: [PATCH] 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. --- src/pip/_internal/operations/install/wheel.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py index 49dc009b3..f36104041 100644 --- a/src/pip/_internal/operations/install/wheel.py +++ b/src/pip/_internal/operations/install/wheel.py @@ -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()