D11474: typing: drop annotations on `mercurial/logcmdutil.walkopts` attributes
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Tue Sep 21 15:39:18 UTC 2021
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Pytype 2021-09-09 must have learned some things about `@attr`, because while
these were presumably required to help it before (c1d0f83d62c4 <https://phab.mercurial-scm.org/rHGc1d0f83d62c4174fc80668e797292bb520d237e9>::9a26fea2b518 <https://phab.mercurial-scm.org/rHG9a26fea2b5187b1dd881b42962df603fa6322e1c> and
c11099cc1de4 <https://phab.mercurial-scm.org/rHGc11099cc1de47df03d8818cd0aa2a6fee0588578>::224c786f4fce <https://phab.mercurial-scm.org/rHG224c786f4fcebc3fe359e262b640b6ad4a6f3163>), 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
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11474
AFFECTED FILES
mercurial/logcmdutil.py
CHANGE DETAILS
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -46,13 +46,12 @@
Any,
Callable,
Dict,
- List,
Optional,
Sequence,
Tuple,
)
- for t in (Any, Callable, Dict, List, Optional, Tuple):
+ for t in (Any, Callable, Dict, Optional, Tuple):
assert t
@@ -714,43 +713,43 @@
"""
# raw command-line parameters, which a matcher will be built from
- pats = attr.ib() # type: List[bytes]
- opts = attr.ib() # type: Dict[bytes, Any]
+ pats = attr.ib()
+ opts = attr.ib()
# a list of revset expressions to be traversed; if follow, it specifies
# the start revisions
- revspec = attr.ib() # type: List[bytes]
+ revspec = attr.ib()
# miscellaneous queries to filter revisions (see "hg help log" for details)
- bookmarks = attr.ib(default=attr.Factory(list)) # type: List[bytes]
- branches = attr.ib(default=attr.Factory(list)) # type: List[bytes]
- date = attr.ib(default=None) # type: Optional[bytes]
- keywords = attr.ib(default=attr.Factory(list)) # type: List[bytes]
- no_merges = attr.ib(default=False) # type: bool
- only_merges = attr.ib(default=False) # type: bool
- prune_ancestors = attr.ib(default=attr.Factory(list)) # type: List[bytes]
- users = attr.ib(default=attr.Factory(list)) # type: List[bytes]
+ bookmarks = attr.ib(default=attr.Factory(list))
+ branches = attr.ib(default=attr.Factory(list))
+ date = attr.ib(default=None)
+ keywords = attr.ib(default=attr.Factory(list))
+ no_merges = attr.ib(default=False)
+ only_merges = attr.ib(default=False)
+ prune_ancestors = attr.ib(default=attr.Factory(list))
+ users = attr.ib(default=attr.Factory(list))
# miscellaneous matcher arguments
- include_pats = attr.ib(default=attr.Factory(list)) # type: List[bytes]
- exclude_pats = attr.ib(default=attr.Factory(list)) # type: List[bytes]
+ include_pats = attr.ib(default=attr.Factory(list))
+ exclude_pats = attr.ib(default=attr.Factory(list))
# 0: no follow, 1: follow first, 2: follow both parents
- follow = attr.ib(default=0) # type: int
+ follow = attr.ib(default=0)
# do not attempt filelog-based traversal, which may be fast but cannot
# include revisions where files were removed
- force_changelog_traversal = attr.ib(default=False) # type: bool
+ force_changelog_traversal = attr.ib(default=False)
# filter revisions by file patterns, which should be disabled only if
# you want to include revisions where files were unmodified
- filter_revisions_by_pats = attr.ib(default=True) # type: bool
+ filter_revisions_by_pats = attr.ib(default=True)
# sort revisions prior to traversal: 'desc', 'topo', or None
- sort_revisions = attr.ib(default=None) # type: Optional[bytes]
+ sort_revisions = attr.ib(default=None)
# limit number of changes displayed; None means unlimited
- limit = attr.ib(default=None) # type: Optional[int]
+ limit = attr.ib(default=None)
def parseopts(ui, pats, opts):
To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list