diff --git a/ssh-audit.py b/ssh-audit.py index 274778f..e406567 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -1267,16 +1267,17 @@ class SSH(object): # pylint: disable=too-few-public-methods def maxlen(self): # type: () -> int ml, maxlen = lambda l: max(len(i) for i in l), 0 + # type: Callable[[Sequence[text_type]], int], int if self.ssh1kex is not None: maxlen = max(ml(self.ssh1kex.supported_ciphers), - ml(self.ssh1kex.supported_authentications), - maxlen) + ml(self.ssh1kex.supported_authentications), + maxlen) if self.ssh2kex is not None: maxlen = max(ml(self.ssh2kex.kex_algorithms), - ml(self.ssh2kex.key_algorithms), - ml(self.ssh2kex.server.encryption), - ml(self.ssh2kex.server.mac), - maxlen) + ml(self.ssh2kex.key_algorithms), + ml(self.ssh2kex.server.encryption), + ml(self.ssh2kex.server.mac), + maxlen) return maxlen def get_ssh_timeframe(self, for_server=True): @@ -1298,8 +1299,8 @@ class SSH(object): # pylint: disable=too-few-public-methods # type: (Optional[SSH.Software], bool) -> Tuple[Optional[SSH.Software], Dict[int, Dict[str, Dict[str, Dict[str, int]]]]] # pylint: disable=too-many-locals,too-many-statements vproducts = [SSH.Product.OpenSSH, - SSH.Product.DropbearSSH, - SSH.Product.LibSSH] + SSH.Product.DropbearSSH, + SSH.Product.LibSSH] if software is not None: if software.product not in vproducts: software = None diff --git a/test/mypy-py2.sh b/test/mypy-py2.sh index 766eb59..2da29f5 100755 --- a/test/mypy-py2.sh +++ b/test/mypy-py2.sh @@ -7,4 +7,4 @@ if [ $? -ne 0 ]; then fi _htmldir="${_cdir}/../html/mypy-py2" mkdir -p "${_htmldir}" -mypy --python-version 2.7 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" +env MYPYPATH="${_cdir}/stubs/" mypy --python-version 2.7 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" diff --git a/test/mypy-py3.sh b/test/mypy-py3.sh index c77ca4b..0b7f27c 100755 --- a/test/mypy-py3.sh +++ b/test/mypy-py3.sh @@ -7,4 +7,4 @@ if [ $? -ne 0 ]; then fi _htmldir="${_cdir}/../html/mypy-py3" mkdir -p "${_htmldir}" -mypy --python-version 3.5 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" +env MYPYPATH="${_cdir}/stubs/" mypy --python-version 3.5 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py" diff --git a/test/mypy.ini b/test/mypy.ini index 9c0a3e0..f4190cd 100644 --- a/test/mypy.ini +++ b/test/mypy.ini @@ -1,9 +1,9 @@ [mypy] -silent_imports = True +ignore_missing_imports = False +follow_imports = error disallow_untyped_calls = True disallow_untyped_defs = True check_untyped_defs = True disallow-subclassing-any = True warn-incomplete-stub = True warn-redundant-casts = True - diff --git a/test/stubs/colorama.pyi b/test/stubs/colorama.pyi new file mode 100644 index 0000000..81d6ef0 --- /dev/null +++ b/test/stubs/colorama.pyi @@ -0,0 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from typing import Optional + +def init(autoreset: bool = False, convert: Optional[bool] = None, strip: Optional[bool] = None, wrap: bool = True) -> None: ... +