Patchwork D7267: encoding: define local identify functions with explicit type comments

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 10:57 p.m.
Message ID <differential-rev-PHID-DREV-nkaeijftm5ee64pzbdwa-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42818/
State Superseded
Headers show

Comments

phabricator - Nov. 6, 2019, 10:57 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This removes some obfuscation as far as pytype is concerned and
  corrects many bogus type errors.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7267

AFFECTED FILES
  mercurial/encoding.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -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: