Browse Source

Update contrib/python/matplotlib/py3 to 3.8.2

robot-contrib 1 year ago
parent
commit
f82bfd2a08

+ 3 - 3
contrib/python/matplotlib/py3/.dist-info/METADATA

@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: matplotlib
-Version: 3.8.0
+Version: 3.8.2
 Summary: Python plotting package
 Home-page: https://matplotlib.org
 Download-URL: https://matplotlib.org/stable/users/installing/index.html
@@ -42,10 +42,10 @@ License-File: LICENSE/LICENSE_YORICK
 Requires-Dist: contourpy >=1.0.1
 Requires-Dist: cycler >=0.10
 Requires-Dist: fonttools >=4.22.0
-Requires-Dist: kiwisolver >=1.0.1
+Requires-Dist: kiwisolver >=1.3.1
 Requires-Dist: numpy <2,>=1.21
 Requires-Dist: packaging >=20.0
-Requires-Dist: pillow >=6.2.0
+Requires-Dist: pillow >=8
 Requires-Dist: pyparsing >=2.3.1
 Requires-Dist: python-dateutil >=2.7
 Requires-Dist: importlib-resources >=3.2.0 ; python_version<"3.10"

+ 1 - 1
contrib/python/matplotlib/py3/matplotlib/__init__.py

@@ -246,7 +246,7 @@ def _check_versions():
     for modname, minver in [
             ("cycler", "0.10"),
             ("dateutil", "2.7"),
-            ("kiwisolver", "1.0.1"),
+            ("kiwisolver", "1.3.1"),
             ("numpy", "1.21"),
             ("pyparsing", "2.3.1"),
     ]:

+ 14 - 2
contrib/python/matplotlib/py3/matplotlib/_version.py

@@ -1,4 +1,16 @@
 # file generated by setuptools_scm
 # don't change, don't track in version control
-__version__ = version = '3.8.0'
-__version_tuple__ = version_tuple = (3, 8, 0)
+TYPE_CHECKING = False
+if TYPE_CHECKING:
+    from typing import Tuple, Union
+    VERSION_TUPLE = Tuple[Union[int, str], ...]
+else:
+    VERSION_TUPLE = object
+
+version: str
+__version__: str
+__version_tuple__: VERSION_TUPLE
+version_tuple: VERSION_TUPLE
+
+__version__ = version = '3.8.2'
+__version_tuple__ = version_tuple = (3, 8, 2)

+ 9 - 4
contrib/python/matplotlib/py3/matplotlib/axes/_axes.py

@@ -3382,7 +3382,7 @@ class Axes(_AxesBase):
         Plot y versus x as lines and/or markers with attached errorbars.
 
         *x*, *y* define the data locations, *xerr*, *yerr* define the errorbar
-        sizes. By default, this draws the data markers/lines as well the
+        sizes. By default, this draws the data markers/lines as well as the
         errorbars. Use fmt='none' to draw errorbars without any data markers.
 
         .. versionadded:: 3.7
@@ -4858,8 +4858,8 @@ default: :rc:`scatter.edgecolors`
         yscale : {'linear', 'log'}, default: 'linear'
             Use a linear or log10 scale on the vertical axis.
 
-        mincnt : int > 0, default: *None*
-            If not *None*, only display cells with more than *mincnt*
+        mincnt : int >= 0, default: *None*
+            If not *None*, only display cells with at least *mincnt*
             number of points in the cell.
 
         marginals : bool, default: *False*
@@ -4926,6 +4926,11 @@ default: :rc:`scatter.edgecolors`
             - `numpy.sum`: integral of the point values
             - `numpy.amax`: value taken from the largest point
 
+            By default will only reduce cells with at least 1 point because some
+            reduction functions (such as `numpy.amax`) will error/warn with empty
+            input. Changing *mincnt* will adjust the cutoff, and if set to 0 will
+            pass empty input to the reduction function.
+
         data : indexable object, optional
             DATA_PARAMETER_PLACEHOLDER
 
@@ -5023,7 +5028,7 @@ default: :rc:`scatter.edgecolors`
                 else:
                     Cs_at_i2[i2[i]].append(C[i])
             if mincnt is None:
-                mincnt = 0
+                mincnt = 1
             accum = np.array(
                 [reduce_C_function(acc) if len(acc) >= mincnt else np.nan
                  for Cs_at_i in [Cs_at_i1, Cs_at_i2]

+ 6 - 0
contrib/python/matplotlib/py3/matplotlib/backend_bases.py

@@ -2123,6 +2123,12 @@ class FigureCanvasBase:
         if dpi == 'figure':
             dpi = getattr(self.figure, '_original_dpi', self.figure.dpi)
 
+        if kwargs.get("papertype") == 'auto':
+            # When deprecation elapses, remove backend_ps._get_papertype & its callers.
+            _api.warn_deprecated(
+                "3.8", name="papertype='auto'", addendum="Pass an explicit paper type, "
+                "'figure', or omit the *papertype* argument entirely.")
+
         # Remove the figure manager, if any, to avoid resizing the GUI widget.
         with cbook._setattr_cm(self, manager=None), \
              self._switch_canvas_and_return_print_method(format, backend) \

+ 49 - 28
contrib/python/matplotlib/py3/matplotlib/backends/backend_macosx.py

@@ -1,3 +1,4 @@
+import contextlib
 import os
 import signal
 import socket
@@ -106,6 +107,13 @@ class FigureCanvasMac(FigureCanvasAgg, _macosx.FigureCanvas, FigureCanvasBase):
         ResizeEvent("resize_event", self)._process()
         self.draw_idle()
 
+    def start_event_loop(self, timeout=0):
+        # docstring inherited
+        with _maybe_allow_interrupt():
+            # Call the objc implementation of the event loop after
+            # setting up the interrupt handling
+            self._start_event_loop(timeout=timeout)
+
 
 class NavigationToolbar2Mac(_macosx.NavigationToolbar2, NavigationToolbar2):
 
@@ -147,7 +155,7 @@ class FigureManagerMac(_macosx.FigureManager, FigureManagerBase):
         icon_path = str(cbook._get_data_path('images/matplotlib.pdf'))
         _macosx.FigureManager.set_icon(icon_path)
         FigureManagerBase.__init__(self, canvas, num)
-        self._set_window_mode(mpl.rcParams.get("macosx.window_mode", "system"))
+        self._set_window_mode(mpl.rcParams["macosx.window_mode"])
         if self.toolbar is not None:
             self.toolbar.update()
         if mpl.is_interactive():
@@ -171,34 +179,8 @@ class FigureManagerMac(_macosx.FigureManager, FigureManagerBase):
         # Set up a SIGINT handler to allow terminating a plot via CTRL-C.
         # The logic is largely copied from qt_compat._maybe_allow_interrupt; see its
         # docstring for details.  Parts are implemented by wake_on_fd_write in ObjC.
-
-        old_sigint_handler = signal.getsignal(signal.SIGINT)
-        if old_sigint_handler in (None, signal.SIG_IGN, signal.SIG_DFL):
-            _macosx.show()
-            return
-
-        handler_args = None
-        wsock, rsock = socket.socketpair()
-        wsock.setblocking(False)
-        rsock.setblocking(False)
-        old_wakeup_fd = signal.set_wakeup_fd(wsock.fileno())
-        _macosx.wake_on_fd_write(rsock.fileno())
-
-        def handle(*args):
-            nonlocal handler_args
-            handler_args = args
-            _macosx.stop()
-
-        signal.signal(signal.SIGINT, handle)
-        try:
+        with _maybe_allow_interrupt():
             _macosx.show()
-        finally:
-            wsock.close()
-            rsock.close()
-            signal.set_wakeup_fd(old_wakeup_fd)
-            signal.signal(signal.SIGINT, old_sigint_handler)
-            if handler_args is not None:
-                old_sigint_handler(*handler_args)
 
     def show(self):
         if not self._shown:
@@ -208,6 +190,45 @@ class FigureManagerMac(_macosx.FigureManager, FigureManagerBase):
             self._raise()
 
 
+@contextlib.contextmanager
+def _maybe_allow_interrupt():
+    """
+    This manager allows to terminate a plot by sending a SIGINT. It is
+    necessary because the running backend prevents Python interpreter to
+    run and process signals (i.e., to raise KeyboardInterrupt exception). To
+    solve this one needs to somehow wake up the interpreter and make it close
+    the plot window. The implementation is taken from qt_compat, see that
+    docstring for a more detailed description.
+    """
+    old_sigint_handler = signal.getsignal(signal.SIGINT)
+    if old_sigint_handler in (None, signal.SIG_IGN, signal.SIG_DFL):
+        yield
+        return
+
+    handler_args = None
+    wsock, rsock = socket.socketpair()
+    wsock.setblocking(False)
+    rsock.setblocking(False)
+    old_wakeup_fd = signal.set_wakeup_fd(wsock.fileno())
+    _macosx.wake_on_fd_write(rsock.fileno())
+
+    def handle(*args):
+        nonlocal handler_args
+        handler_args = args
+        _macosx.stop()
+
+    signal.signal(signal.SIGINT, handle)
+    try:
+        yield
+    finally:
+        wsock.close()
+        rsock.close()
+        signal.set_wakeup_fd(old_wakeup_fd)
+        signal.signal(signal.SIGINT, old_sigint_handler)
+        if handler_args is not None:
+            old_sigint_handler(*handler_args)
+
+
 @_Backend.export
 class _BackendMac(_Backend):
     FigureCanvas = FigureCanvasMac

+ 0 - 6
contrib/python/matplotlib/py3/matplotlib/backends/backend_ps.py

@@ -872,9 +872,6 @@ class FigureCanvasPS(FigureCanvasBase):
         # find the appropriate papertype
         width, height = self.figure.get_size_inches()
         if papertype == 'auto':
-            _api.warn_deprecated("3.8", name="papertype='auto'",
-                                 addendum="Pass an explicit paper type, 'figure', or "
-                                 "omit the *papertype* argument entirely.")
             papertype = _get_papertype(*orientation.swap_if_landscape((width, height)))
 
         if is_eps or papertype == 'figure':
@@ -1058,9 +1055,6 @@ showpage
                     self.figure.get_size_inches())
             else:
                 if papertype == 'auto':
-                    _api.warn_deprecated("3.8", name="papertype='auto'",
-                                         addendum="Pass an explicit paper type, or "
-                                         "omit the *papertype* argument entirely.")
                     papertype = _get_papertype(width, height)
                 paper_width, paper_height = papersize[papertype]
 

+ 2 - 2
contrib/python/matplotlib/py3/matplotlib/cbook.py

@@ -1685,7 +1685,7 @@ def safe_first_element(obj):
 def _safe_first_finite(obj, *, skip_nonfinite=True):
     """
     Return the first finite element in *obj* if one is available and skip_nonfinite is
-    True. Otherwise return the first element.
+    True. Otherwise, return the first element.
 
     This is a method for internal use.
 
@@ -1697,7 +1697,7 @@ def _safe_first_finite(obj, *, skip_nonfinite=True):
             return False
         try:
             return math.isfinite(val)
-        except TypeError:
+        except (TypeError, ValueError):
             pass
         try:
             return np.isfinite(val) if np.isscalar(val) else True

+ 5 - 0
contrib/python/matplotlib/py3/matplotlib/cm.py

@@ -74,6 +74,11 @@ class ColormapRegistry(Mapping):
     Additional colormaps can be added via `.ColormapRegistry.register`::
 
         mpl.colormaps.register(my_colormap)
+
+    To get a list of all registered colormaps, you can do::
+
+        from matplotlib import colormaps
+        list(colormaps)
     """
     def __init__(self, cmaps):
         self._cmaps = cmaps

+ 1 - 1
contrib/python/matplotlib/py3/matplotlib/colorbar.py

@@ -404,7 +404,7 @@ class Colorbar:
             try:
                 self._formatter = ticker.FormatStrFormatter(format)
                 _ = self._formatter(0)
-            except TypeError:
+            except (TypeError, ValueError):
                 self._formatter = ticker.StrMethodFormatter(format)
         else:
             self._formatter = format  # Assume it is a Formatter or None

Some files were not shown because too many files changed in this diff