Skip to content

Commit 54b0960

Browse files
committed
Upgrade to Mypy 0.470. Add colorama stub. Fix identation.
1 parent c9443e6 commit 54b0960

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

ssh-audit.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,16 +1267,17 @@ def values(self):
12671267
def maxlen(self):
12681268
# type: () -> int
12691269
ml, maxlen = lambda l: max(len(i) for i in l), 0
1270+
# type: Callable[[Sequence[text_type]], int], int
12701271
if self.ssh1kex is not None:
12711272
maxlen = max(ml(self.ssh1kex.supported_ciphers),
1272-
ml(self.ssh1kex.supported_authentications),
1273-
maxlen)
1273+
ml(self.ssh1kex.supported_authentications),
1274+
maxlen)
12741275
if self.ssh2kex is not None:
12751276
maxlen = max(ml(self.ssh2kex.kex_algorithms),
1276-
ml(self.ssh2kex.key_algorithms),
1277-
ml(self.ssh2kex.server.encryption),
1278-
ml(self.ssh2kex.server.mac),
1279-
maxlen)
1277+
ml(self.ssh2kex.key_algorithms),
1278+
ml(self.ssh2kex.server.encryption),
1279+
ml(self.ssh2kex.server.mac),
1280+
maxlen)
12801281
return maxlen
12811282

12821283
def get_ssh_timeframe(self, for_server=True):
@@ -1298,8 +1299,8 @@ def get_recommendations(self, software, for_server=True):
12981299
# type: (Optional[SSH.Software], bool) -> Tuple[Optional[SSH.Software], Dict[int, Dict[str, Dict[str, Dict[str, int]]]]]
12991300
# pylint: disable=too-many-locals,too-many-statements
13001301
vproducts = [SSH.Product.OpenSSH,
1301-
SSH.Product.DropbearSSH,
1302-
SSH.Product.LibSSH]
1302+
SSH.Product.DropbearSSH,
1303+
SSH.Product.LibSSH]
13031304
if software is not None:
13041305
if software.product not in vproducts:
13051306
software = None

test/mypy-py2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ if [ $? -ne 0 ]; then
77
fi
88
_htmldir="${_cdir}/../html/mypy-py2"
99
mkdir -p "${_htmldir}"
10-
mypy --python-version 2.7 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py"
10+
env MYPYPATH="${_cdir}/stubs/" mypy --python-version 2.7 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py"

test/mypy-py3.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ if [ $? -ne 0 ]; then
77
fi
88
_htmldir="${_cdir}/../html/mypy-py3"
99
mkdir -p "${_htmldir}"
10-
mypy --python-version 3.5 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py"
10+
env MYPYPATH="${_cdir}/stubs/" mypy --python-version 3.5 --strict-optional --config-file "${_cdir}/mypy.ini" --html-report "${_htmldir}" "${_cdir}/../ssh-audit.py"

test/mypy.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[mypy]
2-
silent_imports = True
2+
ignore_missing_imports = False
3+
follow_imports = error
34
disallow_untyped_calls = True
45
disallow_untyped_defs = True
56
check_untyped_defs = True
67
disallow-subclassing-any = True
78
warn-incomplete-stub = True
89
warn-redundant-casts = True
9-

test/stubs/colorama.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from typing import Optional
4+
5+
def init(autoreset: bool = False, convert: Optional[bool] = None, strip: Optional[bool] = None, wrap: bool = True) -> None: ...
6+

0 commit comments

Comments
 (0)