Mercurial > hg
changeset 49861:ffeeaeb2d142
typing: adjust `mercurial.util.iterlines()` to accept any `Iterable`
In a local pytype run on the extensions, this fixes:
File "/mnt/c/Users/Matt/hg/hgext/phabricator.py", line 788, in maketext:
Function mercurial.util.iterlines was called with the wrong arguments [wrong-arg-types]
Expected: (iterator: Iterator[bytes])
Actually passed: (iterator: list)
Attributes of protocol Iterator[bytes] are not implemented on list: __next__
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 05 Jan 2023 19:42:45 -0500 |
parents | d5116e4dc744 |
children | b1147450c55c |
files | mercurial/util.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Thu Jan 05 17:45:25 2023 -0500 +++ b/mercurial/util.py Thu Jan 05 19:42:45 2023 -0500 @@ -60,6 +60,7 @@ if pycompat.TYPE_CHECKING: from typing import ( + Iterable, Iterator, List, Optional, @@ -2910,7 +2911,7 @@ def iterlines(iterator): - # type: (Iterator[bytes]) -> Iterator[bytes] + # type: (Iterable[bytes]) -> Iterator[bytes] for chunk in iterator: for line in chunk.splitlines(): yield line