Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 4, 2024
2 parents 8156798 + fe09f0d commit d8f52f5
Show file tree
Hide file tree
Showing 116 changed files with 1,881 additions and 1,816 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next release notes as pull requests are merged into "main"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/test-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
- name: Install Cygwin
uses: egor-tensin/setup-cygwin@v4
with:
platform: x86_64
packages: >
gcc-g++
ghostscript
Expand Down Expand Up @@ -81,7 +80,7 @@ jobs:
zlib-devel
- name: Add Lapack to PATH
uses: egor-tensin/cleanup-path@v3
uses: egor-tensin/cleanup-path@v4
with:
dirs: 'C:\cygwin\bin;C:\cygwin\lib\lapack'

Expand Down Expand Up @@ -142,7 +141,7 @@ jobs:
bash.exe .ci/after_success.sh
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
file: ./coverage.xml
flags: GHA_Cygwin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
MATRIX_DOCKER: ${{ matrix.docker }}

- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
flags: GHA_Docker
name: ${{ matrix.docker }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
file: ./coverage.xml
flags: GHA_Windows
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
shell: pwsh

- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
file: ./coverage.xml
flags: GHA_Windows
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
.ci/after_success.sh
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
flags: ${{ matrix.os == 'ubuntu-latest' && 'GHA_Ubuntu' || 'GHA_macOS' }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ function build {

build_simple xcb-proto 1.16.0 https://xorg.freedesktop.org/archive/individual/proto
if [ -n "$IS_MACOS" ]; then
if [[ "$CIBW_ARCHS" == "arm64" ]]; then
build_simple xorgproto 2023.2 https://www.x.org/pub/individual/proto
build_simple libXau 1.0.11 https://www.x.org/pub/individual/lib
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig/xcb-proto.pc
fi
build_simple xorgproto 2023.2 https://www.x.org/pub/individual/proto
build_simple libXau 1.0.11 https://www.x.org/pub/individual/lib
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig/xcb-proto.pc
fi
else
sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
Expand Down Expand Up @@ -131,13 +129,13 @@ untar pillow-depends-main.zip

if [[ -n "$IS_MACOS" ]]; then
# webp, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
# libxdmcp causes an issue on macOS < 11
# libxau and libxdmcp cause an issue on macOS < 11
# if php is installed, brew tries to reinstall these after installing openblas
# remove cairo to fix building harfbuzz on arm64
# remove lcms2 and libpng to fix building openjpeg on arm64
# remove zstd to avoid inclusion on x86_64
# curl from brew requires zstd, use system curl
brew remove --ignore-dependencies webp libpng libtiff libxcb libxdmcp curl php cairo lcms2 ghostscript zstd
brew remove --ignore-dependencies webp libpng libtiff libxcb libxau libxdmcp curl php cairo lcms2 ghostscript zstd

brew install pkg-config
fi
Expand Down
8 changes: 4 additions & 4 deletions Tests/bench_cffi_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
# Not running this test by default. No DOS against CI.


def iterate_get(size, access):
def iterate_get(size, access) -> None:
(w, h) = size
for x in range(w):
for y in range(h):
access[(x, y)]


def iterate_set(size, access):
def iterate_set(size, access) -> None:
(w, h) = size
for x in range(w):
for y in range(h):
access[(x, y)] = (x % 256, y % 256, 0)


def timer(func, label, *args):
def timer(func, label, *args) -> None:
iterations = 5000
starttime = time.time()
for x in range(iterations):
Expand All @@ -38,7 +38,7 @@ def timer(func, label, *args):
)


def test_direct():
def test_direct() -> None:
im = hopper()
im.load()
# im = Image.new("RGB", (2000, 2000), (1, 3, 2))
Expand Down
6 changes: 3 additions & 3 deletions Tests/test_bmp_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
base = os.path.join("Tests", "images", "bmp")


def get_files(d, ext=".bmp"):
def get_files(d, ext: str = ".bmp"):
return [
os.path.join(base, d, f) for f in os.listdir(os.path.join(base, d)) if ext in f
]


def test_bad():
def test_bad() -> None:
"""These shouldn't crash/dos, but they shouldn't return anything
either"""
for f in get_files("b"):
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_questionable():
raise


def test_good():
def test_good() -> None:
"""These should all work. There's a set of target files in the
html directory that we can compare against."""

Expand Down
34 changes: 17 additions & 17 deletions Tests/test_box_blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
# fmt: on


def test_imageops_box_blur():
def test_imageops_box_blur() -> None:
i = sample.filter(ImageFilter.BoxBlur(1))
assert i.mode == sample.mode
assert i.size == sample.size
assert isinstance(i, Image.Image)


def box_blur(image, radius=1, n=1):
def box_blur(image, radius: int = 1, n: int = 1):
return image._new(image.im.box_blur((radius, radius), n))


def assert_image(im, data, delta=0):
def assert_image(im, data, delta: int = 0) -> None:
it = iter(im.getdata())
for data_row in data:
im_row = [next(it) for _ in range(im.size[0])]
Expand All @@ -37,15 +37,15 @@ def assert_image(im, data, delta=0):
next(it)


def assert_blur(im, radius, data, passes=1, delta=0):
def assert_blur(im, radius, data, passes: int = 1, delta: int = 0) -> None:
# check grayscale image
assert_image(box_blur(im, radius, passes), data, delta)
rgba = Image.merge("RGBA", (im, im, im, im))
for band in box_blur(rgba, radius, passes).split():
assert_image(band, data, delta)


def test_color_modes():
def test_color_modes() -> None:
with pytest.raises(ValueError):
box_blur(sample.convert("1"))
with pytest.raises(ValueError):
Expand All @@ -65,7 +65,7 @@ def test_color_modes():
box_blur(sample.convert("YCbCr"))


def test_radius_0():
def test_radius_0() -> None:
assert_blur(
sample,
0,
Expand All @@ -81,7 +81,7 @@ def test_radius_0():
)


def test_radius_0_02():
def test_radius_0_02() -> None:
assert_blur(
sample,
0.02,
Expand All @@ -98,7 +98,7 @@ def test_radius_0_02():
)


def test_radius_0_05():
def test_radius_0_05() -> None:
assert_blur(
sample,
0.05,
Expand All @@ -115,7 +115,7 @@ def test_radius_0_05():
)


def test_radius_0_1():
def test_radius_0_1() -> None:
assert_blur(
sample,
0.1,
Expand All @@ -132,7 +132,7 @@ def test_radius_0_1():
)


def test_radius_0_5():
def test_radius_0_5() -> None:
assert_blur(
sample,
0.5,
Expand All @@ -149,7 +149,7 @@ def test_radius_0_5():
)


def test_radius_1():
def test_radius_1() -> None:
assert_blur(
sample,
1,
Expand All @@ -166,7 +166,7 @@ def test_radius_1():
)


def test_radius_1_5():
def test_radius_1_5() -> None:
assert_blur(
sample,
1.5,
Expand All @@ -183,7 +183,7 @@ def test_radius_1_5():
)


def test_radius_bigger_then_half():
def test_radius_bigger_then_half() -> None:
assert_blur(
sample,
3,
Expand All @@ -200,7 +200,7 @@ def test_radius_bigger_then_half():
)


def test_radius_bigger_then_width():
def test_radius_bigger_then_width() -> None:
assert_blur(
sample,
10,
Expand All @@ -215,7 +215,7 @@ def test_radius_bigger_then_width():
)


def test_extreme_large_radius():
def test_extreme_large_radius() -> None:
assert_blur(
sample,
600,
Expand All @@ -230,7 +230,7 @@ def test_extreme_large_radius():
)


def test_two_passes():
def test_two_passes() -> None:
assert_blur(
sample,
1,
Expand All @@ -248,7 +248,7 @@ def test_two_passes():
)


def test_three_passes():
def test_three_passes() -> None:
assert_blur(
sample,
1,
Expand Down
Loading

0 comments on commit d8f52f5

Please sign in to comment.