From b48b5500593810cfad801d976d814df5b07f508c Mon Sep 17 00:00:00 2001 From: apalala Date: Fri, 13 Oct 2023 12:26:08 -0400 Subject: [PATCH] [lint] solve linter and mypy warnings --- mypy.ini | 2 +- tatsu/bootstrap.py | 1 - tatsu/codegen/python.py | 1 - test/grammar/alerts_test.py | 2 +- test/grammar/constants_test.py | 6 +++--- test/grammar/defines_test.py | 4 ++-- test/grammar/keyword_test.py | 2 +- test/parser_equivalence_test.py | 6 +++--- 8 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mypy.ini b/mypy.ini index 0dacb264..aa219d82 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,4 @@ [mypy] -python_version = 3.9 +python_version = 3.12 ignore_missing_imports = True exclude = parsers|docs|build|tmp diff --git a/tatsu/bootstrap.py b/tatsu/bootstrap.py index 5bcc3682..e4dce249 100644 --- a/tatsu/bootstrap.py +++ b/tatsu/bootstrap.py @@ -11,7 +11,6 @@ import sys -from tatsu.buffering import Buffer from tatsu.parsing import Parser from tatsu.parsing import tatsumasu from tatsu.parsing import leftrec, nomemo, isname # noqa diff --git a/tatsu/codegen/python.py b/tatsu/codegen/python.py index 3f35c9b7..31d57264 100755 --- a/tatsu/codegen/python.py +++ b/tatsu/codegen/python.py @@ -519,7 +519,6 @@ def {name}(self, ast): # noqa import sys - from tatsu.buffering import Buffer from tatsu.parsing import Parser from tatsu.parsing import tatsumasu from tatsu.parsing import leftrec, nomemo, isname # noqa diff --git a/test/grammar/alerts_test.py b/test/grammar/alerts_test.py index 636ad335..263711df 100644 --- a/test/grammar/alerts_test.py +++ b/test/grammar/alerts_test.py @@ -5,7 +5,7 @@ def test_alert_interpolation(): input = '42 69' - grammar = ''' + grammar = r''' start = a:number b: number i:^`"seen: {a}, {b}"` $ ; number = /\d+/ ; ''' diff --git a/test/grammar/constants_test.py b/test/grammar/constants_test.py index 4ed37b70..5e416861 100644 --- a/test/grammar/constants_test.py +++ b/test/grammar/constants_test.py @@ -5,7 +5,7 @@ def test_constant_interpolation(): input = '42 69' - grammar = ''' + grammar = r''' start = a:number b: number i:`"seen: {a}, {b}"` $ ; number = /\d+/ ; ''' @@ -14,7 +14,7 @@ def test_constant_interpolation(): def test_constant_interpolation_free(): input = '42 69' - grammar = ''' + grammar = r''' start = a:number b: number i:`seen: {a}, {b}` $ ; number = /\d+/ ; ''' @@ -23,7 +23,7 @@ def test_constant_interpolation_free(): def test_constant_interpolation_multiline(): input = '42 69' - grammar = ''' + grammar = r''' start = a:number b: number i:``` seen: diff --git a/test/grammar/defines_test.py b/test/grammar/defines_test.py index 90d0f3f0..8ba60a21 100644 --- a/test/grammar/defines_test.py +++ b/test/grammar/defines_test.py @@ -6,7 +6,7 @@ def test_name_in_option(): - grammar = ''' + grammar = r''' start = expr_range ; expr_range = @@ -41,7 +41,7 @@ def test_name_in_option(): def test_by_option(): - grammar = ''' + grammar = r''' start = expr_range ; expr_range = diff --git a/test/grammar/keyword_test.py b/test/grammar/keyword_test.py index 86ae1aa7..6dab2732 100644 --- a/test/grammar/keyword_test.py +++ b/test/grammar/keyword_test.py @@ -127,7 +127,7 @@ def test_sparse_keywords(self): self.assertTrue('"%s" is a reserved word' % k in str(e)) def test_ignorecase_keywords(self): - grammar = ''' + grammar = r''' @@ignorecase :: True @@keyword :: if diff --git a/test/parser_equivalence_test.py b/test/parser_equivalence_test.py index 5c6bcdf0..b6fa285c 100644 --- a/test/parser_equivalence_test.py +++ b/test/parser_equivalence_test.py @@ -10,7 +10,7 @@ """ OUTPUT = {'number_of_dice': '1', 'sides': '3'} -GRAMMAR = """ +GRAMMAR = r""" start = expression $; int = /-?\d+/ ; @@ -82,7 +82,7 @@ def test_error_messages(): # @pytest.mark.skip('work in progress') def test_name_checked(): - grammar = ''' + grammar = r''' @@grammar :: Test @@ignorecase :: True @@keyword :: if @@ -123,7 +123,7 @@ def test_first_rule(): def test_dynamic_compiled_ast(): - grammar = ''' + grammar = r''' test::Test = 'TEST' ['A' a:number] ['B' b:number] ; number::int = /\d+/ ; '''