PYTHON-1556 Fix compatibility issues with Python >= 3.6 (#352)
Use raw strings to avoid invalid escape sequence warnings in Python >= 3.6
This commit is contained in:
parent
5a652be993
commit
72cab9356d
@ -34,8 +34,8 @@ from pymongo.son_manipulator import SONManipulator
|
||||
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):
|
||||
|
||||
@ -1217,7 +1217,7 @@ class TestCursor(IntegrationTest):
|
||||
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"
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user