Patchwork D7385: debugcommands: suppress import errors for pytype

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2019, 3:52 a.m.
Message ID <differential-rev-PHID-DREV-c6iykmzknz7gpq2oxyqx-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43181/
State Superseded
Headers show

Comments

phabricator - Nov. 14, 2019, 3:52 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7385

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 14, 2019, 10:02 a.m.
dlax added a comment.
dlax accepted this revision.


  I wonder if using `importlib.import_module()` wouldn't help. Or is it something we avoid in Mercurial?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7385/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7385

To: durin42, #hg-reviewers, dlax
Cc: dlax, mercurial-devel
phabricator - Nov. 14, 2019, 9:16 p.m.
durin42 added a comment.


  In D7385#108592 <https://phab.mercurial-scm.org/D7385#108592>, @dlax wrote:
  
  > I wonder if using `importlib.import_module()` wouldn't help. Or is it something we avoid in Mercurial?
  
  We use it in other places. I have no idea the extent to which it'd help.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7385/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7385

To: durin42, #hg-reviewers, dlax
Cc: dlax, mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1543,7 +1543,7 @@ 
         err = None
         try:
             if cext:
-                from .cext import (
+                from .cext import (  # pytype: disable=import-error
                     base85,
                     bdiff,
                     mpatch,
@@ -1553,7 +1553,7 @@ 
                 # quiet pyflakes
                 dir(bdiff), dir(mpatch), dir(base85), dir(osutil)
             if rustext:
-                from .rustext import (
+                from .rustext import (  # pytype: disable=import-error
                     ancestor,
                     dirstate,
                 )