From b6705e0373cac3111d1316070d71f26db09b3f63 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 23 Feb 2022 17:16:19 +0100 Subject: link github issues --- check_checkers.py | 28 ++++++++++++++++++++-------- issues.toml | 7 +++++++ requirements.txt | 6 ++++++ 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 issues.toml diff --git a/check_checkers.py b/check_checkers.py index 8ce03fa..65d1eec 100755 --- a/check_checkers.py +++ b/check_checkers.py @@ -13,6 +13,7 @@ import mypy.api from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import PythonLexer +import tomli Error = Tuple[str, int, str] @@ -156,10 +157,13 @@ def run( default_typeshed: str, out: TextIO, cache: Dict[str, Puzzle], + issues: Dict[str, Dict[str, str]], ): python_lexer = PythonLexer() html_formatter = HtmlFormatter(noclasses=True, linenos='table') - out.write("Comparison of static type checkers for Python") + out.write( + "Comparison of static type checkers for Python" + ) out.write( '''

This page compares three static type checkers for Python. The red background indicates that the checker @@ -201,13 +205,8 @@ def run( for checker in checkers: errors = checker_results[checker.__class__.__name__] - out.write( - ''.format( - 'ok' - if (errors and error_ok) or (not errors and no_error_ok) - else 'unexpected' - ) - ) + expected = (errors and error_ok) or (not errors and no_error_ok) + out.write(''.format('ok' if expected else 'unexpected')) if errors: out.write('

') else: out.write('
no errors found') + if not expected: + checker_issues = issues.get(checker.__class__.__name__.lower(), {}) + issue = checker_issues.get( + os.path.splitext(os.path.basename(puzzle))[0] + ) + if issue: + out.write('
(') + out.write(issue) + out.write(')') out.write('') @@ -230,6 +238,9 @@ if __name__ == '__main__': except FileNotFoundError: cache = {} + with open('issues.toml', 'rb') as f: + issues = tomli.load(f) + with open('dist/checkers.html', 'w') as f: run( [Mypy(), Pytype(), Pyright()], @@ -237,6 +248,7 @@ if __name__ == '__main__': typeshed, f, cache, + issues, ) with open('cache.json', 'w') as f: diff --git a/issues.toml b/issues.toml new file mode 100644 index 0000000..a840797 --- /dev/null +++ b/issues.toml @@ -0,0 +1,7 @@ +[mypy] +infer_return_basic = "mypy intentionally treats unannotated functions as returning Any" +tricky_recursive = 'issue 731' +tricky_typevar_constrained = 'issue 11880' + +[pytype] +tricky_enum = 'issue 790' diff --git a/requirements.txt b/requirements.txt index bb5abe7..4d9646f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,9 @@ pyserde==0.7.0 serdelicacy==0.18.1 typedload==2.15 typical==2.8.0 + +pytype==2022.1.13 +mypy==0.931 + +pygments==2.11.1 +tomli==1.2.3 -- cgit v1.2.3