changeset 49065:d500df2e8034

pytype: disable a few errors about Windows specific module attributes These were flagged by pytype 2022.03.21. Differential Revision: https://phab.mercurial-scm.org/D12401
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 23 Mar 2022 13:51:40 -0400
parents c75dae6e4ca7
children 8d7eaff92f9c
files mercurial/scmwindows.py mercurial/windows.py
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmwindows.py	Sat Mar 19 15:44:38 2022 +0100
+++ b/mercurial/scmwindows.py	Wed Mar 23 13:51:40 2022 -0400
@@ -52,7 +52,11 @@
 
     # next look for a system rcpath in the registry
     value = util.lookupreg(
-        b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE
+        # pytype: disable=module-attr
+        b'SOFTWARE\\Mercurial',
+        None,
+        winreg.HKEY_LOCAL_MACHINE
+        # pytype: enable=module-attr
     )
     if value and isinstance(value, bytes):
         value = util.localpath(value)
--- a/mercurial/windows.py	Sat Mar 19 15:44:38 2022 +0100
+++ b/mercurial/windows.py	Wed Mar 23 13:51:40 2022 -0400
@@ -676,14 +676,21 @@
     LOCAL_MACHINE).
     """
     if scope is None:
+        # pytype: disable=module-attr
         scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
+        # pytype: enable=module-attr
     elif not isinstance(scope, (list, tuple)):
         scope = (scope,)
     for s in scope:
         try:
+            # pytype: disable=module-attr
             with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
+                # pytype: enable=module-attr
                 name = valname and encoding.strfromlocal(valname) or valname
+                # pytype: disable=module-attr
                 val = winreg.QueryValueEx(hkey, name)[0]
+                # pytype: enable=module-attr
+
                 # never let a Unicode string escape into the wild
                 return encoding.unitolocal(val)
         except EnvironmentError: