20
20
21
21
import base64
22
22
import binascii
23
- import collections
23
+ import sys
24
+
25
+ if sys .version_info .major * 10 + sys .version_info .minor < 33 :
26
+ # python < 3.3 uses collections
27
+ import collections
28
+ else :
29
+ # but collections is deprecated from python >= 3.3
30
+ import collections .abc as collections
31
+
24
32
import datetime
25
33
import json
26
34
import threading
27
35
28
36
from rethinkdb import ql2_pb2
29
- from rethinkdb .errors import QueryPrinter , ReqlDriverCompileError , ReqlDriverError , T
37
+ from rethinkdb .errors import (QueryPrinter , ReqlDriverCompileError ,
38
+ ReqlDriverError , T )
30
39
31
40
P_TERM = ql2_pb2 .Term .TermType
32
41
@@ -74,7 +83,7 @@ def clear(cls):
74
83
75
84
def expr (val , nesting_depth = 20 ):
76
85
"""
77
- Convert a Python primitive into a RQL primitive value
86
+ Convert a Python primitive into a RQL primitive value
78
87
"""
79
88
if not isinstance (nesting_depth , int ):
80
89
raise ReqlDriverCompileError ("Second argument to `r.expr` must be a number." )
@@ -759,7 +768,7 @@ def recursively_make_hashable(obj):
759
768
760
769
class ReQLEncoder (json .JSONEncoder ):
761
770
"""
762
- Default JSONEncoder subclass to handle query conversion.
771
+ Default JSONEncoder subclass to handle query conversion.
763
772
"""
764
773
765
774
def __init__ (self ):
@@ -779,7 +788,7 @@ def default(self, obj):
779
788
780
789
class ReQLDecoder (json .JSONDecoder ):
781
790
"""
782
- Default JSONDecoder subclass to handle pseudo-type conversion.
791
+ Default JSONDecoder subclass to handle pseudo-type conversion.
783
792
"""
784
793
785
794
def __init__ (self , reql_format_opts = None ):
0 commit comments