typing: adds annotation to util.hooks
This prepare the introduction of a typing.Protocol for it.
--- 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: