From db1292847d93cab3cf210b32c652a389ae9e28e0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:09:17 +0300 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#233) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/tox-dev/pyproject-fmt: 1.7.0 → 1.8.0](https://github.com/tox-dev/pyproject-fmt/compare/1.7.0...1.8.0) - [github.com/astral-sh/ruff-pre-commit: v0.3.7 → v0.4.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.7...v0.4.1) * correction from "ruff" tool Signed-off-by: Alexander Piskun --------- Signed-off-by: Alexander Piskun Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alexander Piskun --- .pre-commit-config.yaml | 4 ++-- pillow_heif/misc.py | 3 +-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) 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