Skip to content

Commit d8a9b65

Browse files
committed
fixes for python <3.9
1 parent cada2c0 commit d8a9b65

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

plotpy/mathutils/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Licensed under the terms of the BSD 3-Clause
88
# (see plotpy/LICENSE for details)
9-
9+
from __future__ import annotations
1010

1111
import json
1212
import os

plotpy/styles/image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import annotations
23

34
from typing import Callable
45

plotpy/tests/tools/test_downsample_curve.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
# guitest: show
1313

14+
from __future__ import annotations
15+
1416
from typing import Any
1517

1618
from guidata.qthelpers import exec_dialog, qt_app_context

plotpy/tools/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def activate_cmap(
556556
cmap: Cmap to apply for currently selected images. If None, the tool's
557557
active colormap will be used. Defaults to None.
558558
"""
559-
assert isinstance(cmap, QAction | str | CustomQwtLinearColormap | None)
559+
assert isinstance(cmap, (QAction, str, CustomQwtLinearColormap)) or cmap is None
560560
if isinstance(cmap, QAction):
561561
self._active_colormap = cmap.data() # type: ignore
562562
elif isinstance(cmap, str):

plotpy/widgets/colormap_widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88
from __future__ import annotations
99

10-
from typing import Sequence, TypeVar, Union
10+
from typing import Sequence, Tuple, TypeVar, Union
1111

1212
import numpy as np
1313
import qtpy.QtCore as QC
@@ -22,7 +22,7 @@
2222

2323
ColorTypeT = TypeVar("ColorTypeT", bound=Union[QG.QColor, int])
2424
QColorInitTypes = Union[
25-
QG.QColor, int, tuple[int, int, int, int], str, QC.Qt.GlobalColor, None
25+
QG.QColor, int, Tuple[int, int, int, int], str, QC.Qt.GlobalColor, None
2626
]
2727

2828

0 commit comments

Comments
 (0)