mercurial/interfaces/misc.py
changeset 52895 ba343f763595
parent 52894 bde94bd8e8a2
child 52896 180591a9a6a1
equal deleted inserted replaced
52894:bde94bd8e8a2 52895:ba343f763595
     7 
     7 
     8 from typing import (
     8 from typing import (
     9     Callable,
     9     Callable,
    10     Iterator,
    10     Iterator,
    11     List,
    11     List,
       
    12     Optional,
    12     Protocol,
    13     Protocol,
       
    14     Tuple,
    13 )
    15 )
    14 
    16 
    15 
    17 
    16 class IHooks(Protocol):
    18 class IHooks(Protocol):
    17     """A collection of hook functions that can be used to extend a
    19     """A collection of hook functions that can be used to extend a
    43         ...
    45         ...
    44 
    46 
    45     @abc.abstractmethod
    47     @abc.abstractmethod
    46     def __contains__(self, d: bytes) -> bool:
    48     def __contains__(self, d: bytes) -> bool:
    47         ...
    49         ...
       
    50 
       
    51 
       
    52 AuthInfoT = Tuple[
       
    53     bytes,
       
    54     Optional[
       
    55         Tuple[
       
    56             None,
       
    57             Tuple[bytes, bytes],
       
    58             bytes,
       
    59             bytes,
       
    60         ]
       
    61     ],
       
    62 ]
       
    63 
       
    64 
       
    65 class IUrl(Protocol):
       
    66     r"""Reliable URL parser.
       
    67 
       
    68     This parses URLs and provides attributes for the following
       
    69     components:
       
    70 
       
    71     <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>
       
    72 
       
    73     Missing components are set to None. The only exception is
       
    74     fragment, which is set to '' if present but empty.
       
    75 
       
    76     If parsefragment is False, fragment is included in query. If
       
    77     parsequery is False, query is included in path. If both are
       
    78     False, both fragment and query are included in path.
       
    79 
       
    80     See http://www.ietf.org/rfc/rfc2396.txt for more information.
       
    81     """
       
    82 
       
    83     path: Optional[bytes]
       
    84     scheme: Optional[bytes]
       
    85     user: Optional[bytes]
       
    86     passwd: Optional[bytes]
       
    87     host: Optional[bytes]
       
    88     port: Optional[bytes]
       
    89     query: Optional[bytes]
       
    90     fragment: Optional[bytes]
       
    91 
       
    92     @abc.abstractmethod
       
    93     def copy(self) -> IUrl:
       
    94         ...
       
    95 
       
    96     @abc.abstractmethod
       
    97     def authinfo(self) -> AuthInfoT:
       
    98         ...
       
    99 
       
   100     @abc.abstractmethod
       
   101     def isabs(self) -> bool:
       
   102         ...
       
   103 
       
   104     @abc.abstractmethod
       
   105     def localpath(self) -> bytes:
       
   106         ...
       
   107 
       
   108     @abc.abstractmethod
       
   109     def islocal(self) -> bool:
       
   110         ...