Skip to content

Commit 3ba19ac

Browse files
authored
Import stdlib ABCs from 'collections.abc' rather than 'collections'. (#6451)
On Python 2.7, fall back to 'collections'. Closes #6450.
1 parent 61fbea2 commit 3ba19ac

File tree

1 file changed

+6
-2
lines changed
  • packages/google-cloud-core/google/cloud

1 file changed

+6
-2
lines changed

packages/google-cloud-core/google/cloud/iam.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
"""
1919

2020
import collections
21+
try:
22+
from collections import abc as collections_abc
23+
except ImportError: # Python 2.7
24+
import collections as collections_abc
2125
import warnings
2226

2327
# Generic IAM roles
@@ -35,7 +39,7 @@
3539
Assigning to '{}' is deprecated. Replace with 'policy[{}] = members."""
3640

3741

38-
class Policy(collections.MutableMapping):
42+
class Policy(collections_abc.MutableMapping):
3943
"""IAM Policy
4044
4145
See
@@ -239,4 +243,4 @@ def to_api_repr(self):
239243
return resource
240244

241245

242-
collections.MutableMapping.register(Policy)
246+
collections_abc.MutableMapping.register(Policy)

0 commit comments

Comments
 (0)