Repository: MongoEngine/mongoengine

Issue:
Deprecation warning due to invalid escape sequences in Python 3.8
```
find . -iname '*.py'  | xargs -P 4 -I{} python3.8 -Wall -m py_compile {}

./mongoengine/document.py:59: DeprecationWarning: invalid escape sequence \ 
  """A :class:`~mongoengine.Document` that isn't stored in its own
./mongoengine/queryset/base.py:695: DeprecationWarning: invalid escape sequence \ 
  """Retrieve a set of documents by their ids.
./mongoengine/queryset/base.py:1142: DeprecationWarning: invalid escape sequence \ 
  """Return an explain plan record for the
./tests/fields/test_complex_datetime_field.py:68: DeprecationWarning: invalid escape sequence \d
  re.match("^\d{4},\d{2},\d{2},\d{2},\d{2},\d{2},\d{6}$", stored)
./tests/fields/test_complex_datetime_field.py:77: DeprecationWarning: invalid escape sequence \d
  re.match("^\d{4}.\d{2}.\d{2}.\d{2}.\d{2}.\d{2}.\d{6}$", stored) is not None
```


Discussion:

Resolving patch:
diff --git a/mongoengine/document.py b/mongoengine/document.py
--- a/mongoengine/document.py
+++ b/mongoengine/document.py
@@ -56,7 +56,7 @@ class InvalidCollectionError(Exception):
 
 
 class EmbeddedDocument(six.with_metaclass(DocumentMetaclass, BaseDocument)):
-    """A :class:`~mongoengine.Document` that isn't stored in its own
+    r"""A :class:`~mongoengine.Document` that isn't stored in its own
     collection.  :class:`~mongoengine.EmbeddedDocument`\ s should be used as
     fields on :class:`~mongoengine.Document`\ s through the
     :class:`~mongoengine.EmbeddedDocumentField` field type.
diff --git a/mongoengine/queryset/base.py b/mongoengine/queryset/base.py
--- a/mongoengine/queryset/base.py
+++ b/mongoengine/queryset/base.py
@@ -694,8 +694,8 @@ def with_id(self, object_id):
     def in_bulk(self, object_ids):
         """Retrieve a set of documents by their ids.
 
-        :param object_ids: a list or tuple of ``ObjectId``\ s
-        :rtype: dict of ObjectIds as keys and collection-specific
+        :param object_ids: a list or tuple of ObjectId's
+        :rtype: dict of ObjectId's as keys and collection-specific
                 Document subclasses as values.
 
         .. versionadded:: 0.3
@@ -1140,7 +1140,7 @@ def comment(self, text):
 
     def explain(self):
         """Return an explain plan record for the
-        :class:`~mongoengine.queryset.QuerySet`\ 's cursor.
+        :class:`~mongoengine.queryset.QuerySet` cursor.
         """
         return self._cursor.explain()
 


Test patch:
diff --git a/tests/fields/test_complex_datetime_field.py b/tests/fields/test_complex_datetime_field.py
--- a/tests/fields/test_complex_datetime_field.py
+++ b/tests/fields/test_complex_datetime_field.py
@@ -65,7 +65,7 @@ class LogEntry(Document):
         for values in itertools.product([2014], mm, dd, hh, ii, ss, microsecond):
             stored = LogEntry(date=datetime.datetime(*values)).to_mongo()["date"]
             assert (
-                re.match("^\d{4},\d{2},\d{2},\d{2},\d{2},\d{2},\d{6}$", stored)
+                re.match(r"^\d{4},\d{2},\d{2},\d{2},\d{2},\d{2},\d{6}$", stored)
                 is not None
             )
 
@@ -74,7 +74,7 @@ class LogEntry(Document):
             "date_with_dots"
         ]
         assert (
-            re.match("^\d{4}.\d{2}.\d{2}.\d{2}.\d{2}.\d{2}.\d{6}$", stored) is not None
+            re.match(r"^\d{4}.\d{2}.\d{2}.\d{2}.\d{2}.\d{2}.\d{6}$", stored) is not None
         )
 
     def test_complexdatetime_usage(self):