Patchwork D10207: typing: disable import error warnings that are already handled

login
register
mail settings
Submitter phabricator
Date March 13, 2021, 7:34 p.m.
Message ID <differential-rev-PHID-DREV-5xuvvm22y2cu227yqcf7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48528/
State Superseded
Headers show

Comments

phabricator - March 13, 2021, 7:34 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm assuming that the cffi ones are handled somewhere, but the others definitely
  are.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/cffi/bdiff.py
  mercurial/cffi/mpatch.py
  mercurial/cffi/osutil.py
  mercurial/debugcommands.py
  mercurial/sslutil.py
  mercurial/testing/revlog.py
  mercurial/urllibcompat.py
  mercurial/utils/hashutil.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/hashutil.py b/mercurial/utils/hashutil.py
--- a/mercurial/utils/hashutil.py
+++ b/mercurial/utils/hashutil.py
@@ -3,7 +3,7 @@ 
 import hashlib
 
 try:
-    from ..thirdparty import sha1dc
+    from ..thirdparty import sha1dc  # pytype: disable=import-error
 
     sha1 = sha1dc.sha1
 except (ImportError, AttributeError):
diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py
--- a/mercurial/urllibcompat.py
+++ b/mercurial/urllibcompat.py
@@ -148,6 +148,7 @@ 
 
 
 else:
+    # pytype: disable=import-error
     import BaseHTTPServer
     import CGIHTTPServer
     import SimpleHTTPServer
@@ -155,6 +156,8 @@ 
     import urllib
     import urlparse
 
+    # pytype: enable=import-error
+
     urlreq._registeraliases(
         urllib,
         (
diff --git a/mercurial/testing/revlog.py b/mercurial/testing/revlog.py
--- a/mercurial/testing/revlog.py
+++ b/mercurial/testing/revlog.py
@@ -24,7 +24,7 @@ 
 
 
 try:
-    from ..cext import parsers as cparsers
+    from ..cext import parsers as cparsers  # pytype: disable=import-error
 except ImportError:
     cparsers = None
 
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -269,7 +269,7 @@ 
 
     if b'SSLKEYLOGFILE' in encoding.environ:
         try:
-            import sslkeylog
+            import sslkeylog  # pytype: disable=import-error
 
             sslkeylog.set_keylog(
                 pycompat.fsdecode(encoding.environ[b'SSLKEYLOGFILE'])
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1622,7 +1622,7 @@ 
     )
 
     try:
-        from . import rustext
+        from . import rustext  # pytype: disable=import-error
 
         rustext.__doc__  # trigger lazy import
     except ImportError:
diff --git a/mercurial/cffi/osutil.py b/mercurial/cffi/osutil.py
--- a/mercurial/cffi/osutil.py
+++ b/mercurial/cffi/osutil.py
@@ -15,7 +15,7 @@ 
 from .. import pycompat
 
 if pycompat.isdarwin:
-    from . import _osutil
+    from . import _osutil  # pytype: disable=import-error
 
     ffi = _osutil.ffi
     lib = _osutil.lib
diff --git a/mercurial/cffi/mpatch.py b/mercurial/cffi/mpatch.py
--- a/mercurial/cffi/mpatch.py
+++ b/mercurial/cffi/mpatch.py
@@ -9,7 +9,7 @@ 
 
 from ..pure.mpatch import *
 from ..pure.mpatch import mpatchError  # silence pyflakes
-from . import _mpatch
+from . import _mpatch  # pytype: disable=import-error
 
 ffi = _mpatch.ffi
 lib = _mpatch.lib
diff --git a/mercurial/cffi/bdiff.py b/mercurial/cffi/bdiff.py
--- a/mercurial/cffi/bdiff.py
+++ b/mercurial/cffi/bdiff.py
@@ -10,7 +10,7 @@ 
 import struct
 
 from ..pure.bdiff import *
-from . import _bdiff
+from . import _bdiff  # pytype: disable=import-error
 
 ffi = _bdiff.ffi
 lib = _bdiff.lib