Clean up unused imports in integration tests (#79895)

pull/79896/head
Matt Clay 2 years ago committed by GitHub
parent e69ef1b249
commit 7495070b83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,6 @@ DOCUMENTATION = '''
required: True
'''
from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable

@ -19,7 +19,6 @@ DOCUMENTATION = '''
required: True
'''
from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable

@ -2,7 +2,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import sys
import ansible_runner

@ -16,10 +16,10 @@ RETURN = '''#'''
from ansible.plugins.lookup import LookupBase
# noinspection PyUnresolvedReferences
from ansible.plugins import loader # import the loader to verify it works when the collection loader has already been loaded
from ansible.plugins import loader # import the loader to verify it works when the collection loader has already been loaded # pylint: disable=unused-import
try:
import demo
import demo # pylint: disable=unused-import
except ImportError:
pass
else:

@ -16,10 +16,10 @@ RETURN = '''#'''
from ansible.plugins.lookup import LookupBase
# noinspection PyUnresolvedReferences
from ansible.plugins import loader # import the loader to verify it works when the collection loader has already been loaded
from ansible.plugins import loader # import the loader to verify it works when the collection loader has already been loaded # pylint: disable=unused-import
try:
import demo
import demo # pylint: disable=unused-import
except ImportError:
pass
else:

@ -19,9 +19,9 @@ EXAMPLES = '''
RETURN = ''' # '''
from ansible.plugins.lookup import LookupBase
from ansible import constants
from ansible import constants # pylint: disable=unused-import
import lxml
import lxml # pylint: disable=unused-import
class LookupModule(LookupBase):

@ -19,7 +19,7 @@ EXAMPLES = '''
RETURN = ''' # '''
from ansible.plugins.lookup import LookupBase
from ansible import constants
from ansible import constants # pylint: disable=unused-import
class LookupModule(LookupBase):

@ -19,7 +19,7 @@ EXAMPLES = '''
RETURN = ''''''
from ansible.module_utils.basic import AnsibleModule
from ansible import constants # intentionally trigger pylint ansible-bad-module-import error
from ansible import constants # intentionally trigger pylint ansible-bad-module-import error # pylint: disable=unused-import
def main():

@ -9,7 +9,7 @@ __metaclass__ = type
# syntax-error: Cannot import 'string' due to syntax error 'invalid syntax (<unknown>, line 109)'
# Python 3.9 fails with astroid 2.2.5 but works on 2.3.3
# syntax-error: Cannot import 'string' due to syntax error 'invalid syntax (<unknown>, line 104)'
import string
import string # pylint: disable=unused-import
# Python 3.9 fails with pylint 2.3.1 or 2.4.4 with astroid 2.3.3 but works with pylint 2.5.0 and astroid 2.4.0
# 'Call' object has no attribute 'value'

@ -5,4 +5,4 @@ __metaclass__ = type
# This is not an allowed import, but since this file is in a plugins/ subdirectory that is not checked,
# the import sanity test will not complain.
import lxml
import lxml # pylint: disable=unused-import

@ -4,12 +4,12 @@ __metaclass__ = type
import tempfile
try:
import urllib2 # intentionally trigger pylint ansible-bad-import error
import urllib2 # intentionally trigger pylint ansible-bad-import error # pylint: disable=unused-import
except ImportError:
urllib2 = None
try:
from urllib2 import Request # intentionally trigger pylint ansible-bad-import-from error
from urllib2 import Request # intentionally trigger pylint ansible-bad-import-from error # pylint: disable=unused-import
except ImportError:
Request = None

@ -2,10 +2,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
from ..module_utils import bogusmu # pylint: disable=relative-beyond-top-level
from ..module_utils import bogusmu # pylint: disable=relative-beyond-top-level,unused-import
def main():

@ -2,10 +2,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
from ..module_utils import missing_redirect_target_collection # pylint: disable=relative-beyond-top-level
from ..module_utils import missing_redirect_target_collection # pylint: disable=relative-beyond-top-level,unused-import
def main():

@ -2,10 +2,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
from ..module_utils import missing_redirect_target_module # pylint: disable=relative-beyond-top-level
from ..module_utils import missing_redirect_target_module # pylint: disable=relative-beyond-top-level,unused-import
def main():

@ -19,7 +19,6 @@ DOCUMENTATION = '''
required: True
'''
from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable

@ -14,7 +14,6 @@ DOCUMENTATION = '''
- Enable in configuration.
'''
from ansible import constants as C
from ansible.plugins.callback import CallbackBase

@ -1,7 +1,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pkg_resources
import pkg_resources # pylint: disable=unused-import
from ansible.plugins.lookup import LookupBase

@ -11,7 +11,6 @@ DOCUMENTATION = """
version_added: "2.0"
options: {}
"""
import ansible.constants as C
from ansible.errors import AnsibleError
from ansible.plugins.connection import ConnectionBase

@ -1,9 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.facts.utils import (
get_file_content,

@ -8,7 +8,7 @@ __metaclass__ = type
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
try:
import ansible_missing_lib
import ansible_missing_lib # pylint: disable=unused-import
HAS_LIB = True
except ImportError as e:
HAS_LIB = False

@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action.normal import ActionModule as ActionBase
from ansible.utils.vars import merge_hash
class ActionModule(ActionBase):

@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action.normal import ActionModule as ActionBase
from ansible.utils.vars import merge_hash
class ActionModule(ActionBase):

@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action.normal import ActionModule as ActionBase
from ansible.utils.vars import merge_hash
class ActionModule(ActionBase):

@ -44,7 +44,6 @@ DOCUMENTATION = '''
import time
import json
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.plugins.cache import BaseCacheModule

@ -11,7 +11,7 @@ __metaclass__ = type
# noinspection PyUnresolvedReferences
try:
from pkg_resources import Requirement
from pkg_resources import Requirement # pylint: disable=unused-import
except ImportError:
Requirement = None

@ -9,7 +9,6 @@ __metaclass__ = type
import os
import resource
import signal
import sys
import time
UMASK = 0

@ -14,7 +14,6 @@ import stat
import subprocess
import tempfile
import yaml
from pprint import pprint
from optparse import OptionParser
from jinja2 import Environment

@ -1,8 +1,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError, AnsibleFilterError
def filter_list_of_tuples_by_first_param(lst, search, startswith=False):
out = []

Loading…
Cancel
Save