From 74d1b5c7b513e8f5a6c1a74c433d695ffa4f55f1 Mon Sep 17 00:00:00 2001 From: Andris Raugulis Date: Sun, 26 Mar 2017 05:54:14 +0300 Subject: [PATCH] Fix pylint's bad-builtin and deprecated-lambda with list comprehension. --- ssh-audit.py | 6 +++--- tox.ini | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ssh-audit.py b/ssh-audit.py index 3aaada7..d04c567 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -103,12 +103,12 @@ class AuditConf(object): if len(self.ipvo) == 0: value = (6,) if ipv == 4 else (4,) else: - value = tuple(filter(lambda x: x != ipv, self.ipvo)) + value = tuple([x for x in self.ipvo if x != ipv]) self.__setattr__('ipvo', value) elif name == 'ipvo': if isinstance(value, (tuple, list)): uniq_value = utils.unique_seq(value) - value = tuple(filter(lambda x: x in (4, 6), uniq_value)) + value = tuple([x for x in uniq_value if x in (4, 6)]) valid = True ipv_both = len(value) == 0 object.__setattr__(self, 'ipv4', ipv_both or 4 in value) @@ -1536,7 +1536,7 @@ class SSH(object): # pylint: disable=too-few-public-methods def _resolve(self, ipvo): # type: (Sequence[int]) -> Iterable[Tuple[int, Tuple[Any, ...]]] - ipvo = tuple(filter(lambda x: x in (4, 6), utils.unique_seq(ipvo))) + ipvo = tuple([x for x in utils.unique_seq(ipvo) if x in (4, 6)]) ipvo_len = len(ipvo) prefer_ipvo = ipvo_len > 0 prefer_ipv4 = prefer_ipvo and ipvo[0] == 4 diff --git a/tox.ini b/tox.ini index 16ba685..9119720 100644 --- a/tox.ini +++ b/tox.ini @@ -110,7 +110,13 @@ strict_optional = True reports = no #output-format = colorized indent-string = \t -disable = locally-disabled, bad-continuation, multiple-imports, invalid-name, trailing-whitespace, missing-docstring +disable = + locally-disabled, + bad-continuation, + multiple-imports, + invalid-name, + trailing-whitespace, + missing-docstring max-complexity = 15 max-args = 8 max-locals = 20