Mercurial > hg-stable
changeset 39844:9e8fcd2e78c1
encoding: remove unnecessary lambdas from _encodingfixers
They have been unnecessary since 1a3a08b5d4d5 (encoding: remove
workaround for locale.getpreferredencoding(), 2017-05-13). Also rename
the variable since "fixer" sounds like a function.
Differential Revision: https://phab.mercurial-scm.org/D4743
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 25 Sep 2018 08:53:20 -0700 |
parents | bce1c1af7518 |
children | a9f56e4501c1 |
files | mercurial/encoding.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/encoding.py Tue Sep 25 18:59:04 2018 -0700 +++ b/mercurial/encoding.py Tue Sep 25 08:53:20 2018 -0700 @@ -68,21 +68,21 @@ environ = dict((k.encode(u'utf-8'), v.encode(u'utf-8')) for k, v in os.environ.items()) # re-exports -_encodingfixers = { - '646': lambda: 'ascii', - 'ANSI_X3.4-1968': lambda: 'ascii', +_encodingrewrites = { + '646': 'ascii', + 'ANSI_X3.4-1968': 'ascii', } # cp65001 is a Windows variant of utf-8, which isn't supported on Python 2. # No idea if it should be rewritten to the canonical name 'utf-8' on Python 3. # https://bugs.python.org/issue13216 if pycompat.iswindows and not pycompat.ispy3: - _encodingfixers['cp65001'] = lambda: 'utf-8' + _encodingrewrites['cp65001'] = 'utf-8' try: encoding = environ.get("HGENCODING") if not encoding: encoding = locale.getpreferredencoding().encode('ascii') or 'ascii' - encoding = _encodingfixers.get(encoding, lambda: encoding)() + encoding = _encodingrewrites.get(encoding, encoding) except locale.Error: encoding = 'ascii' encodingmode = environ.get("HGENCODINGMODE", "strict")