Let pipeable.output be a public function.

This commit is contained in:
voussoir 2022-01-26 21:42:44 -08:00
parent e34f3e6c32
commit 797b4efd89
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -169,7 +169,7 @@ def input_many(args, *input_args, **input_kwargs):
for arg in args: for arg in args:
yield from input(arg, *input_args, **input_kwargs) yield from input(arg, *input_args, **input_kwargs)
def _output(stream, line, end): def output(stream, line, *, end):
line = str(line) line = str(line)
stream.write(line) stream.write(line)
if not line.endswith(end): if not line.endswith(end):
@ -180,12 +180,12 @@ def _output(stream, line, end):
def stdout(line='', end='\n'): def stdout(line='', end='\n'):
# In pythonw, stdout is None. # In pythonw, stdout is None.
if sys.stdout is not None: if sys.stdout is not None:
_output(sys.stdout, line, end) output(sys.stdout, line, end=end)
def stderr(line='', end='\n'): def stderr(line='', end='\n'):
# In pythonw, stderr is None. # In pythonw, stderr is None.
if sys.stderr is not None: if sys.stderr is not None:
_output(sys.stderr, line, end) output(sys.stderr, line, end=end)
# In pythonw, stdin and stdout are None. # In pythonw, stdin and stdout are None.
def stdin_tty(): def stdin_tty():