Files
Investidor-V2/outputs/investmoz-audit-current-20261012/line12-pdf-tools/PIL/_util.py
T
nala c13f250b87
tests / ci (push) Canceled after 0s
versao compilada
2026-10-15 17:37:00 +02:00

30 lines
684 B
Python

from __future__ import annotations
import os
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Any, NoReturn, TypeGuard
from ._typing import StrOrBytesPath
def is_path(f: Any) -> TypeGuard[StrOrBytesPath]:
return isinstance(f, (bytes, str, os.PathLike))
class DeferredError:
def __init__(self, ex: BaseException):
self.ex = ex
def __getattr__(self, elt: str) -> NoReturn:
raise self.ex
@staticmethod
def new(ex: BaseException) -> Any:
"""
Creates an object that raises the wrapped exception ``ex`` when used,
and casts it to :py:obj:`~typing.Any` type.
"""
return DeferredError(ex)