Skip to content

Commit

Permalink
fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlatwe committed Apr 28, 2021
1 parent 991072a commit c947bba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
9 changes: 5 additions & 4 deletions montydb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
# Assembling crucial classes and functions form pymongo module,
# some of them may modified by needs.

try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping

from collections import (
OrderedDict,
MutableMapping,
)
from collections import OrderedDict
from .types import (
abc,
iteritems,
Expand Down
4 changes: 2 additions & 2 deletions montydb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def get_database(self, name):
"""
# verify database name
if platform.system() == "Windows":
is_invaild = set('/\. "$*<>:|?').intersection(set(name))
is_invaild = set(r'/\. "$*<>:|?').intersection(set(name))
else:
is_invaild = set('/\. "$').intersection(set(name))
is_invaild = set(r'/\. "$').intersection(set(name))

if is_invaild or not name:
raise errors.OperationFailure("Invaild database name.")
Expand Down
5 changes: 4 additions & 1 deletion montydb/engine/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import re
from copy import deepcopy
from datetime import datetime
from collections import Mapping
try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping

from ..errors import OperationFailure

Expand Down
5 changes: 4 additions & 1 deletion montydb/engine/weighted.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

from datetime import datetime
from collections import Mapping
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping

from ..types import (
integer_types,
Expand Down
2 changes: 1 addition & 1 deletion montydb/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class MongoQueryRecorder(object):

def __init__(self, mongodb, namespace=None, user=None):
self._mongodb = mongodb
self._namespace = namespace or {"$regex": mongodb.name + "\..*"}
self._namespace = namespace or {"$regex": mongodb.name + r"\..*"}
self._user = user

self._epoch = datetime(1970, 1, 1)
Expand Down

0 comments on commit c947bba

Please sign in to comment.