diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1191a7fe..2e41ae4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,12 @@ repos: - id: black - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.7.0 + rev: 1.8.0 hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.7 + rev: v0.4.1 hooks: - id: ruff diff --git a/pillow_heif/misc.py b/pillow_heif/misc.py index 33a674ad..9dee13a3 100644 --- a/pillow_heif/misc.py +++ b/pillow_heif/misc.py @@ -432,8 +432,7 @@ def save(self, fp) -> None: """Ask encoder to produce output based on previously added images.""" data = self.ctx_write.finalize() if isinstance(fp, (str, Path)): - with builtins.open(fp, "wb") as f: - f.write(data) + Path(fp).write_bytes(data) elif hasattr(fp, "write"): fp.write(data) else: diff --git a/pyproject.toml b/pyproject.toml index 80d4766e..f81bcb8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ lint.extend-ignore = ["D107", "D105", "D203", "D213", "D401", "E203", "I001", "R "docs/**/*.py" = ["D"] "examples/**/*.py" = ["D", "PERF"] "libheif/**/*.py" = ["D", "PERF", "S"] -"tests/**/*.py" = ["B009", "D", "E402", "PERF", "S", "UP"] +"tests/**/*.py" = ["B009", "D", "E402", "PERF", "S", "UP", "SIM115"] [tool.ruff.lint.mccabe] max-complexity = 16