From d2da7d17c2450a44c17ad509806ce9db95591afd Mon Sep 17 00:00:00 2001 From: Shantanu Date: Tue, 21 Jan 2020 12:30:05 -0600 Subject: [PATCH] difflib: various fixes (#3629) - add undocumented parameters to IS_LINE_JUNK and IS_CHARACTER_JUNK - add kw-only charset to make_file --- stdlib/2and3/difflib.pyi | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stdlib/2and3/difflib.pyi b/stdlib/2and3/difflib.pyi index 197c5d03c..407d563ef 100644 --- a/stdlib/2and3/difflib.pyi +++ b/stdlib/2and3/difflib.pyi @@ -2,7 +2,7 @@ import sys from typing import ( - TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple, + Any, TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple, Generic, Optional, Text, Union, AnyStr ) @@ -45,8 +45,8 @@ class Differ: def __init__(self, linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ...) -> None: ... def compare(self, a: Sequence[_StrType], b: Sequence[_StrType]) -> Iterator[_StrType]: ... -def IS_LINE_JUNK(line: _StrType) -> bool: ... -def IS_CHARACTER_JUNK(line: _StrType) -> bool: ... +def IS_LINE_JUNK(line: _StrType, pat: Any = ...) -> bool: ... # pat is undocumented +def IS_CHARACTER_JUNK(ch: _StrType, ws: _StrType = ...) -> bool: ... # ws is undocumented def unified_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ..., tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ..., n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ... @@ -63,9 +63,14 @@ class HtmlDiff(object): linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ... ) -> None: ... - def make_file(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], - fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., - numlines: int = ...) -> _StrType: ... + if sys.version_info >= (3, 5): + def make_file(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], + fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., + numlines: int = ..., *, charset: str = ...) -> _StrType: ... + else: + def make_file(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], + fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., + numlines: int = ...) -> _StrType: ... def make_table(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., numlines: int = ...) -> _StrType: ...