comparison mercurial/logcmdutil.py @ 52741:5c48fd4c0e68

typing: introduce a `types` module and a MatcherT alias This is a proposal to formalise the way we do typing and do more of it. The initial motivation to make progress is to help break the 100+ module cycle that is slowing pytype a lot.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 30 Jan 2025 18:22:01 +0100
parents e627cc25b6f3
children
comparison
equal deleted inserted replaced
52740:7405f8a67611 52741:5c48fd4c0e68
20 Sequence, 20 Sequence,
21 Tuple, 21 Tuple,
22 ) 22 )
23 23
24 from .i18n import _ 24 from .i18n import _
25 from .interfaces.types import (
26 MatcherT,
27 )
25 from .node import wdirrev 28 from .node import wdirrev
26 29
27 from .thirdparty import attr 30 from .thirdparty import attr
28 31
29 # Force pytype to use the non-vendored package 32 # Force pytype to use the non-vendored package
1081 1084
1082 1085
1083 def makewalker( 1086 def makewalker(
1084 repo: Any, 1087 repo: Any,
1085 wopts: walkopts, 1088 wopts: walkopts,
1086 ) -> Tuple[ 1089 ) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], MatcherT]]]:
1087 smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]
1088 ]:
1089 """Build (revs, makefilematcher) to scan revision/file history 1090 """Build (revs, makefilematcher) to scan revision/file history
1090 1091
1091 - revs is the smartset to be traversed. 1092 - revs is the smartset to be traversed.
1092 - makefilematcher is a function to map ctx to a matcher for that revision 1093 - makefilematcher is a function to map ctx to a matcher for that revision
1093 """ 1094 """