sparse: fix a py2 based usage of `map()` stable
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 05 Jan 2023 19:47:35 -0500
branchstable
changeset 49892 2b8ead6bbb77
parent 49891 e90767a71dc0
child 49893 05b329cbd23d
sparse: fix a py2 based usage of `map()` In a local pytype run, this fixes: File "/mnt/c/Users/Matt/hg/hgext/sparse.py", line 386, in debugsparse: unsupported operand type(s) for item retrieval: 'fcounts: Iterator[int]' and '0: int' [unsupported-operands] No attribute '__getitem__' on 'fcounts: Iterator[int]' File "/mnt/c/Users/Matt/hg/hgext/sparse.py", line 387, in debugsparse: unsupported operand type(s) for item retrieval: 'fcounts: Iterator[int]' and '1: int' [unsupported-operands] No attribute '__getitem__' on 'fcounts: Iterator[int]' File "/mnt/c/Users/Matt/hg/hgext/sparse.py", line 388, in debugsparse: unsupported operand type(s) for item retrieval: 'fcounts: Iterator[int]' and '2: int' [unsupported-operands] No attribute '__getitem__' on 'fcounts: Iterator[int]'
hgext/sparse.py
--- a/hgext/sparse.py	Thu Jan 05 17:38:14 2023 -0500
+++ b/hgext/sparse.py	Thu Jan 05 19:47:35 2023 -0500
@@ -374,7 +374,7 @@
     if refresh:
         try:
             wlock = repo.wlock()
-            fcounts = map(
+            fcounts = pycompat.maplist(
                 len,
                 sparse.refreshwdir(
                     repo, repo.status(), sparse.matcher(repo), force=force