changeset 43469:5f2a8dabb0d8

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
author Augie Fackler <augie@google.com>
date Wed, 06 Nov 2019 15:13:23 -0500
parents 8b0fa4de0064
children 32ac4d0b4102
files mercurial/encoding.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Wed Nov 06 15:19:23 2019 -0500
+++ b/mercurial/encoding.py	Wed Nov 06 15:13:23 2019 -0500
@@ -241,8 +241,15 @@
     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: