mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-108455: Run mypy on Tools/peg_generator (#108456)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
f75cefd402
commit
cf7ba83eb2
6 changed files with 23 additions and 11 deletions
|
|
@ -5,7 +5,7 @@ import sys
|
|||
import sysconfig
|
||||
import tempfile
|
||||
import tokenize
|
||||
from typing import IO, Dict, List, Optional, Set, Tuple
|
||||
from typing import IO, Any, Dict, List, Optional, Set, Tuple
|
||||
|
||||
from pegen.c_generator import CParserGenerator
|
||||
from pegen.grammar import Grammar
|
||||
|
|
@ -18,6 +18,7 @@ from pegen.tokenizer import Tokenizer
|
|||
MOD_DIR = pathlib.Path(__file__).resolve().parent
|
||||
|
||||
TokenDefinitions = Tuple[Dict[int, str], Dict[str, int], Set[str]]
|
||||
Incomplete = Any # TODO: install `types-setuptools` and remove this alias
|
||||
|
||||
|
||||
def get_extra_flags(compiler_flags: str, compiler_py_flags_nodist: str) -> List[str]:
|
||||
|
|
@ -28,7 +29,7 @@ def get_extra_flags(compiler_flags: str, compiler_py_flags_nodist: str) -> List[
|
|||
return f"{flags} {py_flags_nodist}".split()
|
||||
|
||||
|
||||
def fixup_build_ext(cmd):
|
||||
def fixup_build_ext(cmd: Incomplete) -> None:
|
||||
"""Function needed to make build_ext tests pass.
|
||||
|
||||
When Python was built with --enable-shared on Unix, -L. is not enough to
|
||||
|
|
@ -74,7 +75,7 @@ def compile_c_extension(
|
|||
keep_asserts: bool = True,
|
||||
disable_optimization: bool = False,
|
||||
library_dir: Optional[str] = None,
|
||||
) -> str:
|
||||
) -> pathlib.Path:
|
||||
"""Compile the generated source for a parser generator into an extension module.
|
||||
|
||||
The extension module will be generated in the same directory as the provided path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue