changeset 43704:23ad4f0c1578

debugcommands: add assertions to convince pytype peer is not None This function is moderately annoyingly defined, and peer is set up iff we're not in raw-proto mode. That's fine, but it confuses pytype. Adding these assertions is a low-overhead way to convince pytype we're doing reasonable things. Differential Revision: https://phab.mercurial-scm.org/D7407
author Augie Fackler <augie@google.com>
date Thu, 14 Nov 2019 13:27:57 -0500
parents a9b14ef701d1
children 1ea33dff7841
files mercurial/debugcommands.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Nov 13 22:35:15 2019 -0500
+++ b/mercurial/debugcommands.py	Thu Nov 14 13:27:57 2019 -0500
@@ -4161,6 +4161,7 @@
                 _(b'sending batch with %d sub-commands\n')
                 % len(batchedcommands)
             )
+            assert peer is not None
             for i, chunk in enumerate(peer._submitbatch(batchedcommands)):
                 ui.status(
                     _(b'response #%d: %s\n') % (i, stringutil.escapestr(chunk))
@@ -4241,6 +4242,7 @@
                 )
 
         elif action == b'close':
+            assert peer is not None
             peer.close()
         elif action == b'readavailable':
             if not stdout or not stderr: