Mercurial > hg
changeset 46786:52528570312e stable
typing: disable module attribute warnings for properly conditionalized code
Differential Revision: https://phab.mercurial-scm.org/D10208
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 13 Mar 2021 00:40:46 -0500 |
parents | 521ac0d7047f |
children | 70f8c64812db |
files | mercurial/dispatch.py mercurial/pure/osutil.py mercurial/sslutil.py |
diffstat | 3 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Sat Mar 13 00:38:59 2021 -0500 +++ b/mercurial/dispatch.py Sat Mar 13 00:40:46 2021 -0500 @@ -173,7 +173,9 @@ "line_buffering": sys.stdout.line_buffering, } if util.safehasattr(sys.stdout, "write_through"): + # pytype: disable=attribute-error kwargs["write_through"] = sys.stdout.write_through + # pytype: enable=attribute-error sys.stdout = io.TextIOWrapper( sys.stdout.buffer, sys.stdout.encoding, @@ -187,7 +189,9 @@ "line_buffering": sys.stderr.line_buffering, } if util.safehasattr(sys.stderr, "write_through"): + # pytype: disable=attribute-error kwargs["write_through"] = sys.stderr.write_through + # pytype: enable=attribute-error sys.stderr = io.TextIOWrapper( sys.stderr.buffer, sys.stderr.encoding,
--- a/mercurial/pure/osutil.py Sat Mar 13 00:38:59 2021 -0500 +++ b/mercurial/pure/osutil.py Sat Mar 13 00:40:46 2021 -0500 @@ -172,7 +172,7 @@ else: import msvcrt - _kernel32 = ctypes.windll.kernel32 + _kernel32 = ctypes.windll.kernel32 # pytype: disable=module-attr _DWORD = ctypes.c_ulong _LPCSTR = _LPSTR = ctypes.c_char_p @@ -216,7 +216,7 @@ _kernel32.CreateFileA.restype = _HANDLE def _raiseioerror(name): - err = ctypes.WinError() + err = ctypes.WinError() # pytype: disable=module-attr raise IOError( err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) ) @@ -271,7 +271,7 @@ if fh == _INVALID_HANDLE_VALUE: _raiseioerror(name) - fd = msvcrt.open_osfhandle(fh, flags) + fd = msvcrt.open_osfhandle(fh, flags) # pytype: disable=module-attr if fd == -1: _kernel32.CloseHandle(fh) _raiseioerror(name)
--- a/mercurial/sslutil.py Sat Mar 13 00:38:59 2021 -0500 +++ b/mercurial/sslutil.py Sat Mar 13 00:40:46 2021 -0500 @@ -543,7 +543,9 @@ # Use the list of more secure ciphers if found in the ssl module. if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'): sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0) + # pytype: disable=module-attr sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS) + # pytype: enable=module-attr if requireclientcert: sslcontext.verify_mode = ssl.CERT_REQUIRED