diff --git a/pyproject.toml b/pyproject.toml index 23c2f57..c70c256 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ lint.preview = true format.preview = true format.docstring-code-format = true format.docstring-code-line-length = 100 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/**/*.py" = [ "S101", # asserts allowed in tests "FBT", # don't care about booleans as positional arguments in tests diff --git a/src/py_discovery/_info.py b/src/py_discovery/_info.py index 4c90a42..d80ba72 100644 --- a/src/py_discovery/_info.py +++ b/src/py_discovery/_info.py @@ -133,7 +133,7 @@ def abs_path(v: str | None) -> str | None: k: v for k, v in ([("makefile_filename", makefile())] if makefile is not None else []) if k is not None } - config_var_keys = set() + config_var_keys: set[str] = set() for element in self.sysconfig_paths.values(): config_var_keys.update(k[1:-1] for k in _CONF_VAR_RE.findall(element)) config_var_keys.add("PYTHONFRAMEWORK") @@ -607,7 +607,9 @@ def _gen_cookie() -> str: return "".join(choice(f"{ascii_lowercase}{ascii_uppercase}{digits}") for _ in range(_COOKIE_LENGTH)) # noqa: S311 -def _run_subprocess(cls: type[PythonInfo], exe: str, env: MutableMapping[str, str]) -> PythonInfo | RuntimeError: +def _run_subprocess( # noqa: PLR0914 + cls: type[PythonInfo], exe: str, env: MutableMapping[str, str] +) -> PythonInfo | RuntimeError: py_info_script = Path(os.path.abspath(__file__)).parent / "_info.py" # noqa: PTH100 # Cookies allow splitting the serialized stdout output generated by the script collecting the info from the output # generated by something else. @@ -665,7 +667,9 @@ def _run_subprocess(cls: type[PythonInfo], exe: str, env: MutableMapping[str, st result.executable = exe # keep the original executable as this may contain initialization code return result - msg = f"{exe} with code {code}{f' out: {out!r}' if out else ''}{f" err: {err!r}" if err else ''}" + err_str = f" err: {err!r}" if err else "" + out_str = f" out: {out!r}" if out else "" + msg = f"{exe} with code {code}{out_str}{err_str}" return RuntimeError(f"failed to query {msg}")