# HG changeset patch # User Matt Harbison # Date 1639442046 18000 # Node ID d2fff292c265b8f09e70fb50b0719e8bbf37df6a # Parent c1fe758c1530e51a24066856df149a679f63b446 pytype: stop excluding statprof.py This seems to have worked fine before (at least on Linux). We could just add suppression comments, but this file already imports from the mercurial package, which seems to prevent this from running as a standalone program because of the relative import of `pycompat`. PyCharm isn't happy either way. File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 501, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 1091, in main File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 501, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 431, in profile File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 522, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 1091, in main File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 522, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 431, in profile File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 523, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 1091, in main File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 523, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 431, in profile File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 524, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 1091, in main File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 524, in display: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Called from (traceback): line 431, in profile File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 796, in _write: Function TextIO.write was called with the wrong arguments [wrong-arg-types] Expected: (self, s: str) Actually passed: (self, s: bytes) Differential Revision: https://phab.mercurial-scm.org/D11921 diff -r c1fe758c1530 -r d2fff292c265 mercurial/statprof.py --- a/mercurial/statprof.py Mon Dec 13 17:59:36 2021 -0500 +++ b/mercurial/statprof.py Mon Dec 13 19:34:06 2021 -0500 @@ -494,9 +494,9 @@ data = state if fp is None: - import sys + from .utils import procutil - fp = sys.stdout + fp = procutil.stdout if len(data.samples) == 0: fp.write(b'No samples recorded.\n') return diff -r c1fe758c1530 -r d2fff292c265 tests/test-check-pytype.t --- a/tests/test-check-pytype.t Mon Dec 13 17:59:36 2021 -0500 +++ b/tests/test-check-pytype.t Mon Dec 13 19:34:06 2021 -0500 @@ -32,7 +32,6 @@ mercurial/pycompat.py # bytes vs str issues mercurial/repoview.py # [attribute-error] mercurial/sslutil.py # [attribute-error] -mercurial/statprof.py # bytes vs str on TextIO.write() [wrong-arg-types] mercurial/testing/storage.py # tons of [attribute-error] mercurial/ui.py # [attribute-error], [wrong-arg-types] mercurial/unionrepo.py # ui, svfs, unfiltered [attribute-error] @@ -72,7 +71,6 @@ > -x mercurial/pycompat.py \ > -x mercurial/repoview.py \ > -x mercurial/sslutil.py \ - > -x mercurial/statprof.py \ > -x mercurial/testing/storage.py \ > -x mercurial/thirdparty \ > -x mercurial/ui.py \