Add LiteralString overloads to path module (#7727)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Graham Bleaney
2022-05-25 11:52:52 -04:00
committed by GitHub
parent ac9efd8573
commit cb5b31cf15
4 changed files with 34 additions and 19 deletions

View File

@@ -11,7 +11,7 @@ from collections.abc import Awaitable, Container, Iterable, Set as AbstractSet
from os import PathLike
from types import TracebackType
from typing import Any, Generic, Protocol, TypeVar, Union
from typing_extensions import Final, Literal, TypeAlias, final
from typing_extensions import Final, Literal, LiteralString, TypeAlias, final
_KT = TypeVar("_KT")
_KT_co = TypeVar("_KT_co", covariant=True)
@@ -248,3 +248,6 @@ class structseq(Generic[_T_co]):
# but only has any meaning if you supply it a dict where the keys are strings.
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ...
# Superset of typing.AnyStr that also inclues LiteralString
AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001