Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove fake overload when typing_extensions is >= 4.4 #92

Open
github-actions bot opened this issue Dec 12, 2023 · 0 comments
Open

Remove fake overload when typing_extensions is >= 4.4 #92

github-actions bot opened this issue Dec 12, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

AttributeError happens if the object has __slots__ or a

read-only property, TypeError if it's a builtin class.

# TODO: Remove when typing_extensions is >= 4.4

)

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
@github-actions github-actions bot added the todo label Dec 12, 2023
@KotlinIsland KotlinIsland changed the title Remove when typing_extensions is >= 4.4 Remove fake overload when typing_extensions is >= 4.4 Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants