aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pillow/py3/PIL/ImageOps.py
diff options
context:
space:
mode:
authorkickbutt <kickbutt@yandex-team.com>2024-01-23 23:36:43 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-01-24 15:02:13 +0300
commit299dc21a6f70a16b00e1d564fa56961331552415 (patch)
tree183f498a2e98a04f9a6143a11006ba0c10f867f3 /contrib/python/Pillow/py3/PIL/ImageOps.py
parent5ccb6ae864be6b53df427dc3a0fa14dbb95aa11c (diff)
downloadydb-299dc21a6f70a16b00e1d564fa56961331552415.tar.gz
Fix separator in CUDA_ARCHITECTURES
Diffstat (limited to 'contrib/python/Pillow/py3/PIL/ImageOps.py')
-rw-r--r--contrib/python/Pillow/py3/PIL/ImageOps.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/contrib/python/Pillow/py3/PIL/ImageOps.py b/contrib/python/Pillow/py3/PIL/ImageOps.py
index 42f2152b39..a9e626b2b2 100644
--- a/contrib/python/Pillow/py3/PIL/ImageOps.py
+++ b/contrib/python/Pillow/py3/PIL/ImageOps.py
@@ -16,6 +16,7 @@
#
# See the README file for information on usage and redistribution.
#
+from __future__ import annotations
import functools
import operator
@@ -56,7 +57,7 @@ def _lut(image, lut):
lut = lut + lut + lut
return image.point(lut)
else:
- msg = "not supported for this image mode"
+ msg = f"not supported for mode {image.mode}"
raise OSError(msg)
@@ -557,9 +558,7 @@ def invert(image):
:param image: The image to invert.
:return: An image.
"""
- lut = []
- for i in range(256):
- lut.append(255 - i)
+ lut = list(range(255, -1, -1))
return image.point(lut) if image.mode == "1" else _lut(image, lut)
@@ -581,10 +580,8 @@ def posterize(image, bits):
:param bits: The number of bits to keep for each channel (1-8).
:return: An image.
"""
- lut = []
mask = ~(2 ** (8 - bits) - 1)
- for i in range(256):
- lut.append(i & mask)
+ lut = [i & mask for i in range(256)]
return _lut(image, lut)
@@ -593,7 +590,7 @@ def solarize(image, threshold=128):
Invert all pixel values above a threshold.
:param image: The image to solarize.
- :param threshold: All pixels above this greyscale level are inverted.
+ :param threshold: All pixels above this grayscale level are inverted.
:return: An image.
"""
lut = []