Open
Description
AttributeError happens if the object has __slots__ or a
read-only property, TypeError if it's a builtin class.
basedtyping/basedtyping/__init__.py
Line 34 in 4689c3c
)
import typing_extensions
from typing_extensions import Never, ParamSpec, TypeAlias, TypeGuard, TypeVarTuple
from basedtyping.runtime_only import OldUnionType
if TYPE_CHECKING:
from typing_extensions import override
else:
def override(arg, /):
# TODO: Remove when typing_extensions is >= 4.4
with contextlib.suppress(AttributeError, TypeError):
# Skip the attribute silently if it is not writable.
# AttributeError happens if the object has __slots__ or a
# read-only property, TypeError if it's a builtin class.
arg.__override__ = True
return arg
if not TYPE_CHECKING:
# TODO: remove the TYPE_CHECKING block once these are typed in basedtypeshed
from typing import _GenericAlias, _remove_dups_flatten, _tp_cache, _type_check