comparison mercurial/i18n.py @ 48934:06de08b36c82

py3: use str instead of pycompat.unicode pycompat.unicode is an alias to str. Differential Revision: https://phab.mercurial-scm.org/D12340
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 11:24:57 -0700
parents 6000f5b25c9b
children 18c8c18993f0
comparison
equal deleted inserted replaced
48933:78f1de3f4be7 48934:06de08b36c82
83 if message is None or not _ugettext: 83 if message is None or not _ugettext:
84 return message 84 return message
85 85
86 cache = _msgcache.setdefault(encoding.encoding, {}) 86 cache = _msgcache.setdefault(encoding.encoding, {})
87 if message not in cache: 87 if message not in cache:
88 if type(message) is pycompat.unicode: 88 if type(message) is str:
89 # goofy unicode docstrings in test 89 # goofy unicode docstrings in test
90 paragraphs = message.split(u'\n\n') # type: List[pycompat.unicode] 90 paragraphs = message.split(u'\n\n') # type: List[str]
91 else: 91 else:
92 # should be ascii, but we have unicode docstrings in test, which 92 # should be ascii, but we have unicode docstrings in test, which
93 # are converted to utf-8 bytes on Python 3. 93 # are converted to utf-8 bytes on Python 3.
94 paragraphs = [p.decode("utf-8") for p in message.split(b'\n\n')] 94 paragraphs = [p.decode("utf-8") for p in message.split(b'\n\n')]
95 # Be careful not to translate the empty string -- it holds the 95 # Be careful not to translate the empty string -- it holds the