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