# HG changeset patch # User Matt Harbison # Date 1648057900 14400 # Node ID d500df2e8034bc5da526b130f9911e29f0ed4e6d # Parent c75dae6e4ca7177683dc4a534f295fcf04831afa 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 diff -r c75dae6e4ca7 -r d500df2e8034 mercurial/scmwindows.py --- 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) diff -r c75dae6e4ca7 -r d500df2e8034 mercurial/windows.py --- 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: