mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-25 20:11:40 +01:00
Fix pylint's bad-builtin and deprecated-lambda with list comprehension.
This commit is contained in:
parent
6d9f5e6f2a
commit
74d1b5c7b5
@ -103,12 +103,12 @@ class AuditConf(object):
|
|||||||
if len(self.ipvo) == 0:
|
if len(self.ipvo) == 0:
|
||||||
value = (6,) if ipv == 4 else (4,)
|
value = (6,) if ipv == 4 else (4,)
|
||||||
else:
|
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)
|
self.__setattr__('ipvo', value)
|
||||||
elif name == 'ipvo':
|
elif name == 'ipvo':
|
||||||
if isinstance(value, (tuple, list)):
|
if isinstance(value, (tuple, list)):
|
||||||
uniq_value = utils.unique_seq(value)
|
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
|
valid = True
|
||||||
ipv_both = len(value) == 0
|
ipv_both = len(value) == 0
|
||||||
object.__setattr__(self, 'ipv4', ipv_both or 4 in value)
|
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):
|
def _resolve(self, ipvo):
|
||||||
# type: (Sequence[int]) -> Iterable[Tuple[int, Tuple[Any, ...]]]
|
# 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)
|
ipvo_len = len(ipvo)
|
||||||
prefer_ipvo = ipvo_len > 0
|
prefer_ipvo = ipvo_len > 0
|
||||||
prefer_ipv4 = prefer_ipvo and ipvo[0] == 4
|
prefer_ipv4 = prefer_ipvo and ipvo[0] == 4
|
||||||
|
8
tox.ini
8
tox.ini
@ -110,7 +110,13 @@ strict_optional = True
|
|||||||
reports = no
|
reports = no
|
||||||
#output-format = colorized
|
#output-format = colorized
|
||||||
indent-string = \t
|
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-complexity = 15
|
||||||
max-args = 8
|
max-args = 8
|
||||||
max-locals = 20
|
max-locals = 20
|
||||||
|
Loading…
Reference in New Issue
Block a user