mercurial/posix.py
changeset 49913 3fd5824f1177
parent 49911 ae93ada06454
child 49971 07792fd1837f
equal deleted inserted replaced
49912:2b1476714849 49913:3fd5824f1177
    15 import re
    15 import re
    16 import select
    16 import select
    17 import stat
    17 import stat
    18 import sys
    18 import sys
    19 import tempfile
    19 import tempfile
       
    20 import typing
    20 import unicodedata
    21 import unicodedata
    21 
    22 
    22 from typing import (
    23 from typing import (
    23     Any,
    24     Any,
       
    25     AnyStr,
    24     Iterable,
    26     Iterable,
    25     Iterator,
    27     Iterator,
    26     List,
    28     List,
    27     Match,
    29     Match,
    28     NoReturn,
    30     NoReturn,
    65 
    67 
    66 readlink = os.readlink
    68 readlink = os.readlink
    67 unlink = os.unlink
    69 unlink = os.unlink
    68 rename = os.rename
    70 rename = os.rename
    69 removedirs = os.removedirs
    71 removedirs = os.removedirs
       
    72 
       
    73 if typing.TYPE_CHECKING:
       
    74     # Replace the various overloads that come along with aliasing stdlib methods
       
    75     # with the narrow definition that we care about in the type checking phase
       
    76     # only.  This ensures that both Windows and POSIX see only the definition
       
    77     # that is actually available.
       
    78     #
       
    79     # Note that if we check pycompat.TYPE_CHECKING here, it is always False, and
       
    80     # the methods aren't replaced.
       
    81 
       
    82     def normpath(path: bytes) -> bytes:
       
    83         raise NotImplementedError
       
    84 
       
    85     def abspath(path: AnyStr) -> AnyStr:
       
    86         raise NotImplementedError
       
    87 
       
    88     def oslink(src: bytes, dst: bytes) -> None:
       
    89         raise NotImplementedError
       
    90 
       
    91     def readlink(path: bytes) -> bytes:
       
    92         raise NotImplementedError
       
    93 
       
    94     def unlink(path: bytes) -> None:
       
    95         raise NotImplementedError
       
    96 
       
    97     def rename(src: bytes, dst: bytes) -> None:
       
    98         raise NotImplementedError
       
    99 
       
   100     def removedirs(name: bytes) -> None:
       
   101         raise NotImplementedError
       
   102 
       
   103 
    70 expandglobs: bool = False
   104 expandglobs: bool = False
    71 
   105 
    72 umask: int = os.umask(0)
   106 umask: int = os.umask(0)
    73 os.umask(umask)
   107 os.umask(umask)
    74 
   108