Skip to content

Commit e748deb

Browse files
committed
Remove more overload uses
1 parent 6a463ce commit e748deb

File tree

5 files changed

+14
-39
lines changed

5 files changed

+14
-39
lines changed

stubs/3.2/glob.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22

33
# Based on http://docs.python.org/3.2/library/glob.html
44

5-
from typing import overload, List, Iterator
5+
from typing import List, Iterator
66

7-
@overload
8-
def glob(pathname: str) -> List[str]: pass
9-
@overload
10-
def glob(pathname: bytes) -> List[bytes]: pass
11-
@overload
12-
def iglob(pathname: str) -> Iterator[str]: pass
13-
@overload
14-
def iglob(pathname: bytes) -> Iterator[bytes]: pass
7+
def glob(pathname: AnyStr) -> List[AnyStr]: pass
8+
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: pass

stubs/3.2/posixpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# based on http://docs.python.org/3.2/library/os.path.html
55

6-
from typing import Any, List, Tuple, IO, overload
6+
from typing import Any, List, Tuple, IO
77

88
# ----- os.path variables -----
99
supports_unicode_filenames = False

stubs/3.2/re.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# and http://hg.python.org/cpython/file/618ea5612e83/Lib/re.py
77

88
from typing import (
9-
Undefined, List, Iterator, overload, Callable, Tuple, Sequence, Dict,
9+
Undefined, List, Iterator, Callable, Tuple, Sequence, Dict,
1010
Generic, AnyStr, Match, Pattern
1111
)
1212

@@ -46,20 +46,12 @@ def findall(pattern: AnyStr, string: AnyStr,
4646
def finditer(pattern: AnyStr, string: AnyStr,
4747
flags: int = 0) -> Iterator[Match[AnyStr]]: pass
4848

49-
@overload
50-
def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
51-
flags: int = 0) -> AnyStr: pass
52-
@overload
53-
def sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
49+
def sub(pattern: AnyStr, repl: Union[AnyStr, Callable[[Match[AnyStr]]]],
5450
string: AnyStr, count: int = 0, flags: int = 0) -> AnyStr: pass
5551

56-
@overload
57-
def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
58-
flags: int = 0) -> Tuple[AnyStr, int]: pass
59-
@overload
60-
def subn(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
61-
string: AnyStr, count: int = 0,
62-
flags: int = 0) -> Tuple[AnyStr, int]: pass
52+
def subn(pattern: AnyStr, repl: Union[AnyStr, Callable[[Match[AnyStr]]]],
53+
string: AnyStr, count: int = 0, flags: int = 0) -> Tuple[AnyStr, int]:
54+
pass
6355

6456
def escape(string: AnyStr) -> AnyStr: pass
6557

stubs/3.2/shutil.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
# sometimes they only work partially (broken exception messages), and the test
77
# cases don't use them.
88

9-
from typing import (
10-
overload, List, Iterable, Callable, Any, Tuple, Sequence, IO, AnyStr
11-
)
9+
from typing import List, Iterable, Callable, Any, Tuple, Sequence, IO, AnyStr
1210

1311
def copyfileobj(fsrc: IO[AnyStr], fdst: IO[AnyStr],
1412
length: int = None) -> None: pass

stubs/3.2/warnings.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@
22

33
# Based on http://docs.python.org/3.2/library/warnings.html
44

5-
from typing import overload, Any, List, TextIO
5+
from typing import Any, List, TextIO
66

7-
@overload
8-
def warn(message: str, category: type = None,
9-
stacklevel: int = 1) -> None: pass
10-
@overload
11-
def warn(message: Warning, category: type = None,
7+
def warn(message: Union[str, Warning], category: type = None,
128
stacklevel: int = 1) -> None: pass
139

14-
@overload
15-
def warn_explicit(message: str, category: type, filename: str, lineno: int,
16-
module: str = None, registry: Any = None,
17-
module_globals: Any = None) -> None: pass
18-
@overload
19-
def warn_explicit(message: Warning, category: type, filename: str, lineno: int,
20-
module: str = None, registry: Any = None,
10+
def warn_explicit(message: Union[str, Warning], category: type, filename: str,
11+
lineno: int, module: str = None, registry: Any = None,
2112
module_globals: Any = None) -> None: pass
2213

2314
# logging modifies showwarning => make it a variable.

0 commit comments

Comments
 (0)