mercurial/interfaces/modules.py
changeset 51936 54d9f496f07a
parent 51934 fa7059f031a9
child 51960 d7f17819ae9e
equal deleted inserted replaced
51935:8d9767bf4adb 51936:54d9f496f07a
    48     def fixws(self, text: bytes, allws: bool) -> bytes:
    48     def fixws(self, text: bytes, allws: bool) -> bytes:
    49         ...
    49         ...
    50 
    50 
    51     xdiffblocks: Optional[BDiffBlocksFnc]
    51     xdiffblocks: Optional[BDiffBlocksFnc]
    52     """This method is currently only available in the ``cext`` module."""
    52     """This method is currently only available in the ``cext`` module."""
       
    53 
       
    54 
       
    55 class CharEncoding(Protocol):
       
    56     """A Protocol class for the various charencoding module implementations."""
       
    57 
       
    58     def isasciistr(self, s: bytes) -> bool:
       
    59         """Can the byte string be decoded with the ``ascii`` codec?"""
       
    60 
       
    61     def asciilower(self, s: bytes) -> bytes:
       
    62         """convert a string to lowercase if ASCII
       
    63 
       
    64         Raises UnicodeDecodeError if non-ASCII characters are found."""
       
    65 
       
    66     def asciiupper(self, s: bytes) -> bytes:
       
    67         """convert a string to uppercase if ASCII
       
    68 
       
    69         Raises UnicodeDecodeError if non-ASCII characters are found."""
       
    70 
       
    71     def jsonescapeu8fast(self, u8chars: bytes, paranoid: bool) -> bytes:
       
    72         """Convert a UTF-8 byte string to JSON-escaped form (fast path)
       
    73 
       
    74         Raises ValueError if non-ASCII characters have to be escaped.
       
    75         """