from__future__importannotationsimportosTYPE_CHECKING=FalseifTYPE_CHECKING:fromtypingimportAny,NoReturn,TypeGuardfrom._typingimportStrOrBytesPath[docs]defis_path(f:Any)->TypeGuard[StrOrBytesPath]:returnisinstance(f,(bytes,str,os.PathLike)) [docs]classDeferredError:def__init__(self,ex:BaseException):self.ex=exdef__getattr__(self,elt:str)->NoReturn:raiseself.ex[docs]@staticmethoddefnew(ex:BaseException)->Any:""" Creates an object that raises the wrapped exception ``ex`` when used, and casts it to :py:obj:`~typing.Any` type. """returnDeferredError(ex)