Pylint fixes (#80855)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/80892/head
Abhijeet Kasurde 3 years ago committed by GitHub
parent 56f2e65ee7
commit 9f4dfff69b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,8 +11,8 @@ import ansible.module_utils.foo0
results['foo0'] = ansible.module_utils.foo0.data results['foo0'] = ansible.module_utils.foo0.data
# Test depthful import with no from # Test depthful import with no from
import ansible.module_utils.bar0.foo import ansible.module_utils.bar0.foo3
results['bar0'] = ansible.module_utils.bar0.foo.data results['bar0'] = ansible.module_utils.bar0.foo3.data
# Test import of module_utils/foo1.py # Test import of module_utils/foo1.py
from ansible.module_utils import foo1 from ansible.module_utils import foo1

@ -6,9 +6,9 @@ results = {}
# Test that we are rooted correctly # Test that we are rooted correctly
# Following files: # Following files:
# module_utils/yak/zebra/foo.py # module_utils/yak/zebra/foo.py
from ansible.module_utils.zebra import foo from ansible.module_utils.zebra import foo4
results['zebra'] = foo.data results['zebra'] = foo4.data
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
AnsibleModule(argument_spec=dict()).exit_json(**results) AnsibleModule(argument_spec=dict()).exit_json(**results)

@ -47,7 +47,7 @@
assert: assert:
that: that:
- result is failed - result is failed
- result['msg'] == "Could not find imported module support code for ansible.modules.test_failure. Looked for (['ansible.module_utils.zebra.foo', 'ansible.module_utils.zebra'])" - result['msg'] == "Could not find imported module support code for ansible.modules.test_failure. Looked for (['ansible.module_utils.zebra.foo4', 'ansible.module_utils.zebra'])"
- name: Test that alias deprecation works - name: Test that alias deprecation works
test_alias_deprecation: test_alias_deprecation:

@ -137,8 +137,6 @@ test/integration/targets/module_precedence/lib_with_extension/ping.ini shebang
test/integration/targets/module_precedence/roles_with_extension/foo/library/a.ini shebang test/integration/targets/module_precedence/roles_with_extension/foo/library/a.ini shebang
test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.ini shebang test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.ini shebang
test/integration/targets/module_utils/library/test.py future-import-boilerplate # allow testing of Python 2.x implicit relative imports test/integration/targets/module_utils/library/test.py future-import-boilerplate # allow testing of Python 2.x implicit relative imports
test/integration/targets/module_utils/module_utils/bar0/foo.py pylint:disallowed-name
test/integration/targets/module_utils/module_utils/yak/zebra/foo.py pylint:disallowed-name
test/integration/targets/old_style_modules_posix/library/helloworld.sh shebang test/integration/targets/old_style_modules_posix/library/helloworld.sh shebang
test/integration/targets/template/files/encoding_1252_utf-8.expected no-smart-quotes test/integration/targets/template/files/encoding_1252_utf-8.expected no-smart-quotes
test/integration/targets/template/files/encoding_1252_windows-1252.expected no-smart-quotes test/integration/targets/template/files/encoding_1252_windows-1252.expected no-smart-quotes
@ -158,18 +156,12 @@ test/integration/targets/win_script/files/test_script_with_splatting.ps1 pslint:
test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 pslint:PSCustomUseLiteralPath # Uses wildcards on purpose test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 pslint:PSCustomUseLiteralPath # Uses wildcards on purpose
test/lib/ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1 pslint:PSCustomUseLiteralPath test/lib/ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1 pslint:PSCustomUseLiteralPath
test/lib/ansible_test/_util/target/setup/requirements.py replace-urlopen test/lib/ansible_test/_util/target/setup/requirements.py replace-urlopen
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py pylint:pointless-string-statement
test/support/integration/plugins/modules/timezone.py pylint:disallowed-name
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py no-unicode-literals test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py no-unicode-literals
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py pylint:unnecessary-comprehension
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py pylint:use-a-generator test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py pylint:use-a-generator
test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py pylint:arguments-renamed test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py pylint:arguments-renamed
test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py pep8:E501 test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py pep8:E501
test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py pylint:used-before-assignment
test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py pylint:arguments-renamed test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py pylint:arguments-renamed
test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py pep8:E231 test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py pep8:E231
test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py pylint:disallowed-name
test/support/windows-integration/plugins/action/win_copy.py pylint:used-before-assignment
test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/module_utils/WebRequest.psm1 pslint!skip test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/module_utils/WebRequest.psm1 pslint!skip
test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_uri.ps1 pslint!skip test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/modules/win_uri.ps1 pslint!skip
test/support/windows-integration/plugins/modules/async_status.ps1 pslint!skip test/support/windows-integration/plugins/modules/async_status.ps1 pslint!skip

@ -121,7 +121,7 @@ class Timezone(object):
# running in the global zone where changing the timezone has no effect. # running in the global zone where changing the timezone has no effect.
zonename_cmd = module.get_bin_path('zonename') zonename_cmd = module.get_bin_path('zonename')
if zonename_cmd is not None: if zonename_cmd is not None:
(rc, stdout, _) = module.run_command(zonename_cmd) (rc, stdout, stderr) = module.run_command(zonename_cmd)
if rc == 0 and stdout.strip() == 'global': if rc == 0 and stdout.strip() == 'global':
module.fail_json(msg='Adjusting timezone is not supported in Global Zone') module.fail_json(msg='Adjusting timezone is not supported in Global Zone')
@ -731,7 +731,7 @@ class BSDTimezone(Timezone):
# Strategy 3: # Strategy 3:
# (If /etc/localtime is not symlinked) # (If /etc/localtime is not symlinked)
# Check all files in /usr/share/zoneinfo and return first non-link match. # Check all files in /usr/share/zoneinfo and return first non-link match.
for dname, _, fnames in sorted(os.walk(zoneinfo_dir)): for dname, dirs, fnames in sorted(os.walk(zoneinfo_dir)):
for fname in sorted(fnames): for fname in sorted(fnames):
zoneinfo_file = os.path.join(dname, fname) zoneinfo_file = os.path.join(dname, fname)
if not os.path.islink(zoneinfo_file) and filecmp.cmp(zoneinfo_file, localtime_file): if not os.path.islink(zoneinfo_file) and filecmp.cmp(zoneinfo_file, localtime_file):

@ -1310,7 +1310,6 @@ class Connection(NetworkConnectionBase):
remote host before triggering timeout exception remote host before triggering timeout exception
:return: None :return: None
""" """
"""Fetch file over scp/sftp from remote device"""
ssh = self.ssh_type_conn._connect_uncached() ssh = self.ssh_type_conn._connect_uncached()
if self.ssh_type == "libssh": if self.ssh_type == "libssh":
self.ssh_type_conn.fetch_file(source, destination, proto=proto) self.ssh_type_conn.fetch_file(source, destination, proto=proto)

@ -79,7 +79,7 @@ class FactsBase(object):
self._module.fail_json( self._module.fail_json(
msg="Subset must be one of [%s], got %s" msg="Subset must be one of [%s], got %s"
% ( % (
", ".join(sorted([item for item in valid_subsets])), ", ".join(sorted(list(valid_subsets))),
subset, subset,
) )
) )

@ -575,6 +575,7 @@ def main():
) )
if running_config.sha1 != base_config.sha1: if running_config.sha1 != base_config.sha1:
before, after = "", ""
if module.params["diff_against"] == "intended": if module.params["diff_against"] == "intended":
before = running_config before = running_config
after = base_config after = base_config

@ -192,7 +192,7 @@ def main():
interval = module.params["interval"] interval = module.params["interval"]
match = module.params["match"] match = module.params["match"]
for _ in range(retries): for dummy in range(retries):
responses = run_commands(module, commands) responses = run_commands(module, commands)
for item in list(conditionals): for item in list(conditionals):

@ -439,7 +439,7 @@ class ActionModule(ActionBase):
source_full = self._loader.get_real_file(source, decrypt=decrypt) source_full = self._loader.get_real_file(source, decrypt=decrypt)
except AnsibleFileNotFound as e: except AnsibleFileNotFound as e:
result['failed'] = True result['failed'] = True
result['msg'] = "could not find src=%s, %s" % (source_full, to_text(e)) result['msg'] = "could not find src=%s, %s" % (source, to_text(e))
return result return result
original_basename = os.path.basename(source) original_basename = os.path.basename(source)

Loading…
Cancel
Save