From 11b1260cf4f00de7bcbd46ec0d85da5e61c12f71 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 19 May 2022 11:51:11 -0600 Subject: [PATCH] MNT: Remove dummy_threading because threading is always available With Python 3.7 and above, the threading module is always available. --- lib/matplotlib/backends/backend_agg.py | 5 +---- lib/matplotlib/font_manager.py | 9 ++------- lib/matplotlib/pyplot.py | 5 +---- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/matplotlib/backends/backend_agg.py b/lib/matplotlib/backends/backend_agg.py index 1f3e94681372..8fd89c8ef78d 100644 --- a/lib/matplotlib/backends/backend_agg.py +++ b/lib/matplotlib/backends/backend_agg.py @@ -21,12 +21,9 @@ .. _Anti-Grain Geometry: http://agg.sourceforge.net/antigrain.com """ -try: - import threading -except ImportError: - import dummy_threading as threading from contextlib import nullcontext from math import radians, cos, sin +import threading import numpy as np diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index a94e0ffad9c9..eff1b2362db9 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -36,12 +36,7 @@ import re import subprocess import sys -try: - import threading - from threading import Timer -except ImportError: - import dummy_threading as threading - from dummy_threading import Timer +import threading import matplotlib as mpl from matplotlib import _api, _afm, cbook, ft2font, rcParams @@ -1100,7 +1095,7 @@ def __init__(self, size=None, weight='normal'): self.ttflist = [] # Delay the warning by 5s. - timer = Timer(5, lambda: _log.warning( + timer = threading.Timer(5, lambda: _log.warning( 'Matplotlib is building the font cache; this may take a moment.')) timer.start() try: diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 2aedcb5f362a..7a398b25975b 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -43,11 +43,8 @@ from numbers import Number import re import sys +import threading import time -try: - import threading -except ImportError: - import dummy_threading as threading from cycler import cycler import matplotlib