Skip to content

Commit 1f8dc44

Browse files
committed
rel 2024.0.1
1 parent 9bb5365 commit 1f8dc44

File tree

13 files changed

+251
-196
lines changed

13 files changed

+251
-196
lines changed

.pre-commit-config.yaml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
11
repos:
2-
- repo: https://github.com/FHPythonUtils/Blackt
3-
rev: '2022.0.3'
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.1.14
44
hooks:
5-
- id: blackt
5+
- id: ruff
6+
args: [ --fix ]
7+
8+
- repo: https://github.com/RobertCraigie/pyright-python
9+
rev: v1.1.347
10+
hooks:
11+
- id: pyright
612

7-
- repo: https://github.com/pycqa/isort
8-
rev: 5.12.0
13+
- repo: https://github.com/FHPythonUtils/Blackt
14+
rev: '2024.0.1'
915
hooks:
10-
- id: isort
16+
- id: blackt
1117

12-
- repo: https://github.com/pycqa/pylint
13-
rev: v3.0.0a6
18+
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
19+
rev: v1.3.2
1420
hooks:
15-
- id: pylint
16-
exclude: "tests/"
17-
args: [--disable=import-error,--jobs=0]
21+
- id: python-safety-dependencies-check
22+
files: pyproject.toml
1823

1924
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v4.4.0
25+
rev: v4.5.0
2126
hooks:
2227
- id: trailing-whitespace
23-
exclude: "tests/"
2428
- id: end-of-file-fixer
25-
exclude: "tests/"
29+
- id: check-case-conflict
30+
- id: check-executables-have-shebangs
31+
- id: check-json
32+
- id: check-merge-conflict
33+
- id: check-shebang-scripts-are-executable
34+
- id: check-symlinks
35+
- id: check-toml
36+
- id: check-vcs-permalinks
37+
- id: check-yaml
38+
- id: detect-private-key
39+
- id: mixed-line-ending
2640

27-
- repo: https://github.com/asottile/pyupgrade
28-
rev: v3.7.0
29-
hooks:
30-
- id: pyupgrade
31-
args: [--py38-plus]
3241
- repo: https://github.com/boidolr/pre-commit-images
33-
rev: v1.2.1
42+
rev: v1.5.1
3443
hooks:
35-
- id: optimize-avif
36-
exclude: "tests/"
3744
- id: optimize-jpg
38-
exclude: "tests/"
3945
- id: optimize-png
40-
exclude: "tests/"
4146
- id: optimize-svg
42-
exclude: "tests/"
4347
- id: optimize-webp
44-
exclude: "tests/"
48+
49+
exclude: "tests/data|documentation/reference"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
All major and minor version changes will be documented in this file. Details of
44
patch-level version changes can be found in [commit messages](../../commits/master).
55

6+
## 2024.0.1 - 2024/01/19
7+
8+
- update dependencies
9+
- ruff linting
10+
611
## 2024 - 2024/01/07
712

813
- update dependencies

blendmodes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
"""Use this module to apply a number of blending modes to a background and foreground image
1+
"""Use this module to apply a number of blending modes to a background and foreground image.
22
"""

blendmodes/blend.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ def destin(
281281
282282
Destination which overlaps the source, replaces the source.
283283
284-
Fa = 0; Fb = αs
285-
co = αb x Cb x αs
286-
αo = αb x αs
284+
Fa = 0; Fb = as
285+
co = ab x Cb x as
286+
ao = ab x as
287287
"""
288288
del foregroundColour # Not used by function
289289
outAlpha = backgroundAlpha * foregroundAlpha
@@ -361,9 +361,11 @@ def imageIntToFloat(image: np.ndarray) -> np.ndarray:
361361
"""Convert a numpy array representing an image to an array of floats.
362362
363363
Args:
364+
----
364365
image (np.ndarray): numpy array of ints
365366
366367
Returns:
368+
-------
367369
np.ndarray: numpy array of floats
368370
"""
369371
return image / 255
@@ -373,9 +375,11 @@ def imageFloatToInt(image: np.ndarray) -> np.ndarray:
373375
"""Convert a numpy array representing an image to an array of ints.
374376
375377
Args:
378+
----
376379
image (np.ndarray): numpy array of floats
377380
378381
Returns:
382+
-------
379383
np.ndarray: numpy array of ints
380384
"""
381385
clippedIm = np.clip((image * 255).round(), 0, 255)
@@ -388,11 +392,13 @@ def blend(background: np.ndarray, foreground: np.ndarray, blendType: BlendType)
388392
"""Blend pixels.
389393
390394
Args:
395+
----
391396
background (np.ndarray): background
392397
foreground (np.ndarray): foreground
393398
blendType (BlendType): the blend type
394399
395400
Returns:
401+
-------
396402
np.ndarray: new array representing the image
397403
398404
background: np.ndarray,
@@ -457,12 +463,14 @@ def blendLayers(
457463
"""Blend layers using numpy array.
458464
459465
Args:
466+
----
460467
background (Image.Image): background layer
461468
foreground (Image.Image): foreground layer (must be same size as background)
462469
blendType (BlendType): The blendtype
463470
opacity (float): The opacity of the foreground image
464471
465472
Returns:
473+
-------
466474
Image.Image: combined image
467475
"""
468476
# Convert the Image.Image to a numpy array

blendmodes/imagetools.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,24 @@
22
"""
33
from __future__ import annotations
44

5-
import warnings
6-
7-
from deprecation import deprecated
85
from PIL import Image
96

107

11-
@deprecated(deprecated_in="2021.1", removed_in="", details="use renderWAlphaOffset")
12-
def rasterImageOA( # pylint:disable=missing-function-docstring
13-
image: Image.Image, size: tuple[int, int], alpha: float = 1.0, offsets: tuple[int, int] = (0, 0)
14-
) -> Image.Image:
15-
warnings.warn(
16-
"Call to deprecated function rasterImageOA.", category=DeprecationWarning, stacklevel=2
17-
)
18-
return renderWAlphaOffset(image, size, alpha, offsets)
19-
20-
21-
@deprecated(deprecated_in="2021.1", removed_in="", details="use renderWAlphaOffset")
22-
def rasterImageOffset( # pylint:disable=missing-function-docstring
23-
image: Image.Image, size: tuple[int, int], offsets: tuple[int, int] = (0, 0)
24-
) -> Image.Image:
25-
warnings.warn(
26-
"Call to deprecated function rasterImageOffset.", category=DeprecationWarning, stacklevel=2
27-
)
28-
return renderWAlphaOffset(image, size, 1, offsets)
29-
30-
318
def renderWAlphaOffset(
329
image: Image.Image, size: tuple[int, int], alpha: float = 1.0, offsets: tuple[int, int] = (0, 0)
3310
) -> Image.Image:
3411
"""Render an image with offset and alpha to a given size.
3512
3613
Args:
14+
----
3715
image (Image.Image): pil image to draw
3816
size (tuple[int, int]): width, height as a tuple
3917
alpha (float, optional): alpha transparency. Defaults to 1.0.
4018
offsets (tuple[int, int], optional): x, y offsets as a tuple.
4119
Defaults to (0, 0).
4220
4321
Returns:
22+
-------
4423
Image.Image: new image
4524
"""
4625
imageOffset = Image.new("RGBA", size)

0 commit comments

Comments
 (0)