Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e732028

Browse files
authored
Merge pull request #20881 from anntzer/qt_compat
Deprecate some old globals in qt_compat.
2 parents 9e8c8fa + 1739029 commit e732028

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``matplotlib.backends.qt_compat.ETS`` and ``matplotlib.backends.qt_compat.QT_RC_MAJOR_VERSION``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are deprecated, with no replacement.

lib/matplotlib/backends/qt_compat.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from packaging.version import parse as parse_version
2424

2525
import matplotlib as mpl
26+
from matplotlib import _api
2627

2728

2829
QT_API_PYQT6 = "PyQt6"
@@ -138,11 +139,6 @@ def _isdeleted(obj):
138139
"QT_MAC_WANTS_LAYER" not in os.environ):
139140
os.environ["QT_MAC_WANTS_LAYER"] = "1"
140141

141-
# These globals are only defined for backcompatibility purposes.
142-
ETS = dict(pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))
143-
144-
QT_RC_MAJOR_VERSION = int(QtCore.qVersion().split(".")[0])
145-
146142

147143
# PyQt6 enum compat helpers.
148144

@@ -253,3 +249,11 @@ def handle(*args):
253249
signal.signal(signal.SIGINT, old_sigint_handler)
254250
if handler_args is not None:
255251
old_sigint_handler(*handler_args)
252+
253+
254+
@_api.caching_module_getattr
255+
class __getattr__:
256+
ETS = _api.deprecated("3.5")(property(lambda self: dict(
257+
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))))
258+
QT_RC_MAJOR_VERSION = _api.deprecated("3.5")(property(
259+
lambda self: int(QtCore.qVersion().split(".")[0])))

0 commit comments

Comments
 (0)