Fix deprecation warning about Hashable in py3.7

This commit is contained in:
Bastien Gérard 2018-10-05 14:16:22 +02:00
parent 55fc04752a
commit 89416d9856
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,5 @@
import copy
import numbers
from collections import Hashable
from functools import partial
from bson import ObjectId, json_util
@ -19,6 +18,7 @@ from mongoengine.base.fields import ComplexBaseField
from mongoengine.common import _import_class
from mongoengine.errors import (FieldDoesNotExist, InvalidDocumentError,
LookUpError, OperationError, ValidationError)
from mongoengine.python_support import Hashable
__all__ = ('BaseDocument', 'NON_FIELD_ERRORS')

View File

@ -19,3 +19,10 @@ if not six.PY3:
pass
else:
StringIO = cStringIO.StringIO
if six.PY3:
from collections.abc import Hashable
else:
# raises DeprecationWarnings in Python >=3.7
from collections import Hashable