From dfd65b43f343364cae952084e6f36ecd6dca93ff Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Mon, 14 Mar 2016 22:27:15 -0700 Subject: [PATCH] use an empty (unicode_literal) string to trick future print() [function] to producing unicode strings rather than Py2 byte strings --- tldp/driver.py | 16 ++++++++-------- tldp/outputs.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tldp/driver.py b/tldp/driver.py index c2aad81..2286443 100644 --- a/tldp/driver.py +++ b/tldp/driver.py @@ -55,7 +55,7 @@ def show_doctypes(config, *args, **kwargs): return ERR_EXTRAARGS + ' '.join(args) file = kwargs.get('file', sys.stdout) print("Supported source document types:", file=file) - print(file=file) + print('', file=file) for doctype in knowndoctypes: classname = doctype.__name__ fname = os.path.abspath(inspect.getmodule(doctype).__file__) @@ -66,8 +66,8 @@ def show_doctypes(config, *args, **kwargs): print(' file extensions: {}'.format(extensions), file=file) for signature in doctype.signatures: print(' signature: {}'.format(signature), file=file) - print(file=file) - print(file=file) + print('', file=file) + print('', file=file) return os.EX_OK @@ -77,20 +77,20 @@ def show_statustypes(config, *args, **kwargs): file = kwargs.get('file', sys.stdout) width = 2 + max([len(x) for x in status_types]) print("Basic status types:", file=file) - print(file=file) + print('', file=file) for status, descrip in stypes.items(): fmt = '{status:>{width}}: {descrip}' text = fmt.format(status=status, descrip=descrip, width=width) print(text, file=file) - print(file=file) + print('', file=file) print("Synonyms and groups:", file=file) - print(file=file) + print('', file=file) for status, descrip in status_classes.items(): fmt = '{status:>{width}}: {descrip}' descrip = ', '.join(descrip) text = fmt.format(status=status, descrip=descrip, width=width) print(text, file=file) - print(file=file) + print('', file=file) return os.EX_OK @@ -151,7 +151,7 @@ def summary(config, *args, **kwargs): if abbrev: s = s + ', and %d more ...' % (len(abbrev)) print(s, file=file) - print(file=file) + print('', file=file) return os.EX_OK diff --git a/tldp/outputs.py b/tldp/outputs.py index a602195..0eeea0d 100644 --- a/tldp/outputs.py +++ b/tldp/outputs.py @@ -128,7 +128,7 @@ class OutputDirectory(OutputNamingConvention): def detail(self, widths, verbose, file=sys.stdout): template = '{s.status:{w.status}} {s.stem:{w.stem}}' outstr = template.format(s=self, w=widths) - print(outstr) + print(outstr, file=file) if verbose: print(' missing source', file=file)