Permalink
Browse files

PYTHON-1556 Fix compatibility issues with Python >= 3.6 (#352)

Use raw strings to avoid invalid escape sequence warnings in Python >= 3.6
  • Loading branch information...
egao1980 authored and ShaneHarvey committed May 15, 2018
1 parent 5a652be commit 72cab9356df056edaa650654ff4c95f85ab4e6e6
Showing with 5 additions and 4 deletions.
  1. +2 −2 pymongo/database.py
  2. +1 −1 test/test_cursor.py
  3. +2 −1 tools/benchmark.py
View
@@ -34,8 +34,8 @@
from pymongo.write_concern import WriteConcern
_INDEX_REGEX = {"name": {"$regex": "^(?!.*\$)"}}
_SYSTEM_FILTER = {"filter": {"name": {"$regex": "^(?!system\.)"}}}
_INDEX_REGEX = {"name": {"$regex": r"^(?!.*\$)"}}
_SYSTEM_FILTER = {"filter": {"name": {"$regex": r"^(?!system\.)"}}}
def _check_name(name):
View
@@ -1217,7 +1217,7 @@ def test_comment(self):
raise SkipTest("SERVER-4754 - This test uses profiling.")
# MongoDB 3.1.5 changed the ns for commands.
regex = {'$regex': 'pymongo_test.(\$cmd|test)'}
regex = {'$regex': r'pymongo_test.(\$cmd|test)'}
if client_context.version.at_least(3, 5, 8, -1):
query_key = "command.comment"
View
@@ -13,6 +13,7 @@
# limitations under the License.
"""MongoDB benchmarking suite."""
from __future__ import print_function
import time
import sys
@@ -87,7 +88,7 @@ def timed(name, function, args=[], setup=None):
function(*args)
times.append(time.time() - start)
best_time = min(times)
print "%s%d" % (name + (60 - len(name)) * ".", per_trial / best_time)
print("{0:s}{1:d}".format(name + (60 - len(name)) * ".", per_trial / best_time))
return best_time

0 comments on commit 72cab93

Please sign in to comment.