Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#365)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed May 13, 2024
1 parent e88356f commit 5cc7ba2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ repos:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.8.0"
rev: "2.0.3"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.3"
rev: "v0.4.4"
hooks:
- id: ruff-format
- id: ruff
Expand Down
27 changes: 22 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ version.source = "vcs"
[tool.ruff]
line-length = 120
target-version = "py38"
lint.isort = { known-first-party = ["pipdeptree"], required-imports = ["from __future__ import annotations"] }
lint.select = ["ALL"]
lint.isort = { known-first-party = [
"pipdeptree",
], required-imports = [
"from __future__ import annotations",
] }
lint.select = [
"ALL",
]
lint.ignore = [
"S101", # asserts allowed
"INP001", # no implicit namespace
Expand Down Expand Up @@ -109,13 +115,24 @@ ignore-words-list = "master"
[tool.coverage]
html.show_contexts = true
html.skip_covered = false
paths.source = ["src", ".tox/*/lib/python*/site-packages", "*/src"]
paths.source = [
"src",
".tox/*/lib/python*/site-packages",
"*/src",
]
run.parallel = true
run.plugins = ["covdefaults"]
run.plugins = [
"covdefaults",
]
report.fail_under = 88
subtract_omit = "*/__main__.py"

[tool.mypy]
show_error_codes = true
strict = true
overrides = [{ module = ["graphviz.*", "virtualenv.*"], ignore_missing_imports = true }]
overrides = [
{ module = [
"graphviz.*",
"virtualenv.*",
], ignore_missing_imports = true },
]
3 changes: 2 additions & 1 deletion src/pipdeptree/_adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import locale
from json import JSONDecodeError
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -70,6 +71,6 @@ def editable_project_location(self) -> str | None:
result = None
egg_link_path = egg_link_path_from_sys_path(self.raw_name)
if egg_link_path:
with Path(egg_link_path).open("r") as f:
with Path(egg_link_path).open("r", encoding=locale.getpreferredencoding(False)) as f:
result = f.readline().rstrip()
return result
3 changes: 2 additions & 1 deletion tests/_models/test_package.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import locale
import sys
from importlib.metadata import PackageNotFoundError
from pathlib import Path
Expand Down Expand Up @@ -29,7 +30,7 @@ def test_guess_version_setuptools(mocker: MockerFixture) -> None:

def test_package_as_frozen_repr(tmp_path: Path, mocker: MockerFixture) -> None:
file_path = tmp_path / "foo.egg-link"
with Path(file_path).open("w") as f:
with Path(file_path).open("w", encoding=locale.getpreferredencoding(False)) as f:
f.write("/A/B/foo")
mock_path = sys.path.copy()
mock_path.append(str(tmp_path))
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import locale
from pathlib import Path
from random import shuffle
from typing import TYPE_CHECKING, Callable, Iterator
Expand Down Expand Up @@ -75,7 +76,7 @@ def fake_dist(tmp_path: Path) -> Path:
fake_dist_path = fake_site_pkgs / "bar-2.4.5.dist-info"
fake_dist_path.mkdir(parents=True)
fake_metadata = Path(fake_dist_path) / "METADATA"
with Path(fake_metadata).open("w") as f:
with Path(fake_metadata).open("w", encoding=locale.getpreferredencoding(False)) as f:
f.write("Metadata-Version: 2.3\n" "Name: bar\n" "Version: 2.4.5\n")

return fake_dist_path

0 comments on commit 5cc7ba2

Please sign in to comment.