pytype: stop excluding changegroup.py
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 12 Dec 2021 21:10:02 -0500
changeset 48473 8843c9a8771b
parent 48472 a4d8de93023c
child 48474 abac7983d28e
pytype: stop excluding changegroup.py The false positives that were detected seem to be related to what happens to the variables after the local methods are used: File "/mnt/c/Users/Matt/hg/mercurial/changegroup.py", line 353, in ondupchangelog: No attribute 'append' on range [attribute-error] In Union[List[nothing], range] File "/mnt/c/Users/Matt/hg/mercurial/changegroup.py", line 357, in onchangelog: No attribute 'update' on None [attribute-error] Differential Revision: https://phab.mercurial-scm.org/D11912
mercurial/changegroup.py
tests/test-check-pytype.t
--- a/mercurial/changegroup.py	Sun Dec 12 20:01:05 2021 -0500
+++ b/mercurial/changegroup.py	Sun Dec 12 21:10:02 2021 -0500
@@ -350,10 +350,11 @@
 
             def ondupchangelog(cl, rev):
                 if rev < clstart:
-                    duprevs.append(rev)
+                    duprevs.append(rev)  # pytype: disable=attribute-error
 
             def onchangelog(cl, rev):
                 ctx = cl.changelogrevision(rev)
+                assert efilesset is not None  # help pytype
                 efilesset.update(ctx.files)
                 repo.register_changeset(rev, ctx)
 
--- a/tests/test-check-pytype.t	Sun Dec 12 20:01:05 2021 -0500
+++ b/tests/test-check-pytype.t	Sun Dec 12 21:10:02 2021 -0500
@@ -10,7 +10,6 @@
 probably hiding real problems.
 
 mercurial/bundlerepo.py       # no vfs and ui attrs on bundlerepo
-mercurial/changegroup.py      # mysterious incorrect type detection
 mercurial/chgserver.py        # [attribute-error]
 mercurial/cmdutil.py          # No attribute 'markcopied' on mercurial.context.filectx [attribute-error]
 mercurial/context.py          # many [attribute-error]
@@ -56,7 +55,6 @@
 
   $ pytype -V 3.6 --keep-going --jobs auto mercurial \
   >    -x mercurial/bundlerepo.py \
-  >    -x mercurial/changegroup.py \
   >    -x mercurial/chgserver.py \
   >    -x mercurial/cmdutil.py \
   >    -x mercurial/context.py \