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

from typing import Generic, TYPE_CHECKING, TypeVar
from graph_sitter.core.autocommit import reader
from graph_sitter.core.detached_symbols.code_block import CodeBlock
from graph_sitter.writer_decorators import py_apidoc
from graph_sitter.python.interfaces.has_block import PyHasBlock
from graph_sitter.python.statements.with_statement import WithStatement

if TYPE_CHECKING:
    ...
Parent = TypeVar("Parent", bound="PyHasBlock")
@py_apidoc
class PyCodeBlock(CodeBlock[Parent, "PyAssignment"], Generic[Parent]):
    """Extends CodeBlock for Python codebases."""
    @property
    @reader
    def with_statements(self) -> list[WithStatement]:
        """Returns a list of all 'with' statements within the code block.

        Retrieves all with statements in the code block, including those at all nested levels.

        Returns:
            A list of with statement objects found within this code block.
        """
        ...
    
    @reader
    def get_with_statements(self, level: int) -> list[WithStatement]:
        """Gets with statements at a specific block level.

        Filters the with statements in this code block to only include those at the specified block level.

        Args:
            level (int): The block level to filter by. 0 represents the top level.

        Returns:
            list[WithStatement]: A list of WithStatement objects at the specified block level.
        """
        ...
    


