Fix StrEnum backport return type issue (#60610)

This commit is contained in:
Franck Nijhof 2021-11-30 11:16:56 +01:00 committed by GitHub
parent 56899d61fe
commit 6e3f522d4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ from typing import Any
class StrEnum(str, Enum):
"""Partial backport of Python 3.11's StrEnum for our basic use cases."""
def __new__(cls, value: str, *args: Any, **kwargs: Any) -> StrEnum:
def __new__(cls, value: str, *args: Any, **kwargs: Any): # type: ignore[no-untyped-def]
"""Create a new StrEnum instance."""
if not isinstance(value, str):
raise TypeError(f"{value!r} is not a string")