From 912e29733f53e0e89490fe3b78ee6a2148ff2cd2 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 8 Aug 2021 22:07:02 +0200 Subject: [PATCH] Change List to list --- stdlib/distutils/fancy_getopt.pyi | 4 ++-- stdlib/email/_header_value_parser.pyi | 4 ++-- stdlib/email/message.pyi | 4 ++-- stdlib/lib2to3/pgen2/grammar.pyi | 4 ++-- stdlib/lib2to3/pytree.pyi | 4 ++-- stdlib/msilib/sequence.pyi | 4 ++-- stdlib/multiprocessing/pool.pyi | 4 ++-- stdlib/tkinter/__init__.pyi | 6 +++--- stdlib/unittest/loader.pyi | 4 ++-- stdlib/unittest/mock.pyi | 4 ++-- stdlib/wsgiref/headers.pyi | 4 ++-- stdlib/xmlrpc/client.pyi | 4 ++-- stdlib/xmlrpc/server.pyi | 10 +++++----- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index a2c24187a498..75f41dd7566a 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -1,7 +1,7 @@ -from typing import Any, Iterable, List, Mapping, Optional, Tuple, overload +from typing import Any, Iterable, Mapping, Optional, Tuple, overload _Option = Tuple[str, Optional[str], str] -_GR = Tuple[List[str], OptionDummy] +_GR = Tuple[list[str], OptionDummy] def fancy_getopt( options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index 46391a2470d3..7e5d1457d9df 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -1,7 +1,7 @@ import sys from email.errors import HeaderParseError, MessageDefect from email.policy import Policy -from typing import Any, Iterable, Iterator, List, Pattern, Set, Tuple, Type, TypeVar, Union +from typing import Any, Iterable, Iterator, Pattern, Set, Tuple, Type, TypeVar, Union from typing_extensions import Final _T = TypeVar("_T") @@ -23,7 +23,7 @@ def quote_string(value: Any) -> str: ... if sys.version_info >= (3, 7): rfc2047_matcher: Pattern[str] -class TokenList(List[Union[TokenList, Terminal]]): +class TokenList(list[Union[TokenList, Terminal]]): token_type: str | None = ... syntactic_break: bool = ... ew_combine_allowed: bool = ... diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index fcf8d7969450..03954df7b6a9 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,11 +2,11 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import Any, Generator, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union +from typing import Any, Generator, Iterator, Optional, Sequence, Tuple, TypeVar, Union _T = TypeVar("_T") -_PayloadType = Union[List[Message], str, bytes] +_PayloadType = Union[list[Message], str, bytes] _CharsetType = Union[Charset, str, None] _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] _ParamType = Union[str, Tuple[Optional[str], Optional[str], str]] diff --git a/stdlib/lib2to3/pgen2/grammar.pyi b/stdlib/lib2to3/pgen2/grammar.pyi index 48cb4eae916c..237e14696c8b 100644 --- a/stdlib/lib2to3/pgen2/grammar.pyi +++ b/stdlib/lib2to3/pgen2/grammar.pyi @@ -1,9 +1,9 @@ from _typeshed import StrPath -from typing import Dict, List, Optional, Tuple, TypeVar +from typing import Dict, Optional, Tuple, TypeVar _P = TypeVar("_P") _Label = Tuple[int, Optional[str]] -_DFA = List[List[Tuple[int, int]]] +_DFA = list[list[Tuple[int, int]]] _DFAS = Tuple[_DFA, Dict[int, int]] class Grammar: diff --git a/stdlib/lib2to3/pytree.pyi b/stdlib/lib2to3/pytree.pyi index f926e6f7f8b3..5ee1ea2de562 100644 --- a/stdlib/lib2to3/pytree.pyi +++ b/stdlib/lib2to3/pytree.pyi @@ -1,11 +1,11 @@ from lib2to3.pgen2.grammar import Grammar -from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, TypeVar, Union +from typing import Any, Callable, Dict, Iterator, Optional, Tuple, TypeVar, Union _P = TypeVar("_P") _NL = Union[Node, Leaf] _Context = Tuple[str, int, int] _Results = Dict[str, _NL] -_RawNode = Tuple[int, str, _Context, Optional[List[_NL]]] +_RawNode = Tuple[int, str, _Context, Optional[list[_NL]]] _Convert = Callable[[Grammar, _RawNode], Any] HUGE: int diff --git a/stdlib/msilib/sequence.pyi b/stdlib/msilib/sequence.pyi index 123d232886f7..60f9879ef223 100644 --- a/stdlib/msilib/sequence.pyi +++ b/stdlib/msilib/sequence.pyi @@ -1,9 +1,9 @@ import sys -from typing import List, Optional, Tuple +from typing import Optional, Tuple if sys.platform == "win32": - _SequenceType = List[Tuple[str, Optional[str], int]] + _SequenceType = list[Tuple[str, Optional[str], int]] AdminExecuteSequence: _SequenceType AdminUISequence: _SequenceType diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index 63f8d6d034f5..bbc763ae7177 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import Self -from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, TypeVar +from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, Mapping, TypeVar if sys.version_info >= (3, 9): from types import GenericAlias @@ -26,7 +26,7 @@ class ApplyResult(Generic[_T]): # alias created during issue #17805 AsyncResult = ApplyResult -class MapResult(ApplyResult[List[_T]]): ... +class MapResult(ApplyResult[list[_T]]): ... class IMapIterator(Iterator[_T]): def __iter__(self: _S) -> _S: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 11433f1e8cce..9f611345d5b7 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -5,7 +5,7 @@ from enum import Enum from tkinter.constants import * # comment this out to find undefined identifier names with flake8 from tkinter.font import _FontDescription from types import TracebackType -from typing import Any, Callable, Generic, List, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar, Union, overload +from typing import Any, Callable, Generic, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar, Union, overload from typing_extensions import Literal, TypedDict # Using anything from tkinter.font in this file means that 'import tkinter' @@ -82,8 +82,8 @@ EXCEPTION = _tkinter.EXCEPTION # ... # _tkinter.TclError: unknown font style "deque(['bold'])" _T = TypeVar("_T") -_TkinterSequence = Union[List[_T], Tuple[_T, ...]] -_TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], ...], Tuple[Tuple[_T, ...], ...]] +_TkinterSequence = Union[list[_T], Tuple[_T, ...]] +_TkinterSequence2D = Union[list[list[_T]], list[Tuple[_T, ...]], Tuple[list[_T], ...], Tuple[Tuple[_T, ...], ...]] # Some widgets have an option named -compound that accepts different values # than the _Compound defined here. Many other options have similar things. diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index d3cb4cef733b..0e227a92855e 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -3,10 +3,10 @@ import unittest.case import unittest.result import unittest.suite from types import ModuleType -from typing import Any, Callable, List, Sequence, Type +from typing import Any, Callable, Sequence, Type _SortComparisonMethod = Callable[[str, str], int] -_SuiteClass = Callable[[List[unittest.case.TestCase]], unittest.suite.TestSuite] +_SuiteClass = Callable[[list[unittest.case.TestCase]], unittest.suite.TestSuite] class TestLoader: errors: list[Type[BaseException]] diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 7ccaf3acaeb5..c24752e2d352 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Generic, Iterable, List, Mapping, Sequence, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Mapping, Sequence, Tuple, Type, TypeVar, overload _F = TypeVar("_F", bound=Callable[..., Any]) _T = TypeVar("_T") @@ -60,7 +60,7 @@ class _Call(Tuple[Any, ...]): call: _Call -class _CallList(List[_Call]): +class _CallList(list[_Call]): def __contains__(self, value: Any) -> bool: ... class _MockIter: diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index 531a521d3824..8f4dd28e0457 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -1,6 +1,6 @@ -from typing import List, Pattern, Tuple, overload +from typing import Pattern, Tuple, overload -_HeaderList = List[Tuple[str, str]] +_HeaderList = list[Tuple[str, str]] tspecials: Pattern[str] # undocumented diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 1ed68c71b9a6..0973dcb453c7 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -6,14 +6,14 @@ from _typeshed import Self, SupportsRead, SupportsWrite from datetime import datetime from io import BytesIO from types import TracebackType -from typing import Any, Callable, Dict, Iterable, List, Mapping, Protocol, Tuple, Type, Union, overload +from typing import Any, Callable, Dict, Iterable, Mapping, Protocol, Tuple, Type, Union, overload from typing_extensions import Literal class _SupportsTimeTuple(Protocol): def timetuple(self) -> time.struct_time: ... _DateTimeComparable = Union[DateTime, datetime, str, _SupportsTimeTuple] -_Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime, DateTime, Binary] +_Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], list[Any], Dict[Any, Any], datetime, DateTime, Binary] _XMLDate = Union[int, datetime, Tuple[int, ...], time.struct_time] _HostType = Union[Tuple[str, Dict[str, str]], str] diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index 9d86fe2b6c75..3bd8e81f3d44 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -3,11 +3,11 @@ import pydoc import socketserver import sys from datetime import datetime -from typing import Any, Callable, Dict, Iterable, List, Mapping, Pattern, Protocol, Tuple, Type, Union +from typing import Any, Callable, Dict, Iterable, Mapping, Pattern, Protocol, Tuple, Type, Union from xmlrpc.client import Fault _Marshallable = Union[ - None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime + None, bool, int, float, str, bytes, Tuple[Any, ...], list[Any], Dict[Any, Any], datetime ] # TODO: Recursive type on tuple, list, dict # The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy @@ -34,7 +34,7 @@ class _DispatchArityN(Protocol): _DispatchProtocol = Union[_DispatchArity0, _DispatchArity1, _DispatchArity2, _DispatchArity3, _DispatchArity4, _DispatchArityN] def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = ...) -> Any: ... # undocumented -def list_public_methods(obj: Any) -> List[str]: ... # undocumented +def list_public_methods(obj: Any) -> list[str]: ... # undocumented class SimpleXMLRPCDispatcher: # undocumented @@ -57,10 +57,10 @@ class SimpleXMLRPCDispatcher: # undocumented dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ..., path: Any | None = ..., ) -> str: ... # undocumented - def system_listMethods(self) -> List[str]: ... # undocumented + def system_listMethods(self) -> list[str]: ... # undocumented def system_methodSignature(self, method_name: str) -> str: ... # undocumented def system_methodHelp(self, method_name: str) -> str: ... # undocumented - def system_multicall(self, call_list: List[Dict[str, _Marshallable]]) -> List[_Marshallable]: ... # undocumented + def system_multicall(self, call_list: list[Dict[str, _Marshallable]]) -> list[_Marshallable]: ... # undocumented def _dispatch(self, method: str, params: Iterable[_Marshallable]) -> _Marshallable: ... # undocumented class SimpleXMLRPCRequestHandler(http.server.BaseHTTPRequestHandler):