mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
commit
9df95e77c5
|
@ -9,7 +9,7 @@ repos:
|
||||||
types: []
|
types: []
|
||||||
|
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.7.9
|
rev: 3.8.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
|
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
|
||||||
|
|
|
@ -68,8 +68,8 @@ def test_textsize(request, tmp_path):
|
||||||
(dx, dy) = font.getsize(chr(i))
|
(dx, dy) = font.getsize(chr(i))
|
||||||
assert dy == 20
|
assert dy == 20
|
||||||
assert dx in (0, 10)
|
assert dx in (0, 10)
|
||||||
for l in range(len(message)):
|
for i in range(len(message)):
|
||||||
msg = message[: l + 1]
|
msg = message[: i + 1]
|
||||||
assert font.getsize(msg) == (len(msg) * 10, 20)
|
assert font.getsize(msg) == (len(msg) * 10, 20)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,8 @@ def _test_textsize(request, tmp_path, encoding):
|
||||||
assert dy == 20
|
assert dy == 20
|
||||||
assert dx in (0, 10)
|
assert dx in (0, 10)
|
||||||
message = charsets[encoding]["message"].encode(encoding)
|
message = charsets[encoding]["message"].encode(encoding)
|
||||||
for l in range(len(message)):
|
for i in range(len(message)):
|
||||||
msg = message[: l + 1]
|
msg = message[: i + 1]
|
||||||
assert font.getsize(msg) == (len(msg) * 10, 20)
|
assert font.getsize(msg) == (len(msg) * 10, 20)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ def test_consistency_3x3():
|
||||||
# fmt: off
|
# fmt: off
|
||||||
(-1, -1, 0,
|
(-1, -1, 0,
|
||||||
-1, 0, 1,
|
-1, 0, 1,
|
||||||
0, 1, 1),
|
0, 1, 1),
|
||||||
# fmt: on
|
# fmt: on
|
||||||
0.3,
|
0.3,
|
||||||
)
|
)
|
||||||
|
@ -141,7 +141,7 @@ def test_consistency_5x5():
|
||||||
-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
|
# fmt: on
|
||||||
0.3,
|
0.3,
|
||||||
)
|
)
|
||||||
|
|
|
@ -486,8 +486,8 @@ def assert_aux_channel_preserved(mode, transform_in_place, preserved_channel):
|
||||||
# fmt: off
|
# fmt: off
|
||||||
nine_grid_deltas = [ # noqa: E131
|
nine_grid_deltas = [ # noqa: E131
|
||||||
(-1, -1), (-1, 0), (-1, 1),
|
(-1, -1), (-1, 0), (-1, 1),
|
||||||
(0, -1), (0, 0), (0, 1),
|
(0, -1), (0, 0), (0, 1),
|
||||||
(1, -1), (1, 0), (1, 1),
|
(1, -1), (1, 0), (1, 1),
|
||||||
]
|
]
|
||||||
# fmt: on
|
# fmt: on
|
||||||
chans = []
|
chans = []
|
||||||
|
|
|
@ -112,16 +112,16 @@ presets = { # noqa: E128
|
||||||
]},
|
]},
|
||||||
'web_high': {'subsampling': 0, # "4:4:4"
|
'web_high': {'subsampling': 0, # "4:4:4"
|
||||||
'quantization': [
|
'quantization': [
|
||||||
[6, 4, 4, 6, 9, 11, 12, 16,
|
[6, 4, 4, 6, 9, 11, 12, 16,
|
||||||
4, 5, 5, 6, 8, 10, 12, 12,
|
4, 5, 5, 6, 8, 10, 12, 12,
|
||||||
4, 5, 5, 6, 10, 12, 14, 19,
|
4, 5, 5, 6, 10, 12, 14, 19,
|
||||||
6, 6, 6, 11, 12, 15, 19, 28,
|
6, 6, 6, 11, 12, 15, 19, 28,
|
||||||
9, 8, 10, 12, 16, 20, 27, 31,
|
9, 8, 10, 12, 16, 20, 27, 31,
|
||||||
11, 10, 12, 15, 20, 27, 31, 31,
|
11, 10, 12, 15, 20, 27, 31, 31,
|
||||||
12, 12, 14, 19, 27, 31, 31, 31,
|
12, 12, 14, 19, 27, 31, 31, 31,
|
||||||
16, 12, 19, 28, 31, 31, 31, 31],
|
16, 12, 19, 28, 31, 31, 31, 31],
|
||||||
[7, 7, 13, 24, 26, 31, 31, 31,
|
[7, 7, 13, 24, 26, 31, 31, 31,
|
||||||
7, 12, 16, 21, 31, 31, 31, 31,
|
7, 12, 16, 21, 31, 31, 31, 31,
|
||||||
13, 16, 17, 31, 31, 31, 31, 31,
|
13, 16, 17, 31, 31, 31, 31, 31,
|
||||||
24, 21, 31, 31, 31, 31, 31, 31,
|
24, 21, 31, 31, 31, 31, 31, 31,
|
||||||
26, 31, 31, 31, 31, 31, 31, 31,
|
26, 31, 31, 31, 31, 31, 31, 31,
|
||||||
|
@ -131,18 +131,18 @@ presets = { # noqa: E128
|
||||||
]},
|
]},
|
||||||
'web_very_high': {'subsampling': 0, # "4:4:4"
|
'web_very_high': {'subsampling': 0, # "4:4:4"
|
||||||
'quantization': [
|
'quantization': [
|
||||||
[2, 2, 2, 2, 3, 4, 5, 6,
|
[2, 2, 2, 2, 3, 4, 5, 6,
|
||||||
2, 2, 2, 2, 3, 4, 5, 6,
|
2, 2, 2, 2, 3, 4, 5, 6,
|
||||||
2, 2, 2, 2, 4, 5, 7, 9,
|
2, 2, 2, 2, 4, 5, 7, 9,
|
||||||
2, 2, 2, 4, 5, 7, 9, 12,
|
2, 2, 2, 4, 5, 7, 9, 12,
|
||||||
3, 3, 4, 5, 8, 10, 12, 12,
|
3, 3, 4, 5, 8, 10, 12, 12,
|
||||||
4, 4, 5, 7, 10, 12, 12, 12,
|
4, 4, 5, 7, 10, 12, 12, 12,
|
||||||
5, 5, 7, 9, 12, 12, 12, 12,
|
5, 5, 7, 9, 12, 12, 12, 12,
|
||||||
6, 6, 9, 12, 12, 12, 12, 12],
|
6, 6, 9, 12, 12, 12, 12, 12],
|
||||||
[3, 3, 5, 9, 13, 15, 15, 15,
|
[3, 3, 5, 9, 13, 15, 15, 15,
|
||||||
3, 4, 6, 11, 14, 12, 12, 12,
|
3, 4, 6, 11, 14, 12, 12, 12,
|
||||||
5, 6, 9, 14, 12, 12, 12, 12,
|
5, 6, 9, 14, 12, 12, 12, 12,
|
||||||
9, 11, 14, 12, 12, 12, 12, 12,
|
9, 11, 14, 12, 12, 12, 12, 12,
|
||||||
13, 14, 12, 12, 12, 12, 12, 12,
|
13, 14, 12, 12, 12, 12, 12, 12,
|
||||||
15, 12, 12, 12, 12, 12, 12, 12,
|
15, 12, 12, 12, 12, 12, 12, 12,
|
||||||
15, 12, 12, 12, 12, 12, 12, 12,
|
15, 12, 12, 12, 12, 12, 12, 12,
|
||||||
|
@ -189,8 +189,8 @@ presets = { # noqa: E128
|
||||||
'medium': {'subsampling': 2, # "4:2:0"
|
'medium': {'subsampling': 2, # "4:2:0"
|
||||||
'quantization': [
|
'quantization': [
|
||||||
[12, 8, 8, 12, 17, 21, 24, 17,
|
[12, 8, 8, 12, 17, 21, 24, 17,
|
||||||
8, 9, 9, 11, 15, 19, 12, 12,
|
8, 9, 9, 11, 15, 19, 12, 12,
|
||||||
8, 9, 10, 12, 19, 12, 12, 12,
|
8, 9, 10, 12, 19, 12, 12, 12,
|
||||||
12, 11, 12, 21, 12, 12, 12, 12,
|
12, 11, 12, 21, 12, 12, 12, 12,
|
||||||
17, 15, 19, 12, 12, 12, 12, 12,
|
17, 15, 19, 12, 12, 12, 12, 12,
|
||||||
21, 19, 12, 12, 12, 12, 12, 12,
|
21, 19, 12, 12, 12, 12, 12, 12,
|
||||||
|
@ -207,16 +207,16 @@ presets = { # noqa: E128
|
||||||
]},
|
]},
|
||||||
'high': {'subsampling': 0, # "4:4:4"
|
'high': {'subsampling': 0, # "4:4:4"
|
||||||
'quantization': [
|
'quantization': [
|
||||||
[6, 4, 4, 6, 9, 11, 12, 16,
|
[6, 4, 4, 6, 9, 11, 12, 16,
|
||||||
4, 5, 5, 6, 8, 10, 12, 12,
|
4, 5, 5, 6, 8, 10, 12, 12,
|
||||||
4, 5, 5, 6, 10, 12, 12, 12,
|
4, 5, 5, 6, 10, 12, 12, 12,
|
||||||
6, 6, 6, 11, 12, 12, 12, 12,
|
6, 6, 6, 11, 12, 12, 12, 12,
|
||||||
9, 8, 10, 12, 12, 12, 12, 12,
|
9, 8, 10, 12, 12, 12, 12, 12,
|
||||||
11, 10, 12, 12, 12, 12, 12, 12,
|
11, 10, 12, 12, 12, 12, 12, 12,
|
||||||
12, 12, 12, 12, 12, 12, 12, 12,
|
12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
16, 12, 12, 12, 12, 12, 12, 12],
|
16, 12, 12, 12, 12, 12, 12, 12],
|
||||||
[7, 7, 13, 24, 20, 20, 17, 17,
|
[7, 7, 13, 24, 20, 20, 17, 17,
|
||||||
7, 12, 16, 14, 14, 12, 12, 12,
|
7, 12, 16, 14, 14, 12, 12, 12,
|
||||||
13, 16, 14, 14, 12, 12, 12, 12,
|
13, 16, 14, 14, 12, 12, 12, 12,
|
||||||
24, 14, 14, 12, 12, 12, 12, 12,
|
24, 14, 14, 12, 12, 12, 12, 12,
|
||||||
20, 14, 12, 12, 12, 12, 12, 12,
|
20, 14, 12, 12, 12, 12, 12, 12,
|
||||||
|
@ -226,18 +226,18 @@ presets = { # noqa: E128
|
||||||
]},
|
]},
|
||||||
'maximum': {'subsampling': 0, # "4:4:4"
|
'maximum': {'subsampling': 0, # "4:4:4"
|
||||||
'quantization': [
|
'quantization': [
|
||||||
[2, 2, 2, 2, 3, 4, 5, 6,
|
[2, 2, 2, 2, 3, 4, 5, 6,
|
||||||
2, 2, 2, 2, 3, 4, 5, 6,
|
2, 2, 2, 2, 3, 4, 5, 6,
|
||||||
2, 2, 2, 2, 4, 5, 7, 9,
|
2, 2, 2, 2, 4, 5, 7, 9,
|
||||||
2, 2, 2, 4, 5, 7, 9, 12,
|
2, 2, 2, 4, 5, 7, 9, 12,
|
||||||
3, 3, 4, 5, 8, 10, 12, 12,
|
3, 3, 4, 5, 8, 10, 12, 12,
|
||||||
4, 4, 5, 7, 10, 12, 12, 12,
|
4, 4, 5, 7, 10, 12, 12, 12,
|
||||||
5, 5, 7, 9, 12, 12, 12, 12,
|
5, 5, 7, 9, 12, 12, 12, 12,
|
||||||
6, 6, 9, 12, 12, 12, 12, 12],
|
6, 6, 9, 12, 12, 12, 12, 12],
|
||||||
[3, 3, 5, 9, 13, 15, 15, 15,
|
[3, 3, 5, 9, 13, 15, 15, 15,
|
||||||
3, 4, 6, 10, 14, 12, 12, 12,
|
3, 4, 6, 10, 14, 12, 12, 12,
|
||||||
5, 6, 9, 14, 12, 12, 12, 12,
|
5, 6, 9, 14, 12, 12, 12, 12,
|
||||||
9, 10, 14, 12, 12, 12, 12, 12,
|
9, 10, 14, 12, 12, 12, 12, 12,
|
||||||
13, 14, 12, 12, 12, 12, 12, 12,
|
13, 14, 12, 12, 12, 12, 12, 12,
|
||||||
15, 12, 12, 12, 12, 12, 12, 12,
|
15, 12, 12, 12, 12, 12, 12, 12,
|
||||||
15, 12, 12, 12, 12, 12, 12, 12,
|
15, 12, 12, 12, 12, 12, 12, 12,
|
||||||
|
|
|
@ -30,15 +30,15 @@ _Palm8BitColormapValues = ( # noqa: E131
|
||||||
(102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204),
|
(102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204),
|
||||||
(102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153),
|
(102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153),
|
||||||
(102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153),
|
(102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153),
|
||||||
(51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255),
|
(51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255),
|
||||||
(51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204),
|
(51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204),
|
||||||
(51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204),
|
(51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204),
|
||||||
(51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153),
|
(51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153),
|
||||||
(51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255),
|
(51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255),
|
||||||
(0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255),
|
(0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255),
|
||||||
(0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204),
|
(0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204),
|
||||||
(0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153),
|
(0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153),
|
||||||
(0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153),
|
(0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153),
|
||||||
(255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102),
|
(255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102),
|
||||||
(255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51),
|
(255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51),
|
||||||
(255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51),
|
(255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51),
|
||||||
|
@ -57,25 +57,25 @@ _Palm8BitColormapValues = ( # noqa: E131
|
||||||
(102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51),
|
(102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51),
|
||||||
(102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0),
|
(102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0),
|
||||||
(102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0),
|
(102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0),
|
||||||
(51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102),
|
(51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102),
|
||||||
(51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51),
|
(51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51),
|
||||||
(51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51),
|
(51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51),
|
||||||
(51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0),
|
(51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0),
|
||||||
(51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102),
|
(51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102),
|
||||||
(0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102),
|
(0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102),
|
||||||
(0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51),
|
(0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51),
|
||||||
(0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0),
|
(0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0),
|
||||||
(0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17),
|
(0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17),
|
||||||
(34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119),
|
(34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119),
|
||||||
(136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221),
|
(136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221),
|
||||||
(238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128),
|
(238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128),
|
||||||
(0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0),
|
(0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
|
||||||
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0))
|
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0))
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user