mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Python 3.8 collections compatibility fixes.
Includes a new pylint blacklist plugin to prevent regressions.
This commit is contained in:
parent
c4d1f0d416
commit
a11f631ee4
56 changed files with 317 additions and 104 deletions
|
@ -19,11 +19,11 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import collections
|
||||
import os
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleAssertionError
|
||||
from ansible.module_utils.six import iteritems, binary_type, text_type
|
||||
from ansible.module_utils.common._collections_compat import Container, Mapping, Set, Sequence
|
||||
from ansible.playbook.attribute import FieldAttribute
|
||||
from ansible.playbook.base import Base
|
||||
from ansible.playbook.become import Become
|
||||
|
@ -59,8 +59,8 @@ def hash_params(params):
|
|||
# Any container is unhashable if it contains unhashable items (for
|
||||
# instance, tuple() is a Hashable subclass but if it contains a dict, it
|
||||
# cannot be hashed)
|
||||
if isinstance(params, collections.Container) and not isinstance(params, (text_type, binary_type)):
|
||||
if isinstance(params, collections.Mapping):
|
||||
if isinstance(params, Container) and not isinstance(params, (text_type, binary_type)):
|
||||
if isinstance(params, Mapping):
|
||||
try:
|
||||
# Optimistically hope the contents are all hashable
|
||||
new_params = frozenset(params.items())
|
||||
|
@ -71,7 +71,7 @@ def hash_params(params):
|
|||
new_params.update((k, hash_params(v)))
|
||||
new_params = frozenset(new_params)
|
||||
|
||||
elif isinstance(params, (collections.Set, collections.Sequence)):
|
||||
elif isinstance(params, (Set, Sequence)):
|
||||
try:
|
||||
# Optimistically hope the contents are all hashable
|
||||
new_params = frozenset(params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue