Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/py_discovery/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}")


Expand Down