From 41de5317b5008719c899b0ca61f9fd37b774cade Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 8 Jan 2023 05:05:51 -0500 Subject: [PATCH] Add `FileDescriptorOrPath` and `Unused` type aliases (#9475) --- stdlib/_typeshed/__init__.pyi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index f01db74ca..68ac2a9b1 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -36,6 +36,9 @@ AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True) # noqa: Y001 # "Incomplete | None" instead of "Any | None". Incomplete: TypeAlias = Any +# To describe a function parameter that is unused and will work with anything. +Unused: TypeAlias = object + # stable class IdentityFunction(Protocol): def __call__(self, __x: _T) -> _T: ... @@ -205,6 +208,7 @@ class HasFileno(Protocol): FileDescriptor: TypeAlias = int # stable FileDescriptorLike: TypeAlias = int | HasFileno # stable +FileDescriptorOrPath: TypeAlias = int | StrOrBytesPath # stable class SupportsRead(Protocol[_T_co]):