From ac9e7c0b6e61731306997aab49d074adc0faf58c Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 11 Aug 2020 15:11:50 +0200 Subject: [PATCH] check_files.py: pass mypy Add enough type annotations to pass mypy 0.782 with Python 3.5. The source code will still run normally under older Python versions. Signed-off-by: Gilles Peskine --- tests/scripts/check_files.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py index 09ab615ab..8857e0021 100755 --- a/tests/scripts/check_files.py +++ b/tests/scripts/check_files.py @@ -29,6 +29,10 @@ import codecs import re import subprocess import sys +try: + from typing import FrozenSet, Optional, Pattern # pylint: disable=unused-import +except ImportError: + pass class FileIssueTracker: @@ -48,8 +52,8 @@ class FileIssueTracker: ``heading``: human-readable description of the issue """ - suffix_exemptions = frozenset() - path_exemptions = None + suffix_exemptions = frozenset() #type: FrozenSet[str] + path_exemptions = None #type: Optional[Pattern[str]] # heading must be defined in derived classes. # pylint: disable=no-member