|
1 | 1 | # Stubs for urlparse (Python 2)
|
2 | 2 |
|
3 |
| -from typing import Dict, List, NamedTuple, Tuple, Sequence, Union, overload |
| 3 | +from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload |
4 | 4 |
|
5 | 5 | uses_relative = [] # type: List[str]
|
6 | 6 | uses_netloc = [] # type: List[str]
|
@@ -28,22 +28,47 @@ class SplitResult(NamedTuple('SplitResult', [
|
28 | 28 | ]), ResultMixin):
|
29 | 29 | def geturl(self) -> str: ...
|
30 | 30 |
|
| 31 | +class SplitResultU(NamedTuple('SplitResultU', [ |
| 32 | + ('scheme', unicode), |
| 33 | + ('netloc', unicode), |
| 34 | + ('path', unicode), |
| 35 | + ('query', unicode), |
| 36 | + ('fragment', unicode) |
| 37 | + ]), ResultMixin): |
| 38 | + def geturl(self) -> unicode: ... |
| 39 | + |
31 | 40 | class ParseResult(NamedTuple('ParseResult', [
|
32 | 41 | ('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),
|
33 | 42 | ('fragment', str)
|
34 | 43 | ]), ResultMixin):
|
35 | 44 | def geturl(self) -> str: ...
|
36 | 45 |
|
37 |
| -def urlparse(url: Union[str, unicode], scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ... |
38 |
| -def urlsplit(url: Union[str, unicode], scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ... |
| 46 | +class ParseResultU(NamedTuple('ParseResultU', [ |
| 47 | + ('scheme', unicode), |
| 48 | + ('netloc', unicode), |
| 49 | + ('path', unicode), |
| 50 | + ('params', unicode), |
| 51 | + ('query', unicode), |
| 52 | + ('fragment', unicode) |
| 53 | + ]), ResultMixin): |
| 54 | + def geturl(self) -> unicode: ... |
| 55 | + |
| 56 | +@overload |
| 57 | +def urlparse(url: str, scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ... |
| 58 | +@overload |
| 59 | +def urlparse(url: unicode, scheme: unicode = ..., allow_fragments: bool = ...) -> ParseResultU: ... |
| 60 | +@overload |
| 61 | +def urlsplit(url: str, scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ... |
| 62 | +@overload |
| 63 | +def urlsplit(url: unicode, scheme: unicode = ..., allow_fragments: bool = ...) -> SplitResultU: ... |
39 | 64 | @overload
|
40 |
| -def urlunparse(data: Tuple[str, str, str, str, str, str]) -> str: ... |
| 65 | +def urlunparse(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... |
41 | 66 | @overload
|
42 |
| -def urlunparse(data: Sequence[str]) -> str: ... |
| 67 | +def urlunparse(data: Sequence[AnyStr]) -> AnyStr: ... |
43 | 68 | @overload
|
44 |
| -def urlunsplit(data: Tuple[str, str, str, str, str]) -> str: ... |
| 69 | +def urlunsplit(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... |
45 | 70 | @overload
|
46 |
| -def urlunsplit(data: Sequence[str]) -> str: ... |
| 71 | +def urlunsplit(data: Sequence[AnyStr]) -> AnyStr: ... |
47 | 72 | def urljoin(base: Union[str, unicode], url: Union[str, unicode], allow_fragments: bool = ...) -> str: ...
|
48 | 73 | def urldefrag(url: Union[str, unicode]) -> str: ...
|
49 | 74 | def unquote(s: str) -> str: ...
|
|
0 commit comments