comparison mercurial/util.py @ 52905:483b0bb23085

typing: use a protocol to annotate `hooks` in repository.py That is one external import for the repository interface module. Two more to go. This introduces a new "misc" module in the `interfaces` "package" to host small things that does warrant their own module yet.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 08 Feb 2025 18:12:29 +0100
parents acaf6bad6b89
children fdae7c26d038
comparison
equal deleted inserted replaced
52904:acaf6bad6b89 52905:483b0bb23085
68 pycompat, 68 pycompat,
69 typelib, 69 typelib,
70 urllibcompat, 70 urllibcompat,
71 ) 71 )
72 from .interfaces import ( 72 from .interfaces import (
73 misc as int_misc,
73 modules as intmod, 74 modules as intmod,
74 ) 75 )
75 from .utils import ( 76 from .utils import (
76 compression, 77 compression,
77 hashutil, 78 hashutil,
3182 return int(t) 3183 return int(t)
3183 except ValueError: 3184 except ValueError:
3184 raise error.ParseError(_(b"couldn't parse size: %s") % s) 3185 raise error.ParseError(_(b"couldn't parse size: %s") % s)
3185 3186
3186 3187
3187 class hooks: 3188 class hooks(int_misc.IHooks):
3188 """A collection of hook functions that can be used to extend a 3189 """A collection of hook functions that can be used to extend a
3189 function's behavior. Hooks are called in lexicographic order, 3190 function's behavior. Hooks are called in lexicographic order,
3190 based on the names of their sources.""" 3191 based on the names of their sources."""
3191 3192
3192 def __init__(self): 3193 def __init__(self):