comparison contrib/check-pytype.sh @ 49793:8147abc05794

pytype: stop excluding mercurial/ui.py ui.extractchoices() is perhaps making assumptions that it shouldn't about the pattern always matching, but presumably we have test coverage for that. PyCharm flags the updated classes with a warning "Class xxx must implement all abstract methods", and suggests adding `abc.ABC` to the superclasses. I'm not sure why, unless it doesn't recognize the `__getattr__()` delegation pattern. Additionally, we can't unconditionally subclass `typing.BinaryIO` because that defeats the `__getattr__` delegation to the wrapped object at runtime. Instead, it has to only subclass during the type checking phase[1]. In any event, this fixes: File "/mnt/c/Users/Matt/hg/mercurial/ui.py", line 1518, in _runpager: Function subprocess.Popen.__new__ was called with the wrong arguments [wrong-arg-types] Expected: (cls, args, bufsize, executable, stdin, stdout: Optional[Union[IO, int]] = ..., ...) Actually passed: (cls, args, bufsize, stdin, stdout: Union[mercurial.utils.procutil.WriteAllWrapper, mercurial.windows.winstdout], ...) File "/mnt/c/Users/Matt/hg/mercurial/ui.py", line 1798, in extractchoices: No attribute 'group' on None [attribute-error] In Optional[Match[bytes]] File "/mnt/c/Users/Matt/hg/mercurial/ui.py", line 1799, in extractchoices: No attribute 'group' on None [attribute-error] In Optional[Match[bytes]] [1] https://stackoverflow.com/q/71365594
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 25 Nov 2022 18:39:47 -0500
parents 3e1869751cfe
children 98e7be1ed6c5
comparison
equal deleted inserted replaced
49777:e1953a34c110 49793:8147abc05794
29 # mercurial/minirst.py # [unsupported-operands], [attribute-error] 29 # mercurial/minirst.py # [unsupported-operands], [attribute-error]
30 # mercurial/pure/osutil.py # [invalid-typevar], [not-callable] 30 # mercurial/pure/osutil.py # [invalid-typevar], [not-callable]
31 # mercurial/pure/parsers.py # [attribute-error] 31 # mercurial/pure/parsers.py # [attribute-error]
32 # mercurial/repoview.py # [attribute-error] 32 # mercurial/repoview.py # [attribute-error]
33 # mercurial/testing/storage.py # tons of [attribute-error] 33 # mercurial/testing/storage.py # tons of [attribute-error]
34 # mercurial/ui.py # [attribute-error], [wrong-arg-types]
35 # mercurial/unionrepo.py # ui, svfs, unfiltered [attribute-error] 34 # mercurial/unionrepo.py # ui, svfs, unfiltered [attribute-error]
36 # mercurial/win32.py # [not-callable] 35 # mercurial/win32.py # [not-callable]
37 # mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], [import-error] 36 # mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], [import-error]
38 # mercurial/wireprotov1peer.py # [attribute-error] 37 # mercurial/wireprotov1peer.py # [attribute-error]
39 # mercurial/wireprotov1server.py # BUG?: BundleValueError handler accesses subclass's attrs 38 # mercurial/wireprotov1server.py # BUG?: BundleValueError handler accesses subclass's attrs
62 -x mercurial/pure/osutil.py \ 61 -x mercurial/pure/osutil.py \
63 -x mercurial/pure/parsers.py \ 62 -x mercurial/pure/parsers.py \
64 -x mercurial/repoview.py \ 63 -x mercurial/repoview.py \
65 -x mercurial/testing/storage.py \ 64 -x mercurial/testing/storage.py \
66 -x mercurial/thirdparty \ 65 -x mercurial/thirdparty \
67 -x mercurial/ui.py \
68 -x mercurial/unionrepo.py \ 66 -x mercurial/unionrepo.py \
69 -x mercurial/win32.py \ 67 -x mercurial/win32.py \
70 -x mercurial/wireprotoframing.py \ 68 -x mercurial/wireprotoframing.py \
71 -x mercurial/wireprotov1peer.py \ 69 -x mercurial/wireprotov1peer.py \
72 -x mercurial/wireprotov1server.py 70 -x mercurial/wireprotov1server.py