changeset 48482:d2fff292c265

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
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 13 Dec 2021 19:34:06 -0500
parents c1fe758c1530
children 290f9c150f70
files mercurial/statprof.py tests/test-check-pytype.t
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 \