From c653be73b8f7744c99cfaad47f870a78262d3c5c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 20 Apr 2022 15:32:10 +0100 Subject: [PATCH] Use TypeAlias for argparse type aliases (#7664) --- stdlib/argparse.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 0f933e58d..759027d3a 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -1,7 +1,7 @@ import sys from collections.abc import Callable, Generator, Iterable, Sequence from typing import IO, Any, Generic, NewType, NoReturn, Pattern, Protocol, TypeVar, overload -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): __all__ = [ @@ -53,11 +53,11 @@ _N = TypeVar("_N") # "store_false", "append", "append_const", "count", "help", "version", # "extend"], but using this would make it hard to annotate callers # that don't use a literal argument -_ActionStr = str +_ActionStr: TypeAlias = str # more precisely, Literal["?", "*", "+", "...", "A...", # "==SUPPRESS=="], but using this would make it hard to annotate # callers that don't use a literal argument -_NArgsStr = str +_NArgsStr: TypeAlias = str ONE_OR_MORE: Literal["+"] OPTIONAL: Literal["?"]