"""Protocols for structural typing.For more information on protocols, refer to`PEP 544 <https://www.python.org/dev/peps/pep-0544/>`__."""from__future__importannotationsfromabcimportabstractmethodfromtypingimportTYPE_CHECKING,Any,ClassVar,TypeVar,overloadfromtyping_extensionsimportProtocol,runtime_checkableifTYPE_CHECKING:from...contextimportCfnginContext_T=TypeVar("_T")
[docs]classCfnginHookArgsProtocol(Protocol):"""Protocol for CFNgin hook arguments class. This class defines a structural interface for all CFNgin hook argument classes. It is recommended to use the provided base class in place of this when authoring a new argument class. """@overload@abstractmethoddefget(self,_name:str)->Any|None:...@overload@abstractmethoddefget(self,_name:str,_default:Any|_T)->Any|_T:...
[docs]@abstractmethoddefget(self,_name:str,_default:Any|_T=None)->Any|_T:"""Safely get the value of an attribute. Args: name: Attribute name to return the value for. default: Value to return if attribute is not found. """raiseNotImplementedError
[docs]@runtime_checkableclassCfnginHookProtocol(Protocol):"""Protocol for CFNgin hooks. This class defines a structural interface for all CFNgin hook classes. Classes used for hooks do not need to subclass this hook. They only need to implement a similar interface. While not required, it is still acceptable to subclass this class for full type checking of a hook class. """ARGS_PARSER:ClassVar"""Class used to parse arguments passed to the hook."""
[docs]@abstractmethoddefpost_deploy(self)->Any:"""Run during the **post_deploy** stage. Returns: A "truthy" value if the hook was successful or a "falsy" value if the hook failed. """raiseNotImplementedError
[docs]@abstractmethoddefpost_destroy(self)->Any:"""Run during the **post_destroy** stage. Returns: A "truthy" value if the hook was successful or a "falsy" value if the hook failed. """raiseNotImplementedError
[docs]@abstractmethoddefpre_deploy(self)->Any:"""Run during the **pre_deploy** stage. Returns: A "truthy" value if the hook was successful or a "falsy" value if the hook failed. """raiseNotImplementedError
[docs]@abstractmethoddefpre_destroy(self)->Any:"""Run during the **pre_destroy** stage. Returns: A "truthy" value if the hook was successful or a "falsy" value if the hook failed. """raiseNotImplementedError