Replace deprecated import of ABCs from collections

ABCs in collections should be imported from collections.abc and direct
import from collections is deprecated since Python 3.3.

Change-Id: Ifb983fa478120a95760bf0cb78994210acdbe8e8
This commit is contained in:
Takashi Kajinami 2021-07-27 09:04:20 +09:00
parent 2800f0b62c
commit 181d09d05f
1 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import collections
from collections import abc
import random
import re
import string
@ -63,7 +63,7 @@ def pselect(collection, composer):
return helpers.parallel_select(collection, composer)
@specs.parameter('mappings', collections.Mapping)
@specs.parameter('mappings', abc.Mapping)
@specs.extension_method
def bind(obj, mappings):
if isinstance(obj, str) and obj.startswith('$'):
@ -72,7 +72,7 @@ def bind(obj, mappings):
return value
elif utils.is_sequence(obj):
return [bind(t, mappings) for t in obj]
elif isinstance(obj, collections.Mapping):
elif isinstance(obj, abc.Mapping):
result = {}
for key, value in obj.items():
result[bind(key, mappings)] = bind(value, mappings)