typing: narrow the scope of some recent disabled import warnings
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 24 Jul 2024 18:17:00 -0400
changeset 51731 92845af308b4
parent 51729 278af66e6595
child 51732 43460c311c0c
typing: narrow the scope of some recent disabled import warnings These comments were added in 39e2b2d062c1, but had the effect of changing the known type to `Any`, which cascaded through a few function signatures. Just ignore the import error instead.
mercurial/chgserver.py
mercurial/policy.py
mercurial/util.py
--- a/mercurial/chgserver.py	Tue Jul 23 19:20:22 2024 -0400
+++ b/mercurial/chgserver.py	Wed Jul 24 18:17:00 2024 -0400
@@ -151,7 +151,7 @@
     """
     modules = [m for n, m in extensions.extensions(ui)]
     try:
-        from . import __version__  # type: ignore
+        from . import __version__  # pytype: disable=import-error
 
         modules.append(__version__)
     except ImportError:
--- a/mercurial/policy.py	Tue Jul 23 19:20:22 2024 -0400
+++ b/mercurial/policy.py	Wed Jul 24 18:17:00 2024 -0400
@@ -45,7 +45,7 @@
 }
 
 try:
-    from . import __modulepolicy__  # type: ignore
+    from . import __modulepolicy__  # pytype: disable=import-error
 
     policy: bytes = __modulepolicy__.modulepolicy
 except ImportError:
--- a/mercurial/util.py	Tue Jul 23 19:20:22 2024 -0400
+++ b/mercurial/util.py	Wed Jul 24 18:17:00 2024 -0400
@@ -1162,7 +1162,7 @@
 def version():
     """Return version information if available."""
     try:
-        from . import __version__  # type: ignore
+        from . import __version__  # pytype: disable=import-error
 
         return __version__.version
     except ImportError: