From f9c650d16795fed616c986252835cdfd8f6e87e4 Mon Sep 17 00:00:00 2001 From: Akuli Date: Fri, 14 Jan 2022 17:41:06 +0200 Subject: [PATCH] Delete duplicate union members (#6916) --- stdlib/argparse.pyi | 4 ++-- stdlib/difflib.pyi | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index b0020c1cd..d2b18d42c 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -292,7 +292,7 @@ class Action(_AttributeHolder): nargs: int | str | None = ..., const: _T | None = ..., default: _T | str | None = ..., - type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ..., + type: Callable[[str], _T] | FileType | None = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., @@ -311,7 +311,7 @@ if sys.version_info >= (3, 9): option_strings: Sequence[str], dest: str, default: _T | str | None = ..., - type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ..., + type: Callable[[str], _T] | FileType | None = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index d259e77df..ad96aa1c9 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -1,11 +1,10 @@ import sys -from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, TypeVar, Union, overload +from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias _T = TypeVar("_T") -_JunkCallback = Union[Callable[[str], bool], Callable[[str], bool]] class Match(NamedTuple): a: int @@ -41,7 +40,7 @@ def get_close_matches( ) -> list[Sequence[_T]]: ... class Differ: - def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ... + def __init__(self, linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ...) -> None: ... def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented @@ -67,7 +66,7 @@ def context_diff( lineterm: str = ..., ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ... + a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ... ) -> Iterator[str]: ... class HtmlDiff: @@ -75,8 +74,8 @@ class HtmlDiff: self, tabsize: int = ..., wrapcolumn: int | None = ..., - linejunk: _JunkCallback | None = ..., - charjunk: _JunkCallback | None = ..., + linejunk: Callable[[str], bool] | None = ..., + charjunk: Callable[[str], bool] | None = ..., ) -> None: ... def make_file( self,