"""
This type stub file was generated by pyright.
"""

from typing import Self, TYPE_CHECKING, override
from tree_sitter import Node as PyNode
from graph_sitter.core.detached_symbols.function_call import FunctionCall
from graph_sitter.core.node_id_factory import NodeId
from graph_sitter.core.statements.try_catch_statement import TryCatchStatement
from graph_sitter.extensions.autocommit import reader
from graph_sitter.python.detached_symbols.code_block import PyCodeBlock
from graph_sitter.python.statements.block_statement import PyBlockStatement
from graph_sitter.python.statements.catch_statement import PyCatchStatement
from graph_sitter.writer_decorators import noapidoc, py_apidoc
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.interfaces.importable import Importable

if TYPE_CHECKING:
    ...
@py_apidoc
class PyTryCatchStatement(TryCatchStatement["PyCodeBlock"], PyBlockStatement):
    """Abstract representation of the try/catch/finally block in Python.

    Attributes:
        except_clauses: The exception handlers.
    """
    except_clauses: list[PyCatchStatement[Self]]
    def __init__(self, ts_node: PyNode, file_node_id: NodeId, G: CodebaseGraph, parent: PyCodeBlock, pos: int | None = ...) -> None:
        ...
    
    @property
    @reader
    def function_calls(self) -> list[FunctionCall]:
        """Gets a list of all function calls contained within the try-catch statement.

        Returns a list of function calls from all parts of the try-catch statement, including the main block, all except clauses, and the finally block if it exists.

        Returns:
            list[FunctionCall]: A list of all function calls found in the try-catch statement, its except clauses, and finally block.
        """
        ...
    
    @property
    @noapidoc
    def descendant_symbols(self) -> list[Importable]:
        ...
    
    @property
    @reader
    @override
    def nested_code_blocks(self) -> list[PyCodeBlock]:
        """Returns all CodeBlocks nested within this try-catch statement.

        Retrieves a list of code blocks from the try block, except clauses, and finally block (if present).

        Returns:
            list[PyCodeBlock]: A list containing all nested code blocks in the following order:
                - try block
                - nested blocks within finally block (if present)
                - except clause blocks
                - finally block (if present)
        """
        ...
    


