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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri Nov 8 09:11:01 EST 2019


yuja added a comment.


  > - 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
  
  It disables the fast path `f is identity` in `pycompat.rapply`. I don't
  think that matters, but I just noted.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7267/new/

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

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


More information about the Mercurial-devel mailing list