20
20
21
21
import base64
22
22
import binascii
23
- import collections
24
23
import datetime
25
24
import json
25
+ import sys
26
26
import threading
27
27
28
28
from 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
30
38
31
39
P_TERM = ql2_pb2 .Term .TermType
32
40
@@ -74,7 +82,7 @@ def clear(cls):
74
82
75
83
def expr (val , nesting_depth = 20 ):
76
84
"""
77
- Convert a Python primitive into a RQL primitive value
85
+ Convert a Python primitive into a RQL primitive value
78
86
"""
79
87
if not isinstance (nesting_depth , int ):
80
88
raise ReqlDriverCompileError ("Second argument to `r.expr` must be a number." )
@@ -759,7 +767,7 @@ def recursively_make_hashable(obj):
759
767
760
768
class ReQLEncoder (json .JSONEncoder ):
761
769
"""
762
- Default JSONEncoder subclass to handle query conversion.
770
+ Default JSONEncoder subclass to handle query conversion.
763
771
"""
764
772
765
773
def __init__ (self ):
@@ -779,7 +787,7 @@ def default(self, obj):
779
787
780
788
class ReQLDecoder (json .JSONDecoder ):
781
789
"""
782
- Default JSONDecoder subclass to handle pseudo-type conversion.
790
+ Default JSONDecoder subclass to handle pseudo-type conversion.
783
791
"""
784
792
785
793
def __init__ (self , reql_format_opts = None ):
0 commit comments