diff --git a/.github/transform_to-pi_heif.py b/.github/transform_to-pi_heif.py index e2dfc44f..fa60594d 100644 --- a/.github/transform_to-pi_heif.py +++ b/.github/transform_to-pi_heif.py @@ -26,8 +26,7 @@ data = pathlib.Path(file_name).read_text(encoding="utf-8") modified_data = data.replace("pillow_heif", "pi_heif") if modified_data != data: - with open(file_name + DEV_NAME_ADD, "w") as file: - file.write(modified_data) + pathlib.Path(file_name + DEV_NAME_ADD).write_text(modified_data) os.rename("pillow_heif/_pillow_heif.c", "pillow_heif/_pi_heif.c") os.rename("pillow_heif", "pi_heif") diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d119bec0..1191a7fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.0 hooks: - id: black @@ -29,17 +29,10 @@ repos: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.5 + rev: v0.3.7 hooks: - id: ruff -- repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 - hooks: - - id: mypy - files: pillow_heif/ - additional_dependencies: [pillow, pytest] - - repo: https://github.com/mgedmin/check-manifest rev: "0.49" hooks: diff --git a/pillow_heif/misc.py b/pillow_heif/misc.py index a92462d3..33a674ad 100644 --- a/pillow_heif/misc.py +++ b/pillow_heif/misc.py @@ -173,7 +173,7 @@ def _get_orientation(info: dict, reset: bool = False) -> Optional[int]: except Exception: # noqa # pylint: disable=broad-except pass xmp_orientation = _get_orientation_xmp(info, original_orientation, reset=reset) - return xmp_orientation if xmp_orientation else original_orientation + return xmp_orientation or original_orientation def get_file_mimetype(fp) -> str: diff --git a/pyproject.toml b/pyproject.toml index 14d21562..80d4766e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,21 +49,21 @@ preview = true line-length = 120 preview = true target-version = "py38" -select = ["A", "B", "C", "D", "E", "F", "FURB", "G", "I", "S", "SIM", "PERF", "PIE", "Q", "RET", "RUF", "UP" , "W"] -extend-ignore = ["D107", "D105", "D203", "D213", "D401", "E203", "I001", "RUF100"] +lint.select = ["A", "B", "C", "D", "E", "F", "FURB", "G", "I", "S", "SIM", "PERF", "PIE", "Q", "RET", "RUF", "UP" , "W"] +lint.extend-ignore = ["D107", "D105", "D203", "D213", "D401", "E203", "I001", "RUF100"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "pillow_heif/__init__.py" = ["F401"] "setup.py" = ["S"] -[tool.ruff.extend-per-file-ignores] +[tool.ruff.lint.extend-per-file-ignores] "benchmarks/**/*.py" = ["D", "S404", "S603"] "docs/**/*.py" = ["D"] "examples/**/*.py" = ["D", "PERF"] "libheif/**/*.py" = ["D", "PERF", "S"] "tests/**/*.py" = ["B009", "D", "E402", "PERF", "S", "UP"] -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 16 [tool.isort]