From 0d18e8812cfead09c0ce1dfbc213c4200a5ee230 Mon Sep 17 00:00:00 2001 From: xuanyandong Date: Sun, 3 Jan 2021 15:37:53 +0800 Subject: Remove unicode from code Change-Id: I040fccd1714dccd7a87aaf10d397ad3a3ef476d3 --- cliff/formatters/value.py | 2 +- cliff/tests/test_app.py | 2 +- cliff/tests/test_columns.py | 2 +- cliff/tests/test_formatters_csv.py | 10 +++++----- demoapp/cliffdemo/encoding.py | 4 ++-- doc/source/conf.py | 16 ++++++++-------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cliff/formatters/value.py b/cliff/formatters/value.py index d4e646a..5889d2b 100644 --- a/cliff/formatters/value.py +++ b/cliff/formatters/value.py @@ -29,7 +29,7 @@ class ValueFormatter(base.ListFormatter, base.SingleFormatter): str(c.machine_readable() if isinstance(c, columns.FormattableColumn) else c) - for c in row) + u'\n') + for c in row) + '\n') return def emit_one(self, column_names, data, stdout, parsed_args): diff --git a/cliff/tests/test_app.py b/cliff/tests/test_app.py index 41a28b7..12a42f4 100644 --- a/cliff/tests/test_app.py +++ b/cliff/tests/test_app.py @@ -493,7 +493,7 @@ class TestIO(base.TestBase): # The word "test" with the e replaced by # Unicode latin small letter e with acute, # U+00E9, utf-8 encoded as 0xC3 0xA9 - text = u't\u00E9st' + text = 't\u00E9st' text_utf8 = text.encode('utf-8') # In PY3 you can't write encoded bytes to a text writer diff --git a/cliff/tests/test_columns.py b/cliff/tests/test_columns.py index fef1128..564620d 100644 --- a/cliff/tests/test_columns.py +++ b/cliff/tests/test_columns.py @@ -18,7 +18,7 @@ from cliff import columns class FauxColumn(columns.FormattableColumn): def human_readable(self): - return u'I made this string myself: {}'.format(self._value) + return 'I made this string myself: {}'.format(self._value) class TestColumns(unittest.TestCase): diff --git a/cliff/tests/test_formatters_csv.py b/cliff/tests/test_formatters_csv.py index 608137e..c34a0e0 100644 --- a/cliff/tests/test_formatters_csv.py +++ b/cliff/tests/test_formatters_csv.py @@ -69,12 +69,12 @@ class TestCSVFormatter(unittest.TestCase): def test_commaseparated_list_formatter_unicode(self): sf = commaseparated.CSVLister() - c = (u'a', u'b', u'c') - d1 = (u'A', u'B', u'C') - happy = u'高兴' - d2 = (u'D', u'E', happy) + c = ('a', 'b', 'c') + d1 = ('A', 'B', 'C') + happy = '高兴' + d2 = ('D', 'E', happy) data = [d1, d2] - expected = u'a,b,c\nA,B,C\nD,E,%s\n' % happy + expected = 'a,b,c\nA,B,C\nD,E,%s\n' % happy output = io.StringIO() parsed_args = mock.Mock() parsed_args.quote_mode = 'none' diff --git a/demoapp/cliffdemo/encoding.py b/demoapp/cliffdemo/encoding.py index 6c6c751..4aac578 100644 --- a/demoapp/cliffdemo/encoding.py +++ b/demoapp/cliffdemo/encoding.py @@ -13,8 +13,8 @@ class Encoding(Lister): def take_action(self, parsed_args): messages = [ - u'pi: π', - u'GB18030:鼀丅㐀ٸཌྷᠧꌢ€', + 'pi: π', + 'GB18030:鼀丅㐀ٸཌྷᠧꌢ€', ] return ( ('UTF-8', 'Unicode'), diff --git a/doc/source/conf.py b/doc/source/conf.py index 7686f1b..acc977c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -69,8 +69,8 @@ source_encoding = 'utf-8-sig' master_doc = 'index' # General information about the project. -project = u'cliff' -copyright = u'2012-%s, Doug Hellmann' % datetime.datetime.today().year +project = 'cliff' +copyright = '2012-%s, Doug Hellmann' % datetime.datetime.today().year # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -209,8 +209,8 @@ latex_elements = { # (source start file, target name, title, author, # documentclass [howto/manual]). latex_documents = [ - ('index', 'cliff.tex', u'cliff Documentation', - u'Doug Hellmann', 'manual'), + ('index', 'cliff.tex', 'cliff Documentation', + 'Doug Hellmann', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -239,8 +239,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'cliff', u'cliff Documentation', - [u'Doug Hellmann'], 1) + ('index', 'cliff', 'cliff Documentation', + ['Doug Hellmann'], 1) ] # If true, show URL addresses after external links. @@ -253,8 +253,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'cliff', u'cliff Documentation', - u'Doug Hellmann', 'cliff', 'One line description of project.', + ('index', 'cliff', 'cliff Documentation', + 'Doug Hellmann', 'cliff', 'One line description of project.', 'Miscellaneous'), ] -- cgit v1.2.1