Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pyupgrade #1039

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 textwrap
Expand Down
7 changes: 3 additions & 4 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 @@ -112,9 +112,8 @@ def create_test_packages_list(
print(f"CMD: {' '.join(cmd_list)}")
pip_download_process = subprocess.run(
cmd_list,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
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
Loading