From b5475cad6b0d4f4a34765f7010eef15ecad9010e Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Wed, 8 Sep 2021 09:52:46 +0800 Subject: [PATCH] warn about usage of non-uint8 LUTs --- pyqtgraph/graphicsItems/ImageItem.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index bb43014e..af6da24f 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import division - import numpy from .GraphicsObject import GraphicsObject @@ -11,11 +9,8 @@ from ..Point import Point from ..Qt import QtGui, QtCore from ..util.cupy_helper import getCupy -try: - from collections.abc import Callable -except ImportError: - # fallback for python < 3.3 - from collections import Callable +import warnings +from collections.abc import Callable translate = QtCore.QCoreApplication.translate @@ -542,7 +537,11 @@ class ImageItem(GraphicsObject): # However, the makeARGB() codepath has previously allowed such # a usage to work. Rather than fail outright, we delegate this # case to makeARGB(). - pass + warnings.warn( + "Using non-uint8 LUTs is an undocumented accidental feature and may " + "be removed at some point in the future. Please open an issue if you " + "instead believe this to be worthy of protected inclusion in pyqtgraph.", + DeprecationWarning, stacklevel=2) elif image.dtype.kind == 'f': image, levels, lut, augmented_alpha = self._try_rescale_float(image, levels, lut) # if we succeeded, we will have an uint8 image with levels None.