Patchwork [1,of,2] procutil: make _make_write_all() function private

login
register
mail settings
Submitter Manuel Jacob
Date July 15, 2020, 1:18 p.m.
Message ID <8718b4d5e08f6f84df73.1594819125@tmp>
Download mbox | patch
Permalink /patch/46750/
State Accepted
Headers show

Comments

Manuel Jacob - July 15, 2020, 1:18 p.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1594818561 -7200
#      Wed Jul 15 15:09:21 2020 +0200
# Node ID 8718b4d5e08f6f84df73d1b846b340bbeeedb19c
# Parent  20a65e397943599bcf5ac759b119296443b699d1
# EXP-Topic stdio-nits
procutil: make _make_write_all() function private

Because this function isn’t meant for general use (e.g., it’s Python 2-only),
make in a module-private function by prefixing it with `_`.

Patch

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -100,7 +100,7 @@ 
 io.IOBase.register(WriteAllWrapper)
 
 
-def make_write_all(stream):
+def _make_write_all(stream):
     assert pycompat.ispy3
     if isinstance(stream, WriteAllWrapper):
         return stream
@@ -118,11 +118,11 @@ 
     # TODO: .buffer might not exist if std streams were replaced; we'll need
     # a silly wrapper to make a bytes stream backed by a unicode one.
     stdin = sys.stdin.buffer
-    stdout = make_write_all(sys.stdout.buffer)
+    stdout = _make_write_all(sys.stdout.buffer)
     if isatty(stdout):
         # The standard library doesn't offer line-buffered binary streams.
         stdout = make_line_buffered(stdout)
-    stderr = make_write_all(sys.stderr.buffer)
+    stderr = _make_write_all(sys.stderr.buffer)
 else:
     # Python 2 uses the I/O streams provided by the C library.
     stdin = sys.stdin