diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfab8414..e51315e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: # Ignore F401, which are unused imports. flake8 is a primitive tool and is sometimes wrong. run: flake8 --extend-ignore F401 parso test/*.py setup.py scripts/ - name: Run Mypy - run: mypy parso + run: mypy parso setup.py test: runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} diff --git a/parso/grammar.py b/parso/grammar.py index 43b7be94..85c65db9 100644 --- a/parso/grammar.py +++ b/parso/grammar.py @@ -106,14 +106,14 @@ def parse(self, if file_io is None: if code is None: - file_io = FileIO(path) # type: ignore + file_io = FileIO(path) # type: ignore[arg-type] else: file_io = KnownContentFileIO(path, code) if cache and file_io.path is not None: module_node = load_module(self._hashed, file_io, cache_path=cache_path) if module_node is not None: - return module_node # type: ignore + return module_node # type: ignore[no-any-return] if code is None: code = file_io.read() @@ -132,7 +132,7 @@ def parse(self, module_node = module_cache_item.node old_lines = module_cache_item.lines if old_lines == lines: - return module_node # type: ignore + return module_node # type: ignore[no-any-return] new_node = self._diff_parser( self._pgen_grammar, self._tokenizer, module_node @@ -144,7 +144,7 @@ def parse(self, # Never pickle in pypy, it's slow as hell. pickling=cache and not is_pypy, cache_path=cache_path) - return new_node # type: ignore + return new_node # type: ignore[no-any-return] tokens = self._tokenizer(lines) @@ -160,7 +160,7 @@ def parse(self, # Never pickle in pypy, it's slow as hell. pickling=cache and not is_pypy, cache_path=cache_path) - return root_node # type: ignore + return root_node # type: ignore[no-any-return] def _get_token_namespace(self): ns = self._token_namespace diff --git a/parso/pgen2/generator.py b/parso/pgen2/generator.py index db6e1cb3..30f0b546 100644 --- a/parso/pgen2/generator.py +++ b/parso/pgen2/generator.py @@ -276,7 +276,7 @@ def generate_grammar(bnf_grammar: str, token_namespace) -> Grammar: dfa_state.transitions[transition] = DFAPlan(next_dfa) _calculate_tree_traversal(rule_to_dfas) - return Grammar(start_nonterminal, rule_to_dfas, reserved_strings) # type: ignore + return Grammar(start_nonterminal, rule_to_dfas, reserved_strings) # type: ignore[arg-type] def _make_transition(token_namespace, reserved_syntax_strings, label): diff --git a/setup.cfg b/setup.cfg index 1d077d8c..94c886cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,6 +13,9 @@ ignore = [mypy] +show_error_codes = true +enable_error_code = ignore-without-code + disallow_subclassing_any = True # Avoid creating future gotchas emerging from bad typing diff --git a/setup.py b/setup.py index 555ae7fb..096aa10b 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,10 @@ 'qa': [ # Latest version which supports Python 3.6 'flake8==5.0.4', - 'mypy==0.782', + # Latest version which supports Python 3.6 + 'mypy==0.971', + # Arbitrary pins, latest at the time of pinning + 'types-setuptools==67.2.0.1', ], }, )