2020
2121import base64
2222import binascii
23- import collections
2423import datetime
2524import json
25+ import sys
2626import threading
2727
2828from rethinkdb import ql2_pb2
29- from rethinkdb .errors import QueryPrinter , ReqlDriverCompileError , ReqlDriverError , T
29+ from rethinkdb .errors import (QueryPrinter , ReqlDriverCompileError ,
30+ ReqlDriverError , T )
31+
32+ if sys .version_info < (3 , 3 ):
33+ # python < 3.3 uses collections
34+ import collections
35+ else :
36+ # but collections is deprecated from python >= 3.3
37+ import collections .abc as collections
3038
3139P_TERM = ql2_pb2 .Term .TermType
3240
@@ -74,7 +82,7 @@ def clear(cls):
7482
7583def expr (val , nesting_depth = 20 ):
7684 """
77- Convert a Python primitive into a RQL primitive value
85+ Convert a Python primitive into a RQL primitive value
7886 """
7987 if not isinstance (nesting_depth , int ):
8088 raise ReqlDriverCompileError ("Second argument to `r.expr` must be a number." )
@@ -759,7 +767,7 @@ def recursively_make_hashable(obj):
759767
760768class ReQLEncoder (json .JSONEncoder ):
761769 """
762- Default JSONEncoder subclass to handle query conversion.
770+ Default JSONEncoder subclass to handle query conversion.
763771 """
764772
765773 def __init__ (self ):
@@ -779,7 +787,7 @@ def default(self, obj):
779787
780788class ReQLDecoder (json .JSONDecoder ):
781789 """
782- Default JSONDecoder subclass to handle pseudo-type conversion.
790+ Default JSONDecoder subclass to handle pseudo-type conversion.
783791 """
784792
785793 def __init__ (self , reql_format_opts = None ):
0 commit comments