From 63ed4f3f30d02df4a0e70a5da0b31aa492411d21 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 23 Apr 2024 11:27:44 +0300 Subject: [PATCH] correction from "ruff" tool Signed-off-by: Alexander Piskun --- pillow_heif/misc.py | 3 +-- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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