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

2022-06-07 Thread Josh54 (Josh Mendes)
Herald added a subscriber: mercurial-patches.
Josh54 added a comment.


  This website has provided me with interesting information on my favorite 
subject. [URL=https://dordle.online/]dordle[/URL] I thoroughly enjoyed reading 
your posts. [URL=https://wordhurdle.co/]word hurdle[/URL] Thanks

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: mercurial-patches, Josh54, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-08 Thread yuja (Yuya Nishihara)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-08 Thread Yuya Nishihara
> --- 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.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-07 Thread durin42 (Augie Fackler)
Closed by commit rHG5f2a8dabb0d8: encoding: define local identify functions 
with explicit type comments (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7267?vs=17637=17684

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

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

AFFECTED FILES
  mercurial/encoding.py

CHANGE DETAILS

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:



To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-06 Thread durin42 (Augie Fackler)
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

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:



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel