mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
difflib functions return Iterators, not Iterables (#310)
These functions all use yield. It's valid to call the next method on the return value, which is not true of Iterables.
This commit is contained in:
committed by
Guido van Rossum
parent
6e3514ccd0
commit
0c26482488
@@ -3,7 +3,8 @@
|
||||
# Based on https://docs.python.org/3.2/library/difflib.html
|
||||
|
||||
from typing import (
|
||||
TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic
|
||||
TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple,
|
||||
Generic
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -31,20 +32,20 @@ def get_close_matches(word: Sequence[_T], possibilities: List[Sequence[_T]],
|
||||
class Differ:
|
||||
def __init__(self, linejunk: Callable[[str], bool] = ...,
|
||||
charjunk: Callable[[str], bool] = ...) -> None: ...
|
||||
def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterable[str]: ...
|
||||
def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ...
|
||||
|
||||
def IS_LINE_JUNK(str) -> bool: ...
|
||||
def IS_CHARACTER_JUNK(str) -> bool: ...
|
||||
def unified_diff(a: Sequence[str], b: Sequence[str], fromfile: str = ...,
|
||||
tofile: str = ..., fromfiledate: str = ..., tofiledate: str = ...,
|
||||
n: int = ..., lineterm: str = ...) -> Iterable[str]: ...
|
||||
n: int = ..., lineterm: str = ...) -> Iterator[str]: ...
|
||||
def context_diff(a: Sequence[str], b: Sequence[str], fromfile: str=...,
|
||||
tofile: str = ..., fromfiledate: str = ..., tofiledate: str = ...,
|
||||
n: int = ..., lineterm: str = ...) -> Iterable[str]: ...
|
||||
n: int = ..., lineterm: str = ...) -> Iterator[str]: ...
|
||||
def ndiff(a: Sequence[str], b: Sequence[str],
|
||||
linejunk: Callable[[str], bool] = ...,
|
||||
charjunk: Callable[[str], bool] = ...
|
||||
) -> Iterable[str]: ...
|
||||
) -> Iterator[str]: ...
|
||||
|
||||
class HtmlDiff(object):
|
||||
def __init__(self, tabsize: int = ..., wrapcolumn: int = ...,
|
||||
@@ -58,4 +59,4 @@ class HtmlDiff(object):
|
||||
fromdesc: str = ..., todesc: str = ..., context: bool = ...,
|
||||
numlines: int = ...) -> str: ...
|
||||
|
||||
def restore(delta: Iterable[str], which: int) -> Iterable[int]: ...
|
||||
def restore(delta: Iterable[str], which: int) -> Iterator[int]: ...
|
||||
|
||||
Reference in New Issue
Block a user