# HG changeset patch # User Augie Fackler # Date 2019-11-14 20:49:21 # Node ID ac8fd215a776b423d27720d6f0124d7f5e2d6a66 # Parent 1ea33dff78414f16d05e03fb73d4d325db1aff50 dispatch: add some assertions to give pytype a helping hand Differential Revision: https://phab.mercurial-scm.org/D7409 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -115,6 +115,8 @@ def run(): # In all cases we try to flush stdio streams. if util.safehasattr(req.ui, b'fout'): + assert req.ui is not None # help pytype + assert req.ui.fout is not None # help pytype try: req.ui.fout.flush() except IOError as e: @@ -122,6 +124,8 @@ def run(): status = -1 if util.safehasattr(req.ui, b'ferr'): + assert req.ui is not None # help pytype + assert req.ui.ferr is not None # help pytype try: if err is not None and err.errno != errno.EPIPE: req.ui.ferr.write( @@ -1108,6 +1112,7 @@ def _dispatch(req): repo = None cmdpats = args[:] + assert func is not None # help out pytype if not func.norepo: # use the repo from the request only if we don't have -R if not rpath and not cwd: