|
| 1 | +# File generated with docstub |
| 2 | + |
| 3 | +import builtins |
| 4 | +import importlib |
| 5 | +import json |
| 6 | +import logging |
| 7 | +import re |
| 8 | +from collections.abc import Iterable |
| 9 | +from dataclasses import asdict, dataclass |
| 10 | +from functools import cache |
| 11 | +from pathlib import Path |
| 12 | +from typing import Any, ClassVar |
| 13 | + |
| 14 | +import libcst as cst |
| 15 | +import libcst.matchers as cstm |
| 16 | + |
| 17 | +from ._utils import accumulate_qualname, module_name_from_path, pyfile_checksum |
| 18 | + |
| 19 | +logger: logging.Logger |
| 20 | + |
| 21 | +def _shared_leading_qualname(*qualnames: tuple[str]) -> str: ... |
| 22 | +@dataclass(slots=True, frozen=True) |
| 23 | +class PyImport: |
| 24 | + |
| 25 | + import_: str | None = ... |
| 26 | + from_: str | None = ... |
| 27 | + as_: str | None = ... |
| 28 | + implicit: str | None = ... |
| 29 | + |
| 30 | + @classmethod |
| 31 | + def typeshed_Incomplete(cls) -> PyImport: ... |
| 32 | + def format_import(self, relative_to: str | None = ...) -> str: ... |
| 33 | + @property |
| 34 | + def target(self) -> str: ... |
| 35 | + @property |
| 36 | + def has_import(self) -> None: ... |
| 37 | + def __post_init__(self) -> None: ... |
| 38 | + def __repr__(self) -> str: ... |
| 39 | + def __str__(self) -> str: ... |
| 40 | + |
| 41 | +def _is_type(value: Any) -> bool: ... |
| 42 | +def _builtin_types() -> dict[str, PyImport]: ... |
| 43 | +def _runtime_types_in_module(module_name: str) -> dict[str, PyImport]: ... |
| 44 | +def common_known_types() -> dict[str, PyImport]: ... |
| 45 | + |
| 46 | +class TypeCollector(cst.CSTVisitor): |
| 47 | + class ImportSerializer: |
| 48 | + |
| 49 | + suffix: ClassVar[str] |
| 50 | + encoding: ClassVar[str] |
| 51 | + |
| 52 | + def hash_args(self, path: Path) -> str: ... |
| 53 | + def serialize( |
| 54 | + self, data: tuple[dict[str, PyImport], dict[str, PyImport]] |
| 55 | + ) -> bytes: ... |
| 56 | + def deserialize( |
| 57 | + self, raw: bytes |
| 58 | + ) -> tuple[dict[str, PyImport], dict[str, PyImport]]: ... |
| 59 | + |
| 60 | + @classmethod |
| 61 | + def collect(cls, file: Path) -> tuple[dict[str, PyImport], dict[str, PyImport]]: ... |
| 62 | + def __init__(self, *, module_name: str) -> None: ... |
| 63 | + def visit_ClassDef(self, node: cst.ClassDef) -> bool: ... |
| 64 | + def leave_ClassDef(self, original_node: cst.ClassDef) -> None: ... |
| 65 | + def visit_FunctionDef(self, node: cst.FunctionDef) -> bool: ... |
| 66 | + def visit_TypeAlias(self, node: cst.TypeAlias) -> bool: ... |
| 67 | + def visit_AnnAssign(self, node: cst.AnnAssign) -> bool: ... |
| 68 | + def visit_ImportFrom(self, node: cst.ImportFrom) -> bool: ... |
| 69 | + def visit_Import(self, node: cst.Import) -> bool: ... |
| 70 | + def _collect_type_annotation(self, stack: Iterable[str]) -> None: ... |
| 71 | + |
| 72 | +class TypeMatcher: |
| 73 | + types: dict[str, PyImport] |
| 74 | + type_prefixes: dict[str, PyImport] |
| 75 | + type_nicknames: dict[str, str] |
| 76 | + successful_queries: int |
| 77 | + unknown_qualnames: list |
| 78 | + current_file: Path | None |
| 79 | + |
| 80 | + def __init__( |
| 81 | + self, |
| 82 | + *, |
| 83 | + types: dict[str, PyImport] | None = ..., |
| 84 | + type_prefixes: dict[str, PyImport] | None = ..., |
| 85 | + type_nicknames: dict[str, str] | None = ..., |
| 86 | + ) -> None: ... |
| 87 | + def _resolve_nickname(self, name: str) -> str: ... |
| 88 | + def match(self, search: str) -> tuple[str | None, PyImport | None]: ... |
0 commit comments