Debian Codegraph @

jedi/third_party/typeshed/stdlib/symtable.pyi

raw symbols SCIP
1 import sys
2 from _collections_abc import dict_keys
3 from collections.abc import Sequence
4 from typing import Any
5 from typing_extensions import deprecated
6
7 __all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
8
9 if sys.version_info >= (3, 13):
10 __all__ += ["SymbolTableType"]
11
12 def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ...
13
14 if sys.version_info >= (3, 13):
15 from enum import StrEnum
16
17 class SymbolTableType(StrEnum):
18 MODULE = "module"
19 FUNCTION = "function"
20 CLASS = "class"
21 ANNOTATION = "annotation"
22 TYPE_ALIAS = "type alias"
23 TYPE_PARAMETERS = "type parameters"
24 TYPE_VARIABLE = "type variable"
25
26 class SymbolTable:
27 def __init__(self, raw_table: Any, filename: str) -> None: ...
28 if sys.version_info >= (3, 13):
29 def get_type(self) -> SymbolTableType: ...
30 else:
31 def get_type(self) -> str: ...
32
33 def get_id(self) -> int: ...
34 def get_name(self) -> str: ...
35 def get_lineno(self) -> int: ...
36 def is_optimized(self) -> bool: ...
37 def is_nested(self) -> bool: ...
38 def has_children(self) -> bool: ...
39 def get_identifiers(self) -> dict_keys[str, int]: ...
40 def lookup(self, name: str) -> Symbol: ...
41 def get_symbols(self) -> list[Symbol]: ...
42 def get_children(self) -> list[SymbolTable]: ...
43
44 class Function(SymbolTable):
45 def get_parameters(self) -> tuple[str, ...]: ...
46 def get_locals(self) -> tuple[str, ...]: ...
47 def get_globals(self) -> tuple[str, ...]: ...
48 def get_frees(self) -> tuple[str, ...]: ...
49 def get_nonlocals(self) -> tuple[str, ...]: ...
50
51 class Class(SymbolTable):
52 if sys.version_info >= (3, 14):
53 @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
54 def get_methods(self) -> tuple[str, ...]: ...
55 else:
56 def get_methods(self) -> tuple[str, ...]: ...
57
58 class Symbol:
59 def __init__(
60 self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = None, *, module_scope: bool = False
61 ) -> None: ...
62 def is_nonlocal(self) -> bool: ...
63 def get_name(self) -> str: ...
64 def is_referenced(self) -> bool: ...
65 def is_parameter(self) -> bool: ...
66 if sys.version_info >= (3, 14):
67 def is_type_parameter(self) -> bool: ...
68
69 def is_global(self) -> bool: ...
70 def is_declared_global(self) -> bool: ...
71 def is_local(self) -> bool: ...
72 def is_annotated(self) -> bool: ...
73 def is_free(self) -> bool: ...
74 if sys.version_info >= (3, 14):
75 def is_free_class(self) -> bool: ...
76
77 def is_imported(self) -> bool: ...
78 def is_assigned(self) -> bool: ...
79 if sys.version_info >= (3, 14):
80 def is_comp_iter(self) -> bool: ...
81 def is_comp_cell(self) -> bool: ...
82
83 def is_namespace(self) -> bool: ...
84 def get_namespaces(self) -> Sequence[SymbolTable]: ...
85 def get_namespace(self) -> SymbolTable: ...
86
87 class SymbolTableFactory:
88 def new(self, table: Any, filename: str) -> SymbolTable: ...
89 def __call__(self, table: Any, filename: str) -> SymbolTable: ...