Skip to content

Commit

Permalink
Run pyupgrade (#1039)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Lam <[email protected]>
Co-authored-by: Tzu-ping Chung <[email protected]>
  • Loading branch information
3 people authored Sep 1, 2023
1 parent 248fa37 commit f5bff42
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
1 change: 0 additions & 1 deletion scripts/generate_docs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import subprocess
Expand Down
1 change: 0 additions & 1 deletion scripts/generate_man.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os.path
import sys
Expand Down
7 changes: 2 additions & 5 deletions scripts/list_test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def parse_package_list(package_list_file: Path) -> List[Dict[str, Any]]:
f"ERROR: Unable to parse primary package list line:\n {line.strip()}"
)
return []
except IOError:
except OSError:
print("ERROR: File problem reading primary package list.")
return []
return output_list
Expand Down Expand Up @@ -111,10 +111,7 @@ def create_test_packages_list(
if verbose:
print(f"CMD: {' '.join(cmd_list)}")
pip_download_process = subprocess.run(
cmd_list,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
cmd_list, capture_output=True, text=True
)
if pip_download_process.returncode == 0:
print(f"Examined {test_package['spec']}{test_package_option_string}")
Expand Down
7 changes: 3 additions & 4 deletions scripts/update_package_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def update_test_packages_cache(

try:
platform_package_list_fh = platform_package_list_path.open("r")
except IOError:
except OSError:
print(
f"ERROR. File {str(platform_package_list_path)}\n"
" is not readable. Cannot continue.\n",
Expand Down Expand Up @@ -160,9 +160,8 @@ def update_test_packages_cache(
"-d",
str(packages_dir_path),
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
capture_output=True,
text=True,
)
if pip_download_process.returncode == 0:
print(f"Successfully downloaded {package_spec}")
Expand Down
4 changes: 2 additions & 2 deletions src/pipx/pipx_metadata_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def write(self) -> None:
sort_keys=True,
cls=JsonEncoderHandlesPath,
)
except IOError:
except OSError:
logger.warning(
pipx_wrap(
f"""
Expand All @@ -152,7 +152,7 @@ def read(self, verbose: bool = False) -> None:
self.from_dict(
json.load(pipx_metadata_fh, object_hook=_json_decoder_object_hook)
)
except IOError: # Reset self if problem reading
except OSError: # Reset self if problem reading
if verbose:
logger.warning(
pipx_wrap(
Expand Down
10 changes: 4 additions & 6 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ def execvpe_mock(cmd_path, cmd_args, env):
return_code = subprocess.run(
[str(x) for x in cmd_args],
env=env,
stdout=None,
stderr=None,
capture_output=False,
encoding="utf-8",
universal_newlines=True,
text=True,
).returncode
sys.exit(return_code)

Expand Down Expand Up @@ -143,10 +142,9 @@ def test_run_ensure_null_pythonpath():
"-c",
"import os; print(os.environ.get('PYTHONPATH'))",
],
universal_newlines=True,
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
text=True,
).stdout
)

Expand Down

0 comments on commit f5bff42

Please sign in to comment.