Merge pull request #1912 from bagerard/fix_deprecation_warning_Hashable

Fix deprecation warning about Hashable in py3.7
This commit is contained in:
erdenezul 2018-10-10 16:32:50 +08:00 committed by GitHub
commit bf34f413de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

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

View File

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