diff mercurial/windows.py @ 43788:fe73ec69350e

windows: suppress pytype warnings for Windows imports and functions This should allow the modules to not be excluded, and not generate complaints on non Windows platforms. Differential Revision: https://phab.mercurial-scm.org/D7510
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 22 Nov 2019 23:55:57 -0500
parents 9f70512ae2cf
children be8552f25cab
line wrap: on
line diff
--- a/mercurial/windows.py	Sat Nov 23 16:54:59 2019 -0800
+++ b/mercurial/windows.py	Fri Nov 22 23:55:57 2019 -0500
@@ -26,11 +26,12 @@
 )
 
 try:
-    import _winreg as winreg
+    import _winreg as winreg  # pytype: disable=import-error
 
     winreg.CloseKey
 except ImportError:
-    import winreg
+    # py2 only
+    import winreg  # pytype: disable=import-error
 
 osutil = policy.importmod('osutil')
 
@@ -282,7 +283,7 @@
     # fileno(), usually set to -1.
     fno = getattr(fd, 'fileno', None)
     if fno is not None and fno() >= 0:
-        msvcrt.setmode(fno(), os.O_BINARY)
+        msvcrt.setmode(fno(), os.O_BINARY)  # pytype: disable=module-attr
 
 
 def pconvert(path):