[PATCH 4 of 7] typing: constrain argument/return types of encoding.toutf8b()

Yuya Nishihara yuya at tcha.org
Sat Nov 16 06:59:40 EST 2019


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1573886087 -32400
#      Sat Nov 16 15:34:47 2019 +0900
# Node ID e545494cb15eb7191d4b93728648a7d2290b5311
# Parent  e183fdce1d6d2b07531c4bf8ef7298631b9efbdc
typing: constrain argument/return types of encoding.toutf8b()

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -560,7 +560,7 @@ else:
 
 
 def getutf8char(s, pos):
-    # type: (Any, Any) -> Any
+    # type: (bytes, int) -> bytes
     '''get the next full utf-8 character in the given string, starting at pos
 
     Raises a UnicodeError if the given location does not start a valid
@@ -579,7 +579,7 @@ def getutf8char(s, pos):
 
 
 def toutf8b(s):
-    # type: (Any) -> Any
+    # type: (bytes) -> bytes
     '''convert a local, possibly-binary string into UTF-8b
 
     This is intended as a generic method to preserve data when working


More information about the Mercurial-devel mailing list