D7510: windows: suppress pytype warnings for Windows imports and functions
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Sat Nov 23 20:01:22 EST 2019
Closed by commit rHGc6060b243163: windows: suppress pytype warnings for Windows imports and functions (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D7510?vs=18335&id=18377
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7510/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7510
AFFECTED FILES
mercurial/pycompat.py
mercurial/scmwindows.py
mercurial/windows.py
CHANGE DETAILS
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -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):
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -10,11 +10,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
# MS-DOS 'more' is the only pager available by default on Windows.
fallbackpager = b'more'
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -99,7 +99,7 @@
# Otherwise non-ASCII filenames in existing repositories would be
# corrupted.
# This must be set once prior to any fsencode/fsdecode calls.
- sys._enablelegacywindowsfsencoding()
+ sys._enablelegacywindowsfsencoding() # pytype: disable=module-attr
fsencode = os.fsencode
fsdecode = os.fsdecode
To: mharbison72, #hg-reviewers, dlax, indygreg
Cc: indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list