Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#290)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/tox-dev/pyproject-fmt: 2.2.3 → 2.2.4](tox-dev/pyproject-fmt@2.2.3...2.2.4)
- [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.8](astral-sh/ruff-pre-commit@v0.6.5...v0.6.8)

* fixed SIM910(ruff) and C0103(pylint)

Signed-off-by: Alexander Piskun <[email protected]>

---------

Signed-off-by: Alexander Piskun <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alexander Piskun <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and bigcat88 authored Oct 5, 2024
1 parent 6b3e049 commit 115e9a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ repos:
- id: black

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.3
rev: 2.2.4
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
rev: v0.6.8
hooks:
- id: ruff

Expand Down
2 changes: 1 addition & 1 deletion pillow_heif/heif.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def _encode_images(images: List[HeifImage], fp, **kwargs) -> None:
images_to_save = images_to_save[:1]
if not images_to_save:
raise ValueError("Cannot write file with no images as HEIF.")
primary_index = _get_primary_index(images_to_save, kwargs.get("primary_index", None))
primary_index = _get_primary_index(images_to_save, kwargs.get("primary_index"))
ctx_write = CtxEncode(compression_format, **kwargs)
for i, img in enumerate(images_to_save):
img.load()
Expand Down
10 changes: 5 additions & 5 deletions pillow_heif/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def __init__(self, compression_format: HeifCompressionFormat, **kwargs):
if "subsampling" in kwargs:
chroma = SUBSAMPLING_CHROMA_MAP.get(kwargs["subsampling"], None)
if chroma is None:
chroma = kwargs.get("chroma", None)
chroma = kwargs.get("chroma")
if chroma:
enc_params["chroma"] = chroma
for key, value in enc_params.items():
Expand Down Expand Up @@ -414,11 +414,11 @@ def add_image_ycbcr(self, img: Image.Image, **kwargs) -> None:

def _finish_add_image(self, im_out, size: tuple, **kwargs):
# set ICC color profile
__icc_profile = kwargs.get("icc_profile", None)
__icc_profile = kwargs.get("icc_profile")
if __icc_profile is not None:
im_out.set_icc_profile(kwargs.get("icc_profile_type", "prof"), __icc_profile)
# set NCLX color profile
if kwargs.get("nclx_profile", None):
if kwargs.get("nclx_profile"):
im_out.set_nclx_profile(
*[
kwargs["nclx_profile"][i]
Expand All @@ -438,12 +438,12 @@ def _finish_add_image(self, im_out, size: tuple, **kwargs):
image_orientation,
)
# adding metadata
exif = kwargs.get("exif", None)
exif = kwargs.get("exif")
if exif is not None:
if isinstance(exif, Image.Exif):
exif = exif.tobytes()
im_out.set_exif(self.ctx_write, exif)
xmp = kwargs.get("xmp", None)
xmp = kwargs.get("xmp")
if xmp is not None:
im_out.set_xmp(self.ctx_write, xmp)
for metadata in kwargs.get("metadata", []):
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def _get_macos_sdk_path():
zip_safe=not PLATFORM_MINGW,
)
except RequiredDependencyException as err:
msg = f"""
MSG = f"""
The headers or library files could not be found for {err},
a required dependency when compiling Pillow-Heif from source.
Expand All @@ -284,5 +284,5 @@ def _get_macos_sdk_path():
https://pillow-heif.readthedocs.io/en/latest/installation.html
"""
sys.stderr.write(msg)
raise RequiredDependencyException(msg) from None
sys.stderr.write(MSG)
raise RequiredDependencyException(MSG) from None

0 comments on commit 115e9a3

Please sign in to comment.