comparison mercurial/logcmdutil.py @ 48014:0dc4cc654d96

typing: drop annotations on `mercurial/logcmdutil.walkopts` attributes Pytype 2021-09-09 must have learned some things about `@attr`, because while these were presumably required to help it before (c1d0f83d62c4::9a26fea2b518 and c11099cc1de4::224c786f4fce), these instances now get flagged as an assignment mismatch: File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 717, in walkopts: Type annotation for pats does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 718, in walkopts: Type annotation for opts does not match type of assignment [annotation-type-mismatch] Annotation: Dict[bytes, Any] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 722, in walkopts: Type annotation for revspec does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 725, in walkopts: Type annotation for bookmarks does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 726, in walkopts: Type annotation for branches does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 727, in walkopts: Type annotation for date does not match type of assignment [annotation-type-mismatch] Annotation: Optional[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 728, in walkopts: Type annotation for keywords does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 729, in walkopts: Type annotation for no_merges does not match type of assignment [annotation-type-mismatch] Annotation: bool Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 730, in walkopts: Type annotation for only_merges does not match type of assignment [annotation-type-mismatch] Annotation: bool Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 731, in walkopts: Type annotation for prune_ancestors does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 732, in walkopts: Type annotation for users does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 735, in walkopts: Type annotation for include_pats does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 736, in walkopts: Type annotation for exclude_pats does not match type of assignment [annotation-type-mismatch] Annotation: List[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 739, in walkopts: Type annotation for follow does not match type of assignment [annotation-type-mismatch] Annotation: int Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 743, in walkopts: Type annotation for force_changelog_traversal does not match type of assignment [annotation-type-mismatch] Annotation: bool Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 747, in walkopts: Type annotation for filter_revisions_by_pats does not match type of assignment [annotation-type-mismatch] Annotation: bool Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 750, in walkopts: Type annotation for sort_revisions does not match type of assignment [annotation-type-mismatch] Annotation: Optional[bytes] Assignment: mercurial.thirdparty.attr._make._CountingAttr File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 753, in walkopts: Type annotation for limit does not match type of assignment [annotation-type-mismatch] Annotation: Optional[int] Assignment: mercurial.thirdparty.attr._make._CountingAttr Differential Revision: https://phab.mercurial-scm.org/D11474
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 20 Sep 2021 11:22:27 -0400
parents 7a430116f639
children 5ced12cfa41b
comparison
equal deleted inserted replaced
48013:376d08ae904f 48014:0dc4cc654d96
44 if pycompat.TYPE_CHECKING: 44 if pycompat.TYPE_CHECKING:
45 from typing import ( 45 from typing import (
46 Any, 46 Any,
47 Callable, 47 Callable,
48 Dict, 48 Dict,
49 List,
50 Optional, 49 Optional,
51 Sequence, 50 Sequence,
52 Tuple, 51 Tuple,
53 ) 52 )
54 53
55 for t in (Any, Callable, Dict, List, Optional, Tuple): 54 for t in (Any, Callable, Dict, Optional, Tuple):
56 assert t 55 assert t
57 56
58 57
59 def getlimit(opts): 58 def getlimit(opts):
60 """get the log limit according to option -l/--limit""" 59 """get the log limit according to option -l/--limit"""
712 """Options to configure a set of revisions and file matcher factory 711 """Options to configure a set of revisions and file matcher factory
713 to scan revision/file history 712 to scan revision/file history
714 """ 713 """
715 714
716 # raw command-line parameters, which a matcher will be built from 715 # raw command-line parameters, which a matcher will be built from
717 pats = attr.ib() # type: List[bytes] 716 pats = attr.ib()
718 opts = attr.ib() # type: Dict[bytes, Any] 717 opts = attr.ib()
719 718
720 # a list of revset expressions to be traversed; if follow, it specifies 719 # a list of revset expressions to be traversed; if follow, it specifies
721 # the start revisions 720 # the start revisions
722 revspec = attr.ib() # type: List[bytes] 721 revspec = attr.ib()
723 722
724 # miscellaneous queries to filter revisions (see "hg help log" for details) 723 # miscellaneous queries to filter revisions (see "hg help log" for details)
725 bookmarks = attr.ib(default=attr.Factory(list)) # type: List[bytes] 724 bookmarks = attr.ib(default=attr.Factory(list))
726 branches = attr.ib(default=attr.Factory(list)) # type: List[bytes] 725 branches = attr.ib(default=attr.Factory(list))
727 date = attr.ib(default=None) # type: Optional[bytes] 726 date = attr.ib(default=None)
728 keywords = attr.ib(default=attr.Factory(list)) # type: List[bytes] 727 keywords = attr.ib(default=attr.Factory(list))
729 no_merges = attr.ib(default=False) # type: bool 728 no_merges = attr.ib(default=False)
730 only_merges = attr.ib(default=False) # type: bool 729 only_merges = attr.ib(default=False)
731 prune_ancestors = attr.ib(default=attr.Factory(list)) # type: List[bytes] 730 prune_ancestors = attr.ib(default=attr.Factory(list))
732 users = attr.ib(default=attr.Factory(list)) # type: List[bytes] 731 users = attr.ib(default=attr.Factory(list))
733 732
734 # miscellaneous matcher arguments 733 # miscellaneous matcher arguments
735 include_pats = attr.ib(default=attr.Factory(list)) # type: List[bytes] 734 include_pats = attr.ib(default=attr.Factory(list))
736 exclude_pats = attr.ib(default=attr.Factory(list)) # type: List[bytes] 735 exclude_pats = attr.ib(default=attr.Factory(list))
737 736
738 # 0: no follow, 1: follow first, 2: follow both parents 737 # 0: no follow, 1: follow first, 2: follow both parents
739 follow = attr.ib(default=0) # type: int 738 follow = attr.ib(default=0)
740 739
741 # do not attempt filelog-based traversal, which may be fast but cannot 740 # do not attempt filelog-based traversal, which may be fast but cannot
742 # include revisions where files were removed 741 # include revisions where files were removed
743 force_changelog_traversal = attr.ib(default=False) # type: bool 742 force_changelog_traversal = attr.ib(default=False)
744 743
745 # filter revisions by file patterns, which should be disabled only if 744 # filter revisions by file patterns, which should be disabled only if
746 # you want to include revisions where files were unmodified 745 # you want to include revisions where files were unmodified
747 filter_revisions_by_pats = attr.ib(default=True) # type: bool 746 filter_revisions_by_pats = attr.ib(default=True)
748 747
749 # sort revisions prior to traversal: 'desc', 'topo', or None 748 # sort revisions prior to traversal: 'desc', 'topo', or None
750 sort_revisions = attr.ib(default=None) # type: Optional[bytes] 749 sort_revisions = attr.ib(default=None)
751 750
752 # limit number of changes displayed; None means unlimited 751 # limit number of changes displayed; None means unlimited
753 limit = attr.ib(default=None) # type: Optional[int] 752 limit = attr.ib(default=None)
754 753
755 754
756 def parseopts(ui, pats, opts): 755 def parseopts(ui, pats, opts):
757 # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts 756 # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
758 """Parse log command options into walkopts 757 """Parse log command options into walkopts