Skip to content
Snippets Groups Projects
Commit 7a1c98b9 authored by Rajmund Hruška's avatar Rajmund Hruška
Browse files

Fix: Correctly import from collections. (Fixes: #2)

parent 48f46b9f
No related branches found
No related tags found
2 merge requests!8Fix deprecation warnings,!60.1.14
Pipeline #1800 passed
...@@ -13,7 +13,12 @@ type definition. ...@@ -13,7 +13,12 @@ type definition.
__version__ = '0.1.13' __version__ = '0.1.13'
__author__ = 'Pavel Kácha <pavel.kacha@cesnet.cz>' __author__ = 'Pavel Kácha <pavel.kacha@cesnet.cz>'
import collections try: # Python 2
from collections.abc import MutableMapping
from collections.abc import MutableSequence
except ImportError: # Python 3
from collections import MutableMapping
from collections import MutableSequence
import abc import abc
...@@ -61,7 +66,7 @@ class TypedDictMetaclass(abc.ABCMeta): ...@@ -61,7 +66,7 @@ class TypedDictMetaclass(abc.ABCMeta):
dictify_typedef(cls.typedef) dictify_typedef(cls.typedef)
class TypedDict(collections.MutableMapping): class TypedDict(MutableMapping):
""" Dictionary type abstract class, which supports checking of inserted """ Dictionary type abstract class, which supports checking of inserted
types, based on simple type definition. types, based on simple type definition.
...@@ -222,7 +227,7 @@ class TypedDict(collections.MutableMapping): ...@@ -222,7 +227,7 @@ class TypedDict(collections.MutableMapping):
TypedDict = TypedDictMetaclass("TypedDict", (TypedDict,), {}) TypedDict = TypedDictMetaclass("TypedDict", (TypedDict,), {})
class TypedList(collections.MutableSequence): class TypedList(MutableSequence):
""" List type abstract class, which supports checking of inserted items """ List type abstract class, which supports checking of inserted items
type. type.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment