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

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 16, 2019, 11:59 a.m.
Message ID <e545494cb15eb7191d4b.1573905580@mimosa>
Download mbox | patch
Permalink /patch/43297/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 16, 2019, 11:59 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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()

Patch

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