diff --git a/changelogs/fragments/6927-pylint-comments.yml b/changelogs/fragments/6927-pylint-comments.yml new file mode 100644 index 0000000000..495a12eb5a --- /dev/null +++ b/changelogs/fragments/6927-pylint-comments.yml @@ -0,0 +1,3 @@ +minor_changes: + - gitlab_runner - minor refactor removing unnecessary code statements (https://github.com/ansible-collections/community.general/pull/6927). + - keyring - minor refactor removing unnecessary code statements (https://github.com/ansible-collections/community.general/pull/6927). diff --git a/plugins/modules/copr.py b/plugins/modules/copr.py index f60a7b6e66..157a6c1605 100644 --- a/plugins/modules/copr.py +++ b/plugins/modules/copr.py @@ -100,9 +100,9 @@ except ImportError: from ansible.module_utils.common import respawn from ansible.module_utils.six.moves.urllib.error import HTTPError from ansible.module_utils.basic import missing_required_lib -from ansible.module_utils import distro # pylint: disable=import-error -from ansible.module_utils.basic import AnsibleModule # pylint: disable=import-error -from ansible.module_utils.urls import open_url # pylint: disable=import-error +from ansible.module_utils import distro +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import open_url def _respawn_dnf(): diff --git a/plugins/modules/gitlab_runner.py b/plugins/modules/gitlab_runner.py index 2bfb3bf3d7..4bcbedda11 100644 --- a/plugins/modules/gitlab_runner.py +++ b/plugins/modules/gitlab_runner.py @@ -210,13 +210,6 @@ from ansible_collections.community.general.plugins.module_utils.gitlab import ( ) -try: - cmp # pylint: disable=used-before-assignment -except NameError: - def cmp(a, b): - return (a > b) - (a < b) - - class GitLabRunner(object): def __init__(self, module, gitlab_instance, group=None, project=None): self._module = module @@ -302,7 +295,7 @@ class GitLabRunner(object): list1.sort() list2 = arguments[arg_key] list2.sort() - if cmp(list1, list2): + if list1 != list2: setattr(runner, arg_key, arguments[arg_key]) changed = True else: diff --git a/plugins/modules/keyring.py b/plugins/modules/keyring.py index ada22ed581..8329b727bd 100644 --- a/plugins/modules/keyring.py +++ b/plugins/modules/keyring.py @@ -106,7 +106,7 @@ def del_passphrase(module): try: keyring.delete_password(module.params["service"], module.params["username"]) return None - except keyring.errors.KeyringLocked as keyring_locked_err: # pylint: disable=unused-variable + except keyring.errors.KeyringLocked: delete_argument = ( 'echo "%s" | gnome-keyring-daemon --unlock\nkeyring del %s %s\n' % ( @@ -140,7 +140,7 @@ def set_passphrase(module): module.params["user_password"], ) return None - except keyring.errors.KeyringLocked as keyring_locked_err: # pylint: disable=unused-variable + except keyring.errors.KeyringLocked: set_argument = ( 'echo "%s" | gnome-keyring-daemon --unlock\nkeyring set %s %s\n%s\n' % (