# HG changeset patch # User Martin von Zweigbergk # Date 1537890800 25200 # Node ID 9e8fcd2e78c1026ff157502db7877ec0c582df7c # Parent bce1c1af7518e87a6b8ee0761d8976c4b75da1b1 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 diff -r bce1c1af7518 -r 9e8fcd2e78c1 mercurial/encoding.py --- 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")