mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00: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
|
@ -60,12 +60,12 @@ RETURN = """
|
|||
|
||||
import codecs
|
||||
import csv
|
||||
from collections import MutableSequence
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleAssertionError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.module_utils.six import PY2
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.common._collections_compat import MutableSequence
|
||||
|
||||
|
||||
class CSVRecoder:
|
||||
|
|
|
@ -52,10 +52,10 @@ RETURN = """
|
|||
- list of composed dictonaries with key and value
|
||||
type: list
|
||||
"""
|
||||
import collections
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.module_utils.common._collections_compat import Mapping
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
|
@ -69,7 +69,7 @@ class LookupModule(LookupBase):
|
|||
results = []
|
||||
for term in terms:
|
||||
# Expect any type of Mapping, notably hostvars
|
||||
if not isinstance(term, collections.Mapping):
|
||||
if not isinstance(term, Mapping):
|
||||
raise AnsibleError("with_dict expects a dict")
|
||||
|
||||
results.extend(self._flatten_hash_to_list(term))
|
||||
|
|
|
@ -62,12 +62,12 @@ _raw:
|
|||
"""
|
||||
import os
|
||||
import re
|
||||
from collections import MutableSequence
|
||||
from io import StringIO
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleAssertionError
|
||||
from ansible.module_utils.six.moves import configparser
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.common._collections_compat import MutableSequence
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ RETURN = """
|
|||
_list:
|
||||
description: basically the same as you fed in
|
||||
"""
|
||||
import collections
|
||||
|
||||
from ansible.module_utils.common._collections_compat import Sequence
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.errors import AnsibleError
|
||||
|
||||
|
@ -37,6 +37,6 @@ from ansible.errors import AnsibleError
|
|||
class LookupModule(LookupBase):
|
||||
|
||||
def run(self, terms, **kwargs):
|
||||
if not isinstance(terms, collections.Sequence):
|
||||
if not isinstance(terms, Sequence):
|
||||
raise AnsibleError("with_list expects a list")
|
||||
return terms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue