##// END OF EJS Templates
pytype: disable a few errors about Windows specific module attributes...
Matt Harbison -
r49843:d500df2e default
parent child Browse files
Show More
@@ -52,7 +52,11 b' def systemrcpath():'
52
52
53 # next look for a system rcpath in the registry
53 # next look for a system rcpath in the registry
54 value = util.lookupreg(
54 value = util.lookupreg(
55 b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE
55 # pytype: disable=module-attr
56 b'SOFTWARE\\Mercurial',
57 None,
58 winreg.HKEY_LOCAL_MACHINE
59 # pytype: enable=module-attr
56 )
60 )
57 if value and isinstance(value, bytes):
61 if value and isinstance(value, bytes):
58 value = util.localpath(value)
62 value = util.localpath(value)
@@ -676,14 +676,21 b' def lookupreg(key, valname=None, scope=N'
676 LOCAL_MACHINE).
676 LOCAL_MACHINE).
677 """
677 """
678 if scope is None:
678 if scope is None:
679 # pytype: disable=module-attr
679 scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
680 scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
681 # pytype: enable=module-attr
680 elif not isinstance(scope, (list, tuple)):
682 elif not isinstance(scope, (list, tuple)):
681 scope = (scope,)
683 scope = (scope,)
682 for s in scope:
684 for s in scope:
683 try:
685 try:
686 # pytype: disable=module-attr
684 with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
687 with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
688 # pytype: enable=module-attr
685 name = valname and encoding.strfromlocal(valname) or valname
689 name = valname and encoding.strfromlocal(valname) or valname
690 # pytype: disable=module-attr
686 val = winreg.QueryValueEx(hkey, name)[0]
691 val = winreg.QueryValueEx(hkey, name)[0]
692 # pytype: enable=module-attr
693
687 # never let a Unicode string escape into the wild
694 # never let a Unicode string escape into the wild
688 return encoding.unitolocal(val)
695 return encoding.unitolocal(val)
689 except EnvironmentError:
696 except EnvironmentError:
General Comments 0
You need to be logged in to leave comments. Login now