Page MenuHomePhabricator

encoding: define local identify functions with explicit type comments

Authored by durin42 on Wed, Nov 6, 5:56 PM.



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

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Wed, Nov 6, 5:56 PM
indygreg accepted this revision.Thu, Nov 7, 3:06 AM
This revision is now accepted and ready to land.Thu, Nov 7, 3:06 AM
yuja added a subscriber: yuja.Fri, Nov 8, 9:10 AM
  • a/mercurial/

+++ b/mercurial/
@@ -241,8 +241,15 @@

strfromlocal = unifromlocal
strmethod = unimethod


  • strtolocal = pycompat.identity
  • strfromlocal = pycompat.identity

+ def strtolocal(s):
+ # type: (str) -> bytes
+ return s
+ def strfromlocal(s):
+ # type: (bytes) -> str
+ return s

It disables the fast path f is identity in pycompat.rapply. I don't
think that matters, but I just noted.