From 9ee44013c51fa71697145514c9165b11a64446f4 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Tue, 27 Oct 2020 12:14:19 -0400 Subject: [PATCH] library: remove unused module import Move the import at the top of the file and remove unused module import. - E402 module level import not at top of file - F401 'xxxx' imported but unused This also removes the '# noqa E402' statement from the code. Signed-off-by: Dimitri Savineau (cherry picked from commit 2138a00a3294b222d5e8325495300841ed5a7f5f) --- library/ceph_dashboard_user.py | 12 +++++------- library/ceph_fs.py | 12 +++++------- library/ceph_key.py | 20 +++++++++----------- library/ceph_pool.py | 12 +++++------- library/ceph_volume.py | 4 +--- library/radosgw_realm.py | 11 ++++------- library/radosgw_user.py | 12 +++++------- library/radosgw_zone.py | 12 +++++------- library/radosgw_zonegroup.py | 12 +++++------- 9 files changed, 44 insertions(+), 63 deletions(-) diff --git a/library/ceph_dashboard_user.py b/library/ceph_dashboard_user.py index 6f682a05a..ba94f83bb 100644 --- a/library/ceph_dashboard_user.py +++ b/library/ceph_dashboard_user.py @@ -15,6 +15,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -103,13 +108,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image, interactive=False): ''' diff --git a/library/ceph_fs.py b/library/ceph_fs.py index 46413a021..942d618a4 100644 --- a/library/ceph_fs.py +++ b/library/ceph_fs.py @@ -15,6 +15,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -91,13 +96,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image): ''' diff --git a/library/ceph_key.py b/library/ceph_key.py index d2bcf9013..c8ec768fb 100644 --- a/library/ceph_key.py +++ b/library/ceph_key.py @@ -17,6 +17,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os +import struct +import time +import base64 +import socket + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -175,17 +184,6 @@ caps: RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import grp # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import pwd # noqa: E402 -import stat # noqa: E402 -import struct # noqa: E402 -import time # noqa: E402 -import base64 # noqa: E402 -import socket # noqa: E402 CEPH_INITIAL_KEYS = ['client.admin', 'client.bootstrap-mds', 'client.bootstrap-mgr', # noqa: E501 'client.bootstrap-osd', 'client.bootstrap-rbd', 'client.bootstrap-rbd-mirror', 'client.bootstrap-rgw'] # noqa: E501 diff --git a/library/ceph_pool.py b/library/ceph_pool.py index 05e8ee2c6..69804930e 100644 --- a/library/ceph_pool.py +++ b/library/ceph_pool.py @@ -17,6 +17,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -135,13 +140,6 @@ pools: RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image): ''' diff --git a/library/ceph_volume.py b/library/ceph_volume.py index eb7088c8d..7de6d8ee5 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -1,5 +1,6 @@ #!/usr/bin/python +from ansible.module_utils.basic import AnsibleModule import datetime import copy import json @@ -185,9 +186,6 @@ EXAMPLES = ''' ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 - - def fatal(message, module): ''' Report a fatal error and exit diff --git a/library/radosgw_realm.py b/library/radosgw_realm.py index 788ad1ea4..282311388 100644 --- a/library/radosgw_realm.py +++ b/library/radosgw_realm.py @@ -15,6 +15,10 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -81,13 +85,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image): ''' diff --git a/library/radosgw_user.py b/library/radosgw_user.py index dc2670805..047040ac3 100644 --- a/library/radosgw_user.py +++ b/library/radosgw_user.py @@ -15,6 +15,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -129,13 +134,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image): ''' diff --git a/library/radosgw_zone.py b/library/radosgw_zone.py index 6184151be..23558befb 100644 --- a/library/radosgw_zone.py +++ b/library/radosgw_zone.py @@ -15,6 +15,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -114,13 +119,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def fatal(message, module): ''' diff --git a/library/radosgw_zonegroup.py b/library/radosgw_zonegroup.py index 0073d8d7a..1c8aeb339 100644 --- a/library/radosgw_zonegroup.py +++ b/library/radosgw_zonegroup.py @@ -15,6 +15,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +import datetime +import json +import os + ANSIBLE_METADATA = { 'metadata_version': '1.1', @@ -101,13 +106,6 @@ EXAMPLES = ''' RETURN = '''# ''' -from ansible.module_utils.basic import AnsibleModule # noqa: E402 -import datetime # noqa: E402 -import json # noqa: E402 -import os # noqa: E402 -import stat # noqa: E402 -import time # noqa: E402 - def container_exec(binary, container_image): '''