From ee73e6c32dcd6213ef04ed201bf8dfdd812f8bf7 Mon Sep 17 00:00:00 2001 From: David Sternlicht Date: Wed, 6 May 2020 18:03:52 +0300 Subject: [PATCH] Fix deprecation warning when using collection.MutableMapping --- libtmux/_compat.py | 4 ++++ libtmux/common.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libtmux/_compat.py b/libtmux/_compat.py index 0ec847f86..19a3d944b 100644 --- a/libtmux/_compat.py +++ b/libtmux/_compat.py @@ -35,6 +35,8 @@ from string import lower as ascii_lowercase import urlparse + from collections import MutableMapping + exec('def reraise(tp, value, tb=None):\n raise tp, value, tb') def implements_to_string(cls): @@ -78,6 +80,8 @@ def console_to_str(s): implements_to_string = _identity + from collections.abc import MutableMapping + def console_to_str(s): """ From pypa/pip project, pip.backwardwardcompat. License MIT. """ try: diff --git a/libtmux/common.py b/libtmux/common.py index 46ce6ce18..65f9edcfc 100644 --- a/libtmux/common.py +++ b/libtmux/common.py @@ -15,7 +15,7 @@ from distutils.version import LooseVersion from . import exc -from ._compat import console_to_str, str_from_console +from ._compat import console_to_str, str_from_console, MutableMapping logger = logging.getLogger(__name__) @@ -231,9 +231,9 @@ def __init__(self, *args, **kwargs): logger.debug('self.stdout for %s: \n%s' % (' '.join(cmd), self.stdout)) -class TmuxMappingObject(collections.MutableMapping): +class TmuxMappingObject(MutableMapping): - """Base: :py:class:`collections.MutableMapping`. + """Base: :py:class:`MutableMapping`. Convenience container. Base class for :class:`Pane`, :class:`Window`, :class:`Session` and :class:`Server`.