Update `symtable` stubs for 3.13 and 3.14 (#12183)

This commit is contained in:
Bénédikt Tran
2024-07-02 00:49:34 +02:00
committed by GitHub
parent d029c30a16
commit 6b4cd03d34

View File

@@ -5,11 +5,30 @@ from typing import Any
__all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
if sys.version_info >= (3, 13):
__all__ += ["SymbolTableType"]
def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ...
if sys.version_info >= (3, 13):
from enum import StrEnum
class SymbolTableType(StrEnum):
MODULE = "module"
FUNCTION = "function"
CLASS = "class"
ANNOTATION = "annotation"
TYPE_ALIAS = "type alias"
TYPE_PARAMETERS = "type parameters"
TYPE_VARIABLE = "type variable"
class SymbolTable:
def __init__(self, raw_table: Any, filename: str) -> None: ...
def get_type(self) -> str: ...
if sys.version_info >= (3, 13):
def get_type(self) -> SymbolTableType: ...
else:
def get_type(self) -> str: ...
def get_id(self) -> int: ...
def get_name(self) -> str: ...
def get_lineno(self) -> int: ...
@@ -42,13 +61,23 @@ class Symbol:
def get_name(self) -> str: ...
def is_referenced(self) -> bool: ...
def is_parameter(self) -> bool: ...
if sys.version_info >= (3, 14):
def is_type_parameter(self) -> bool: ...
def is_global(self) -> bool: ...
def is_declared_global(self) -> bool: ...
def is_local(self) -> bool: ...
def is_annotated(self) -> bool: ...
def is_free(self) -> bool: ...
if sys.version_info >= (3, 14):
def is_free_class(self) -> bool: ...
def is_imported(self) -> bool: ...
def is_assigned(self) -> bool: ...
if sys.version_info >= (3, 14):
def is_comp_iter(self) -> bool: ...
def is_comp_cell(self) -> bool: ...
def is_namespace(self) -> bool: ...
def get_namespaces(self) -> Sequence[SymbolTable]: ...
def get_namespace(self) -> SymbolTable: ...