Skip to content

Fix deprecation warning when using collection.MutableMapping #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libtmux/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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`.
Expand Down