Remove unicode from code

Change-Id: I040fccd1714dccd7a87aaf10d397ad3a3ef476d3
This commit is contained in:
xuanyandong 2021-01-03 15:37:53 +08:00 committed by Stephen Finucane
parent b04cba81ac
commit 0d18e8812c
6 changed files with 18 additions and 18 deletions

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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'

View File

@ -13,8 +13,8 @@ class Encoding(Lister):
def take_action(self, parsed_args):
messages = [
u'pi: π',
u'GB18030:鼀丅㐀ٸཌྷᠧꌢ€',
'pi: π',
'GB18030:鼀丅㐀ٸཌྷᠧꌢ€',
]
return (
('UTF-8', 'Unicode'),

View File

@ -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'),
]