typing: adds annotation to util.hooks
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 09 Feb 2025 22:45:16 +0100
changeset 52892 acaf6bad6b89
parent 52891 d5f8a336e2ef
child 52893 483b0bb23085
typing: adds annotation to util.hooks This prepare the introduction of a typing.Protocol for it.
mercurial/util.py
--- a/mercurial/util.py	Thu Dec 12 17:50:06 2024 +0000
+++ b/mercurial/util.py	Sun Feb 09 22:45:16 2025 +0100
@@ -3192,10 +3192,10 @@
     def __init__(self):
         self._hooks = []
 
-    def add(self, source, hook):
+    def add(self, source: bytes, hook: Callable) -> None:
         self._hooks.append((source, hook))
 
-    def __call__(self, *args):
+    def __call__(self, *args) -> List:
         self._hooks.sort(key=lambda x: x[0])
         results = []
         for source, hook in self._hooks: