# HG changeset patch # User Augie Fackler <augie@google.com> # Date 2019-11-06 20:13:23 # Node ID 5f2a8dabb0d80f44913c89ff8540b7771d28a3f7 # Parent 8b0fa4de0064a7953f4cc6bd558becc6e0cb6c6d encoding: define local identify functions with explicit type comments This removes some obfuscation as far as pytype is concerned and corrects many bogus type errors. Differential Revision: https://phab.mercurial-scm.org/D7267 diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -241,8 +241,15 @@ if pycompat.ispy3: strfromlocal = unifromlocal strmethod = unimethod else: - strtolocal = pycompat.identity - strfromlocal = pycompat.identity + + def strtolocal(s): + # type: (str) -> bytes + return s + + def strfromlocal(s): + # type: (bytes) -> str + return s + strmethod = pycompat.identity if not _nativeenviron: