##// END OF EJS Templates
typing: attempt to remove @overloads in the platform module for stdlib methods...
Matt Harbison -
r50713:3fd5824f default
parent child Browse files
Show More
@@ -17,10 +17,12 b' 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,
@@ -67,6 +69,38 b' 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)
@@ -14,6 +14,7 b' import re'
14 import stat
14 import stat
15 import string
15 import string
16 import sys
16 import sys
17 import typing
17 import winreg # pytype: disable=import-error
18 import winreg # pytype: disable=import-error
18
19
19 from typing import (
20 from typing import (
@@ -27,6 +28,7 b' from typing import ('
27 Optional,
28 Optional,
28 Pattern,
29 Pattern,
29 Sequence,
30 Sequence,
31 Tuple,
30 Union,
32 Union,
31 )
33 )
32
34
@@ -59,6 +61,18 b' split = os.path.split'
59 testpid = win32.testpid
61 testpid = win32.testpid
60 unlink = win32.unlink
62 unlink = win32.unlink
61
63
64 if typing.TYPE_CHECKING:
65 # Replace the various overloads that come along with aliasing stdlib methods
66 # with the narrow definition that we care about in the type checking phase
67 # only. This ensures that both Windows and POSIX see only the definition
68 # that is actually available.
69 #
70 # Note that if we check pycompat.TYPE_CHECKING here, it is always False, and
71 # the methods aren't replaced.
72 def split(p: bytes) -> Tuple[bytes, bytes]:
73 raise NotImplementedError
74
75
62 umask: int = 0o022
76 umask: int = 0o022
63
77
64
78
General Comments 0
You need to be logged in to leave comments. Login now