from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from .terms import ExecutorTerm class ExecContext: """ Base context class that carries the instantiation state. This is passed to all CommandTerms upon execution. """ def __init__(self, *, alias: str, args: list[str], content: str, **kwargs): self.alias = alias self.args = args self.content = content # Dictionary of local variables for the command context. # Useful if the Terms need to share state self.scope: dict[str, Any] = {} # Stack of terms that are *currently* executing with this context. self.termstack: list['ExecutorTerm'] = []