summarylogtreecommitdiffstats
path: root/0004-collections-abc.patch
blob: bfecbe34556417a3a2cfb4efc01b342acab0555c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
diff --git a/lib/third_party/dns/namedict.py b/lib/third_party/dns/namedict.py
index 37a13104..e2309c1f 100644
--- a/lib/third_party/dns/namedict.py
+++ b/lib/third_party/dns/namedict.py
@@ -32,7 +32,14 @@ import dns.name
 from ._compat import xrange
 
 
-class NameDict(collections.MutableMapping):
+try:
+  # Python 3.3 and above.
+  collections_abc = collections.abc
+except AttributeError:
+  collections_abc = collections
+
+
+class NameDict(collections_abc.MutableMapping):
     """A dictionary whose keys are dns.name.Name objects.
 
     In addition to being like a regular Python dictionary, this
diff --git a/lib/third_party/functools32/functools32.py b/lib/third_party/functools32/functools32.py
index c44551fa..291f81d0 100644
--- a/lib/third_party/functools32/functools32.py
+++ b/lib/third_party/functools32/functools32.py
@@ -12,7 +12,7 @@ __all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES',
            'total_ordering', 'cmp_to_key', 'lru_cache', 'reduce', 'partial']
 
 from _functools import partial, reduce
-from collections import MutableMapping, namedtuple
+from collections import namedtuple
 from .reprlib32 import recursive_repr as _recursive_repr
 from weakref import proxy as _proxy
 import sys as _sys
@@ -21,6 +21,11 @@ try:
 except ImportError:
     from ._dummy_thread32 import allocate_lock as Lock
 
+try:
+    from collections.abc import MutableMapping
+except ImportError:
+    from collections import MutableMapping
+
 ################################################################################
 ### OrderedDict
 ################################################################################
diff --git a/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py b/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py
index 0439728d..f4a75eda 100644
--- a/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py
+++ b/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py
@@ -32,6 +32,13 @@ collections_lib = collections
 if sys.version_info > (3, 8):
   collections_lib = collections.abc
 
+try:
+  # Python 3.3 and above.
+  collections_abc = collections.abc
+except AttributeError:
+  collections_abc = collections
+
+
 # --------------------------
 # prediction.common
 # --------------------------
diff --git a/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py b/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py
index d9aaaa4c..1d50fb0c 100644
--- a/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py
+++ b/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py
@@ -27,11 +27,17 @@ Python types and vice-versa.
 import base64
 from decimal import (Decimal, DecimalException, Context,
                      Clamped, Overflow, Inexact, Underflow, Rounded)
-from collections import Mapping
 from boto.dynamodb.exceptions import DynamoDBNumberError
 from boto.compat import filter, map, six, long_type
 
 
+
+try:
+    from collections.abc import Mapping
+except ImportError:
+    from collections import Mapping
+
+
 DYNAMODB_CONTEXT = Context(
     Emin=-128, Emax=126, rounding=None, prec=38,
     traps=[Clamped, Overflow, Inexact, Rounded, Underflow])
diff --git a/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py b/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py
index 687fae74..ae92d087 100644
--- a/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py
+++ b/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py
@@ -29,6 +29,13 @@ import boto.mws.response
 from boto.handler import XmlHandler
 from boto.compat import filter, map, six, encodebytes
 
+try:
+  # Python 3.3 and above.
+  collections_abc = collections.abc
+except AttributeError:
+  collections_abc = collections
+
+
 __all__ = ['MWSConnection']
 
 api_version_path = {
@@ -109,7 +116,7 @@ def http_body(field):
 def destructure_object(value, into, prefix, members=False):
     if isinstance(value, boto.mws.response.ResponseElement):
         destructure_object(value.__dict__, into, prefix, members=members)
-    elif isinstance(value, collections.Mapping):
+    elif isinstance(value, collections_abc.Mapping):
         for name in value:
             if name.startswith('_'):
                 continue