Skip to content

Commit

Permalink
Apply ruff/flake8-implicit-str-concat rule ISC001
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos authored and dukecat0 committed May 14, 2024
1 parent 3c9eb2e commit c6148d0
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 22 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ lint.extend-select = [
"C4",
"C9",
"I",
"ISC",
"PLC",
"PLE",
"PLW",
Expand Down
2 changes: 1 addition & 1 deletion scripts/list_test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def process_command_line(argv: List[str]) -> argparse.Namespace:
# required arguments
parser.add_argument(
"primary_package_list",
help="Main packages to examine, getting list of " "matching distribution files and dependencies.",
help="Main packages to examine, getting list of matching distribution files and dependencies.",
)
parser.add_argument("package_list_dir", help="Directory to output package distribution lists.")

Expand Down
6 changes: 2 additions & 4 deletions scripts/migrate_pipsi_to_pipx.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():
ret = subprocess.run(["pipsi", "uninstall", "--yes", package], check=False)
if ret.returncode:
error = True
print(f"Failed to uninstall {package!r} with pipsi. " "Not attempting to install with pipx.")
print(f"Failed to uninstall {package!r} with pipsi. Not attempting to install with pipx.")
else:
print(f"uninstalled {package!r} with pipsi. Now attempting to install with pipx.")
ret = subprocess.run(["pipx", "install", package], check=False)
Expand All @@ -52,9 +52,7 @@ def main():
print(f"Successfully installed {package} with pipx")

print(f"Done migrating {len(packages)} packages!")
print(
"You may still need to run `pipsi uninstall pipsi` or `pip uninstall pipsi`. " "Refer to pipsi's documentation."
)
print("You may still need to run `pipsi uninstall pipsi` or `pip uninstall pipsi`. Refer to pipsi's documentation.")

if error:
print("Note: Finished with errors. Review output to manually complete migration.")
Expand Down
8 changes: 4 additions & 4 deletions scripts/update_package_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def process_command_line(argv: List[str]) -> argparse.Namespace:
"-c",
"--check-only",
action="store_true",
help="Only check to see if needed packages are in PACKAGES_DIR, do not " "download or delete files.",
help="Only check to see if needed packages are in PACKAGES_DIR, do not download or delete files.",
)

return parser.parse_args(argv)
Expand All @@ -63,7 +63,7 @@ def update_test_packages_cache(package_list_dir_path: Path, pipx_package_cache_p

if not platform_package_list_path.exists():
print(
f"WARNING. File {platform_package_list_path!s}\n" " does not exist. Creating now...",
f"WARNING. File {platform_package_list_path!s}\n does not exist. Creating now...",
file=sys.stderr,
)
create_list_returncode = create_test_packages_list(
Expand All @@ -80,7 +80,7 @@ def update_test_packages_cache(package_list_dir_path: Path, pipx_package_cache_p
)
else:
print(
f"ERROR. Unable to create {platform_package_list_path!s}\n" " Cannot continue.\n",
f"ERROR. Unable to create {platform_package_list_path!s}\n Cannot continue.\n",
file=sys.stderr,
)
return 1
Expand All @@ -89,7 +89,7 @@ def update_test_packages_cache(package_list_dir_path: Path, pipx_package_cache_p
platform_package_list_fh = platform_package_list_path.open("r")
except OSError:
print(
f"ERROR. File {platform_package_list_path!s}\n" " is not readable. Cannot continue.\n",
f"ERROR. File {platform_package_list_path!s}\n is not readable. Cannot continue.\n",
file=sys.stderr,
)
return 1
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sys

if sys.version_info < (3, 8, 0):
sys.exit("Python 3.8 or later is required. " "See https://github.com/pypa/pipx " "for installation instructions.")
sys.exit("Python 3.8 or later is required. See https://github.com/pypa/pipx for installation instructions.")
10 changes: 5 additions & 5 deletions src/pipx/commands/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _symlink_package_resource(
)
return
if is_symlink and not exists:
logger.info(f"Removing existing symlink {symlink_path!s} since it " "pointed non-existent location")
logger.info(f"Removing existing symlink {symlink_path!s} since it pointed non-existent location")
symlink_path.unlink()

if executable:
Expand Down Expand Up @@ -186,22 +186,22 @@ def venv_health_check(venv: Venv, package_name: Optional[str] = None) -> Tuple[V
if not python_path.is_file():
return (
VenvProblems(invalid_interpreter=True),
f" package {red(bold(venv_dir.name))} has invalid " f"interpreter {python_path!s}\r{hazard}",
f" package {red(bold(venv_dir.name))} has invalid interpreter {python_path!s}\r{hazard}",
)
if not venv.package_metadata:
return (
VenvProblems(missing_metadata=True),
f" package {red(bold(venv_dir.name))} has missing " f"internal pipx metadata.\r{hazard}",
f" package {red(bold(venv_dir.name))} has missing internal pipx metadata.\r{hazard}",
)
if venv_dir.name != canonicalize_name(venv_dir.name):
return (
VenvProblems(bad_venv_name=True),
f" package {red(bold(venv_dir.name))} needs its " f"internal data updated.\r{hazard}",
f" package {red(bold(venv_dir.name))} needs its internal data updated.\r{hazard}",
)
if venv.package_metadata[package_name].package_version == "":
return (
VenvProblems(not_installed=True),
f" package {red(bold(package_name))} {red('is not installed')} " f"in the venv {venv_dir.name}\r{hazard}",
f" package {red(bold(package_name))} {red('is not installed')} in the venv {venv_dir.name}\r{hazard}",
)
return (VenvProblems(), "")

Expand Down
2 changes: 1 addition & 1 deletion src/pipx/commands/list_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def list_packages(
)
if all_venv_problems.invalid_interpreter:
logger.warning(
"\nOne or more packages have a missing python interpreter.\n" " To fix, execute: pipx reinstall-all"
"\nOne or more packages have a missing python interpreter.\n To fix, execute: pipx reinstall-all"
)
if all_venv_problems.missing_metadata:
logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def _add_runpip(subparsers, venv_completer: VenvCompleter, shared_parser: argpar
def _add_ensurepath(subparsers: argparse._SubParsersAction, shared_parser: argparse.ArgumentParser) -> None:
p = subparsers.add_parser(
"ensurepath",
help=("Ensure directories necessary for pipx operation are in your " "PATH environment variable."),
help=("Ensure directories necessary for pipx operation are in your PATH environment variable."),
description=(
"Ensure directory where pipx stores apps is in your "
"PATH environment variable. Also if pipx was installed via "
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/standalone_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _unpack(full_version, download_link, archive: Path, download_dir: Path):
expected_checksum = urlopen(checksum_link).read().decode().rstrip("\n")
if checksum != expected_checksum:
raise PipxError(
f"Checksum mismatch for python {full_version} build. " f"Expected {expected_checksum}, got {checksum}."
f"Checksum mismatch for python {full_version} build. Expected {expected_checksum}, got {checksum}."
)

with tarfile.open(archive, mode="r:gz") as tar:
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def subprocess_post_check_handle_pip_error(
if completed_process.stderr is not None:
print(completed_process.stderr, file=pip_error_fh, end="")

logger.error("Fatal error from pip prevented installation. Full pip output in file:\n" f" {pip_error_file}")
logger.error(f"Fatal error from pip prevented installation. Full pip output in file:\n {pip_error_file}")

analyze_pip_output(completed_process.stdout, completed_process.stderr)

Expand Down
4 changes: 2 additions & 2 deletions src/pipx/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def check_upgrade_shared_libs(self, verbose: bool, pip_args: List[str], force_up
@property
def name(self) -> str:
if self.pipx_metadata.main_package.package is not None:
venv_name = f"{self.pipx_metadata.main_package.package}" f"{self.pipx_metadata.main_package.suffix}"
venv_name = f"{self.pipx_metadata.main_package.package}{self.pipx_metadata.main_package.suffix}"
else:
venv_name = self.root.name
return venv_name
Expand Down Expand Up @@ -416,7 +416,7 @@ def run_app(self, app: str, filename: str, app_args: List[str]) -> NoReturn:
match = _entry_point_value_pattern.match(entry_point.value)
assert match is not None, "invalid entry point"
module, attr = match.group("module", "attr")
code = f"import sys, {module}\n" f"sys.argv[0] = {entry_point.name!r}\n" f"sys.exit({module}.{attr}())\n"
code = f"import sys, {module}\nsys.argv[0] = {entry_point.name!r}\nsys.exit({module}.{attr}())\n"
exec_app([str(self.python_path), "-c", code] + app_args)

def has_app(self, app: str, filename: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install_all_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def print_error_report(
print("\n\n", file=errors_fh)
print("=" * 79, file=errors_fh)
print(
f"{package_spec:24}{test_type:16}{module_globals.sys_platform:16}" f"{module_globals.py_version_display}",
f"{package_spec:24}{test_type:16}{module_globals.sys_platform:16}{module_globals.py_version_display}",
file=errors_fh,
)
print("\nSTDOUT:", file=errors_fh)
Expand Down

0 comments on commit c6148d0

Please sign in to comment.