diff --git a/plugin/core/typing.py b/plugin/core/typing.py index 5a3b23511..68af5d7bf 100644 --- a/plugin/core/typing.py +++ b/plugin/core/typing.py @@ -27,6 +27,8 @@ final, # noqa: F401 ) + + if sys.version_info >= (3, 11): from enum import StrEnum # noqa: F401 from typing import ( @@ -36,11 +38,12 @@ TypeGuard, # noqa: F401 ) else: + _T = TypeVar("_T") class StrEnum(Type): # type: ignore pass - class NotRequired(Type): # type: ignore + class NotRequired(Type, Generic[_T]): # type: ignore pass class ParamSpec(Type): # type: ignore @@ -50,8 +53,8 @@ class ParamSpec(Type): # type: ignore def __init__(*args, **kwargs) -> None: # type: ignore pass - class Required(Type): # type: ignore + class Required(Type, Generic[_T]): # type: ignore pass - class TypeGuard(Type): # type: ignore + class TypeGuard(Type, Generic[_T]): # type: ignore pass