From 36dcc0fdda91ba5c5e1628c05f8cf8237c1ee669 Mon Sep 17 00:00:00 2001 From: Isaac Muse Date: Tue, 1 Jan 2019 10:05:31 -0700 Subject: [PATCH] Import Mapping from collections.abc on Python 3 (#58) --- docs/src/markdown/about/changelog.md | 4 ++++ soupsieve/__meta__.py | 2 +- soupsieve/css_types.py | 3 +-- soupsieve/util.py | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md index ab6f2d9f..317f4c51 100644 --- a/docs/src/markdown/about/changelog.md +++ b/docs/src/markdown/about/changelog.md @@ -1,5 +1,9 @@ # Changelog +## 1.6.1 + +- **FIX**: Fix warning about not importing `Mapping` from `collections.abc`. + ## 1.6.0 - **NEW**: Add `closest` method to the API that matches closest ancestor. diff --git a/soupsieve/__meta__.py b/soupsieve/__meta__.py index 3b331068..4d7b914a 100644 --- a/soupsieve/__meta__.py +++ b/soupsieve/__meta__.py @@ -186,5 +186,5 @@ def parse_version(ver, pre=False): return Version(major, minor, micro, release, pre, post, dev) -__version_info__ = Version(1, 6, 0, "final") +__version_info__ = Version(1, 6, 1, ".dev") __version__ = __version_info__._get_canonical() diff --git a/soupsieve/css_types.py b/soupsieve/css_types.py index 5a1e01db..32763c3f 100644 --- a/soupsieve/css_types.py +++ b/soupsieve/css_types.py @@ -1,6 +1,5 @@ """CSS selector structure items.""" from __future__ import unicode_literals -from collections import Mapping from . import util __all__ = ('Selector', 'SelectorTag', 'SelectorAttribute', 'SelectorNth', 'SelectorList', 'Namespaces') @@ -72,7 +71,7 @@ def __repr__(self): # pragma: no cover __str__ = __repr__ -class ImmutableDict(Mapping): +class ImmutableDict(util.Mapping): """Hashable, immutable dictionary.""" def __init__(self, *args, **kwargs): diff --git a/soupsieve/util.py b/soupsieve/util.py index 55378adc..260965c0 100644 --- a/soupsieve/util.py +++ b/soupsieve/util.py @@ -10,7 +10,7 @@ if PY3: from functools import lru_cache # noqa F401 import copyreg # noqa F401 - from collections.abc import Hashable # noqa F401 + from collections.abc import Hashable, Mapping # noqa F401 ustr = str # noqa bstr = bytes # noqa @@ -19,7 +19,7 @@ else: from backports.functools_lru_cache import lru_cache # noqa F401 import copy_reg as copyreg # noqa F401 - from collections import Hashable # noqa F401 + from collections import Hashable, Mapping # noqa F401 ustr = unicode # noqa bstr = str # noqa