mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-15 10:42:19 +03:00
Adjust fmt pragmas for ruff-format
This commit is contained in:
parent
2b62babd44
commit
deacff84f8
|
@ -76,9 +76,8 @@ post-patch:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
standard_l_qtable = (
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
standard_l_qtable = (
|
||||||
16, 11, 10, 16, 24, 40, 51, 61,
|
16, 11, 10, 16, 24, 40, 51, 61,
|
||||||
12, 12, 14, 19, 26, 58, 60, 55,
|
12, 12, 14, 19, 26, 58, 60, 55,
|
||||||
14, 13, 16, 24, 40, 57, 69, 56,
|
14, 13, 16, 24, 40, 57, 69, 56,
|
||||||
|
@ -87,11 +86,9 @@ standard_l_qtable = (
|
||||||
24, 35, 55, 64, 81, 104, 113, 92,
|
24, 35, 55, 64, 81, 104, 113, 92,
|
||||||
49, 64, 78, 87, 103, 121, 120, 101,
|
49, 64, 78, 87, 103, 121, 120, 101,
|
||||||
72, 92, 95, 98, 112, 100, 103, 99,
|
72, 92, 95, 98, 112, 100, 103, 99,
|
||||||
# fmt: on
|
|
||||||
)
|
)
|
||||||
|
|
||||||
standard_chrominance_qtable = (
|
standard_chrominance_qtable = (
|
||||||
# fmt: off
|
|
||||||
17, 18, 24, 47, 99, 99, 99, 99,
|
17, 18, 24, 47, 99, 99, 99, 99,
|
||||||
18, 21, 26, 66, 99, 99, 99, 99,
|
18, 21, 26, 66, 99, 99, 99, 99,
|
||||||
24, 26, 56, 99, 99, 99, 99, 99,
|
24, 26, 56, 99, 99, 99, 99, 99,
|
||||||
|
@ -100,8 +97,8 @@ standard_chrominance_qtable = (
|
||||||
99, 99, 99, 99, 99, 99, 99, 99,
|
99, 99, 99, 99, 99, 99, 99, 99,
|
||||||
99, 99, 99, 99, 99, 99, 99, 99,
|
99, 99, 99, 99, 99, 99, 99, 99,
|
||||||
99, 99, 99, 99, 99, 99, 99, 99,
|
99, 99, 99, 99, 99, 99, 99, 99,
|
||||||
# fmt: on
|
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
@ -72,138 +72,138 @@ def test_color_modes() -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_radius_0() -> None:
|
def test_radius_0() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
0,
|
0,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[210, 50, 20, 10, 220, 230, 80],
|
[210, 50, 20, 10, 220, 230, 80],
|
||||||
[190, 210, 20, 180, 170, 40, 110],
|
[190, 210, 20, 180, 170, 40, 110],
|
||||||
[120, 210, 250, 60, 220, 0, 220],
|
[120, 210, 250, 60, 220, 0, 220],
|
||||||
[220, 40, 230, 80, 130, 250, 40],
|
[220, 40, 230, 80, 130, 250, 40],
|
||||||
[250, 0, 80, 30, 60, 20, 110],
|
[250, 0, 80, 30, 60, 20, 110],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_0_02() -> None:
|
def test_radius_0_02() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
0.02,
|
0.02,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[206, 55, 20, 17, 215, 223, 83],
|
[206, 55, 20, 17, 215, 223, 83],
|
||||||
[189, 203, 31, 171, 169, 46, 110],
|
[189, 203, 31, 171, 169, 46, 110],
|
||||||
[125, 206, 241, 69, 210, 13, 210],
|
[125, 206, 241, 69, 210, 13, 210],
|
||||||
[215, 49, 221, 82, 131, 235, 48],
|
[215, 49, 221, 82, 131, 235, 48],
|
||||||
[244, 7, 80, 32, 60, 27, 107],
|
[244, 7, 80, 32, 60, 27, 107],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=2,
|
delta=2,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_0_05() -> None:
|
def test_radius_0_05() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
0.05,
|
0.05,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[202, 62, 22, 27, 209, 215, 88],
|
[202, 62, 22, 27, 209, 215, 88],
|
||||||
[188, 194, 44, 161, 168, 56, 111],
|
[188, 194, 44, 161, 168, 56, 111],
|
||||||
[131, 201, 229, 81, 198, 31, 198],
|
[131, 201, 229, 81, 198, 31, 198],
|
||||||
[209, 62, 209, 86, 133, 216, 59],
|
[209, 62, 209, 86, 133, 216, 59],
|
||||||
[237, 17, 80, 36, 60, 35, 103],
|
[237, 17, 80, 36, 60, 35, 103],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=2,
|
delta=2,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_0_1() -> None:
|
def test_radius_0_1() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
0.1,
|
0.1,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[196, 72, 24, 40, 200, 203, 93],
|
[196, 72, 24, 40, 200, 203, 93],
|
||||||
[187, 183, 62, 148, 166, 68, 111],
|
[187, 183, 62, 148, 166, 68, 111],
|
||||||
[139, 193, 213, 96, 182, 54, 182],
|
[139, 193, 213, 96, 182, 54, 182],
|
||||||
[201, 78, 193, 91, 133, 191, 73],
|
[201, 78, 193, 91, 133, 191, 73],
|
||||||
[227, 31, 80, 42, 61, 47, 99],
|
[227, 31, 80, 42, 61, 47, 99],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_0_5() -> None:
|
def test_radius_0_5() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
0.5,
|
0.5,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[176, 101, 46, 83, 163, 165, 111],
|
[176, 101, 46, 83, 163, 165, 111],
|
||||||
[176, 149, 108, 122, 144, 120, 117],
|
[176, 149, 108, 122, 144, 120, 117],
|
||||||
[164, 171, 159, 141, 134, 119, 129],
|
[164, 171, 159, 141, 134, 119, 129],
|
||||||
[170, 136, 133, 114, 116, 124, 109],
|
[170, 136, 133, 114, 116, 124, 109],
|
||||||
[184, 95, 72, 70, 69, 81, 89],
|
[184, 95, 72, 70, 69, 81, 89],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_1() -> None:
|
def test_radius_1() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
1,
|
1,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[170, 109, 63, 97, 146, 153, 116],
|
[170, 109, 63, 97, 146, 153, 116],
|
||||||
[168, 142, 112, 128, 126, 143, 121],
|
[168, 142, 112, 128, 126, 143, 121],
|
||||||
[169, 166, 142, 149, 126, 131, 114],
|
[169, 166, 142, 149, 126, 131, 114],
|
||||||
[159, 156, 109, 127, 94, 117, 112],
|
[159, 156, 109, 127, 94, 117, 112],
|
||||||
[164, 128, 63, 87, 76, 89, 90],
|
[164, 128, 63, 87, 76, 89, 90],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_1_5() -> None:
|
def test_radius_1_5() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
1.5,
|
1.5,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[155, 120, 105, 112, 124, 137, 130],
|
[155, 120, 105, 112, 124, 137, 130],
|
||||||
[160, 136, 124, 125, 127, 134, 130],
|
[160, 136, 124, 125, 127, 134, 130],
|
||||||
[166, 147, 130, 125, 120, 121, 119],
|
[166, 147, 130, 125, 120, 121, 119],
|
||||||
[168, 145, 119, 109, 103, 105, 110],
|
[168, 145, 119, 109, 103, 105, 110],
|
||||||
[168, 134, 96, 85, 85, 89, 97],
|
[168, 134, 96, 85, 85, 89, 97],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_bigger_then_half() -> None:
|
def test_radius_bigger_then_half() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
3,
|
3,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[144, 145, 142, 128, 114, 115, 117],
|
[144, 145, 142, 128, 114, 115, 117],
|
||||||
[148, 145, 137, 122, 109, 111, 112],
|
[148, 145, 137, 122, 109, 111, 112],
|
||||||
[152, 145, 131, 117, 103, 107, 108],
|
[152, 145, 131, 117, 103, 107, 108],
|
||||||
[156, 144, 126, 111, 97, 102, 103],
|
[156, 144, 126, 111, 97, 102, 103],
|
||||||
[160, 144, 121, 106, 92, 98, 99],
|
[160, 144, 121, 106, 92, 98, 99],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_radius_bigger_then_width() -> None:
|
def test_radius_bigger_then_width() -> None:
|
||||||
|
@ -237,36 +237,36 @@ def test_extreme_large_radius() -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_two_passes() -> None:
|
def test_two_passes() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
1,
|
1,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[153, 123, 102, 109, 132, 135, 129],
|
[153, 123, 102, 109, 132, 135, 129],
|
||||||
[159, 138, 123, 121, 133, 131, 126],
|
[159, 138, 123, 121, 133, 131, 126],
|
||||||
[162, 147, 136, 124, 127, 121, 121],
|
[162, 147, 136, 124, 127, 121, 121],
|
||||||
[159, 140, 125, 108, 111, 106, 108],
|
[159, 140, 125, 108, 111, 106, 108],
|
||||||
[154, 126, 105, 87, 94, 93, 97],
|
[154, 126, 105, 87, 94, 93, 97],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
passes=2,
|
passes=2,
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
def test_three_passes() -> None:
|
def test_three_passes() -> None:
|
||||||
|
# fmt: off
|
||||||
assert_blur(
|
assert_blur(
|
||||||
sample,
|
sample,
|
||||||
1,
|
1,
|
||||||
[
|
[
|
||||||
# fmt: off
|
|
||||||
[146, 131, 116, 118, 126, 131, 130],
|
[146, 131, 116, 118, 126, 131, 130],
|
||||||
[151, 138, 125, 123, 126, 128, 127],
|
[151, 138, 125, 123, 126, 128, 127],
|
||||||
[154, 143, 129, 123, 120, 120, 119],
|
[154, 143, 129, 123, 120, 120, 119],
|
||||||
[152, 139, 122, 113, 108, 108, 108],
|
[152, 139, 122, 113, 108, 108, 108],
|
||||||
[148, 132, 112, 102, 97, 99, 100],
|
[148, 132, 112, 102, 97, 99, 100],
|
||||||
# fmt: on
|
|
||||||
],
|
],
|
||||||
passes=3,
|
passes=3,
|
||||||
delta=1,
|
delta=1,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
|
|
|
@ -149,15 +149,15 @@ def test_kernel_not_enough_coefficients() -> None:
|
||||||
def test_consistency_3x3(mode: str) -> None:
|
def test_consistency_3x3(mode: str) -> None:
|
||||||
with Image.open("Tests/images/hopper.bmp") as source:
|
with Image.open("Tests/images/hopper.bmp") as source:
|
||||||
with Image.open("Tests/images/hopper_emboss.bmp") as reference:
|
with Image.open("Tests/images/hopper_emboss.bmp") as reference:
|
||||||
|
# fmt: off
|
||||||
kernel = ImageFilter.Kernel(
|
kernel = ImageFilter.Kernel(
|
||||||
(3, 3),
|
(3, 3),
|
||||||
# fmt: off
|
|
||||||
(-1, -1, 0,
|
(-1, -1, 0,
|
||||||
-1, 0, 1,
|
-1, 0, 1,
|
||||||
0, 1, 1),
|
0, 1, 1),
|
||||||
# fmt: on
|
|
||||||
0.3,
|
0.3,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
assert_image_equal(source.filter(kernel), reference)
|
assert_image_equal(source.filter(kernel), reference)
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,17 +165,17 @@ def test_consistency_3x3(mode: str) -> None:
|
||||||
def test_consistency_5x5(mode: str) -> None:
|
def test_consistency_5x5(mode: str) -> None:
|
||||||
with Image.open("Tests/images/hopper.bmp") as source:
|
with Image.open("Tests/images/hopper.bmp") as source:
|
||||||
with Image.open("Tests/images/hopper_emboss_more.bmp") as reference:
|
with Image.open("Tests/images/hopper_emboss_more.bmp") as reference:
|
||||||
|
# fmt: off
|
||||||
kernel = ImageFilter.Kernel(
|
kernel = ImageFilter.Kernel(
|
||||||
(5, 5),
|
(5, 5),
|
||||||
# fmt: off
|
|
||||||
(-1, -1, -1, -1, 0,
|
(-1, -1, -1, -1, 0,
|
||||||
-1, -1, -1, 0, 1,
|
-1, -1, -1, 0, 1,
|
||||||
-1, -1, 0, 1, 1,
|
-1, -1, 0, 1, 1,
|
||||||
-1, 0, 1, 1, 1,
|
-1, 0, 1, 1, 1,
|
||||||
0, 1, 1, 1, 1),
|
0, 1, 1, 1, 1),
|
||||||
# fmt: on
|
|
||||||
0.3,
|
0.3,
|
||||||
)
|
)
|
||||||
|
# fmt: on
|
||||||
assert_image_equal(source.filter(kernel), reference)
|
assert_image_equal(source.filter(kernel), reference)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user