# HG changeset patch # User Matt Harbison # Date 2021-12-13 21:42:36 # Node ID cfb4f1dee97806b54096210964273b2d87a6e8fa # Parent dcdecec401ca31cc52379286c1f2912f1e946cf7 pytype: stop excluding wireprotov2server.py This fixes: File "/mnt/c/Users/Matt/hg/mercurial/wireprotov2server.py", line 584, in _capabilitiesv2: unsupported operand type(s) for item assignment: Set[bytes] [unsupported-operands] No attribute '__setitem__' on Set[bytes] File "/mnt/c/Users/Matt/hg/mercurial/wireprotov2server.py", line 611, in _capabilitiesv2: No attribute 'append' on dict [attribute-error] In Union[List[bytes], List[nothing], dict] Called from (traceback): line 543, in httpv2apidescriptor Differential Revision: https://phab.mercurial-scm.org/D11919 diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py --- a/mercurial/wireprotov2server.py +++ b/mercurial/wireprotov2server.py @@ -579,10 +579,12 @@ def _capabilitiesv2(repo, proto): ): continue + # pytype: disable=unsupported-operands caps[b'commands'][command] = { b'args': args, b'permissions': [entry.permission], } + # pytype: enable=unsupported-operands if entry.extracapabilitiesfn: extracaps = entry.extracapabilitiesfn(repo, proto) @@ -608,7 +610,9 @@ def _capabilitiesv2(repo, proto): if key in target: entry[key] = target[key] + # pytype: disable=attribute-error caps[b'redirect'][b'targets'].append(entry) + # pytype: enable=attribute-error return proto.addcapabilities(repo, caps) diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t --- a/tests/test-check-pytype.t +++ b/tests/test-check-pytype.t @@ -44,7 +44,6 @@ mercurial/wireprotoframing.py # [unsuppo mercurial/wireprotoserver.py # line 253, in _availableapis: No attribute '__iter__' on Callable[[Any, Any], Any] [attribute-error] mercurial/wireprotov1peer.py # [attribute-error] mercurial/wireprotov1server.py # BUG?: BundleValueError handler accesses subclass's attrs -mercurial/wireprotov2server.py # [unsupported-operands], [attribute-error] TODO: use --no-cache on test server? Caching the files locally helps during development, but may be a hinderance for CI testing. @@ -85,7 +84,6 @@ development, but may be a hinderance for > -x mercurial/wireprotoserver.py \ > -x mercurial/wireprotov1peer.py \ > -x mercurial/wireprotov1server.py \ - > -x mercurial/wireprotov2server.py \ > > $TESTTMP/pytype-output.txt || cat $TESTTMP/pytype-output.txt Only show the results on a failure, because the output on success is also