mercurial/pycompat.py
changeset 50175 0ab92dabea6e
parent 50101 b900f40c343e
child 50176 829aa604d71a
--- a/mercurial/pycompat.py	Wed Feb 22 18:42:09 2023 +0100
+++ b/mercurial/pycompat.py	Tue Feb 21 13:24:12 2023 -0500
@@ -32,6 +32,7 @@
     Any,
     AnyStr,
     BinaryIO,
+    Callable,
     Dict,
     Iterable,
     Iterator,
@@ -58,6 +59,8 @@
 
 _GetOptResult = Tuple[List[Tuple[bytes, bytes]], List[bytes]]
 _T0 = TypeVar('_T0')
+_T1 = TypeVar('_T1')
+_S = TypeVar('_S')
 _Tbytestr = TypeVar('_Tbytestr', bound='bytestr')
 
 
@@ -129,8 +132,21 @@
 sysexecutable: bytes = os.fsencode(sys.executable) if sys.executable else b''
 
 
-def maplist(*args):
-    return list(map(*args))
+if TYPE_CHECKING:
+
+    @overload
+    def maplist(f: Callable[[_T0], _S], arg: Iterable[_T0]) -> List[_S]:
+        ...
+
+    @overload
+    def maplist(
+        f: Callable[[_T0, _T1], _S], arg1: Iterable[_T0], arg2: Iterable[_T1]
+    ) -> List[_S]:
+        ...
+
+
+def maplist(f, *args):
+    return list(map(f, *args))
 
 
 def rangelist(*args):