diff --git a/lib/ansible/module_utils/compat/ipaddress.py b/lib/ansible/module_utils/compat/ipaddress.py index 21a1b576fedb76..d6e781b926c4eb 100644 --- a/lib/ansible/module_utils/compat/ipaddress.py +++ b/lib/ansible/module_utils/compat/ipaddress.py @@ -346,7 +346,7 @@ def _find_address_range(addresses): """ it = iter(addresses) - first = last = next(it) + first = last = next(it) # pylint: disable=stop-iteration-return for ip in it: if ip._ip != last._ip + 1: yield first, last diff --git a/lib/ansible/module_utils/pycompat24.py b/lib/ansible/module_utils/pycompat24.py index bcdf53aec5872e..70d0c38eeb3b4b 100644 --- a/lib/ansible/module_utils/pycompat24.py +++ b/lib/ansible/module_utils/pycompat24.py @@ -81,7 +81,7 @@ def _convert(node): if node.name in _safe_names: return _safe_names[node.name] elif isinstance(node, ast.UnarySub): - return -_convert(node.expr) + return -_convert(node.expr) # pylint: disable=invalid-unary-operand-type raise ValueError('malformed string') return _convert(node_or_string) diff --git a/lib/ansible/modules/clustering/consul_kv.py b/lib/ansible/modules/clustering/consul_kv.py index 0d7b1d1dba64b5..dcd46fc0c47e10 100644 --- a/lib/ansible/modules/clustering/consul_kv.py +++ b/lib/ansible/modules/clustering/consul_kv.py @@ -233,7 +233,7 @@ def set_value(module): value = module.params.get('value') if value is NOT_SET: - raise AssertionError('Cannot set value of "%s" to `NOT_SET`', (key, )) + raise AssertionError('Cannot set value of "%s" to `NOT_SET`' % key) index, changed = _has_value_changed(consul_api, key, value) diff --git a/lib/ansible/modules/network/cnos/cnos_backup.py b/lib/ansible/modules/network/cnos/cnos_backup.py index 6088ccd8767eab..a303cac9c0d3a9 100644 --- a/lib/ansible/modules/network/cnos/cnos_backup.py +++ b/lib/ansible/modules/network/cnos/cnos_backup.py @@ -213,7 +213,7 @@ def doConfigBackUp(module, prompt, answer): elif(protocol == "tftp"): command = "copy " + configType + " " + protocol + " " + protocol command = command + "://" + server + "/" + confPath - command = command + + " vrf management\n" + command = command + " vrf management\n" # cnos.debugOutput(command) tftp_cmd = [{'command': command, 'prompt': None, 'answer': None}] cmd.extend(tftp_cmd) diff --git a/lib/ansible/modules/network/cnos/cnos_image.py b/lib/ansible/modules/network/cnos/cnos_image.py index d7da989cd80342..fb17b1502488e8 100644 --- a/lib/ansible/modules/network/cnos/cnos_image.py +++ b/lib/ansible/modules/network/cnos/cnos_image.py @@ -175,7 +175,7 @@ def doImageDownload(module, prompt, answer): elif(protocol == "tftp"): command = "copy " + protocol + " " + protocol + "://" + server command = command + "/" + imgPath + " system-image " + imgType - command = command + + " vrf management" + command = command + " vrf management" prompt = ['Confirm download operation', 'Do you want to change that to the standby image'] answer = ['y', 'y'] diff --git a/lib/ansible/modules/packaging/os/apt_repository.py b/lib/ansible/modules/packaging/os/apt_repository.py index 2d4a658822f56b..86f6322147098c 100644 --- a/lib/ansible/modules/packaging/os/apt_repository.py +++ b/lib/ansible/modules/packaging/os/apt_repository.py @@ -184,7 +184,6 @@ def __iter__(self): for n, valid, enabled, source, comment in sources: if valid: yield file, n, enabled, source, comment - raise StopIteration def _expand_path(self, filename): if '/' in filename: diff --git a/lib/ansible/modules/storage/netapp/netapp_e_storagepool.py b/lib/ansible/modules/storage/netapp/netapp_e_storagepool.py index daa63084c41675..d98cecbd2dcf97 100644 --- a/lib/ansible/modules/storage/netapp/netapp_e_storagepool.py +++ b/lib/ansible/modules/storage/netapp/netapp_e_storagepool.py @@ -145,7 +145,10 @@ def next(self): def _grouper(self, tgtkey): while self.currkey == tgtkey: yield self.currvalue - self.currvalue = next(self.it) # Exit on StopIteration + try: + self.currvalue = next(self.it) # Exit on StopIteration + except StopIteration: + return self.currkey = self.keyfunc(self.currvalue) diff --git a/test/sanity/pylint/config/default b/test/sanity/pylint/config/default index 027f0eda303e59..b2d24189509c0d 100644 --- a/test/sanity/pylint/config/default +++ b/test/sanity/pylint/config/default @@ -46,7 +46,6 @@ disable= invalid-envvar-default, invalid-name, invalid-sequence-index, - invalid-unary-operand-type, keyword-arg-before-vararg, len-as-condition, line-too-long, @@ -71,7 +70,6 @@ disable= pointless-string-statement, possibly-unused-variable, protected-access, - raising-format-tuple, redefined-argument-from-local, redefined-builtin, redefined-outer-name, @@ -80,7 +78,6 @@ disable= relative-import, signature-differs, simplifiable-if-statement, - stop-iteration-return, subprocess-popen-preexec-fn, super-init-not-called, superfluous-parens,