|
1 | 1 | import argparse |
2 | 2 | import ast |
3 | 3 | from collections.abc import Generator |
4 | | -from typing import Any, ClassVar |
| 4 | +from typing import Any, Final, NamedTuple |
| 5 | +from typing_extensions import Self |
| 6 | + |
| 7 | +class Version(NamedTuple): |
| 8 | + major: int = 0 |
| 9 | + minor: int = 0 |
| 10 | + patch: int = 0 |
| 11 | + @classmethod |
| 12 | + def parse(cls, s: str) -> Self: ... |
| 13 | + |
| 14 | +SYMBOLS: Final[list[tuple[Version, frozenset[str]]]] |
| 15 | +VERSIONS: Final[frozenset[Version]] |
| 16 | + |
| 17 | +class Visitor(ast.NodeVisitor): |
| 18 | + imports: dict[str, list[tuple[int, int]]] |
| 19 | + attributes: dict[str, list[tuple[int, int]]] |
| 20 | + defined_overload: bool |
| 21 | + unions_pattern_or_match: list[tuple[int, int]] |
| 22 | + from_imported_names: set[str] |
| 23 | + namedtuple_methods: list[tuple[int, int]] |
| 24 | + namedtuple_defaults: list[tuple[int, int]] |
| 25 | + def __init__(self) -> None: ... |
| 26 | + def visit_ImportFrom(self, node: ast.ImportFrom) -> None: ... |
| 27 | + def visit_Attribute(self, node: ast.Attribute) -> None: ... |
| 28 | + def visit_FunctionDef(self, node: ast.FunctionDef) -> None: ... |
| 29 | + def visit_Subscript(self, node: ast.Subscript) -> None: ... |
| 30 | + def visit_ClassDef(self, node: ast.ClassDef) -> None: ... |
| 31 | + def visit_AnnAssign(self, node: ast.AnnAssign) -> None: ... |
| 32 | + def generic_visit(self, node: ast.AST) -> None: ... |
5 | 33 |
|
6 | 34 | class Plugin: |
7 | | - name: ClassVar[str] |
8 | | - version: ClassVar[str] |
9 | 35 | @staticmethod |
10 | 36 | def add_options(option_manager: Any) -> None: ... |
11 | 37 | @classmethod |
12 | 38 | def parse_options(cls, options: argparse.Namespace) -> None: ... |
13 | 39 | def __init__(self, tree: ast.AST) -> None: ... |
14 | | - def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... |
15 | | - |
16 | | -def __getattr__(name: str): ... # incomplete module (other attributes are normally not accessed) |
| 40 | + def run(self) -> Generator[tuple[int, int, str, type[Any]]]: ... |
0 commit comments