Include filepost.pyi and util/url.pyi
MODIFY
noxfile.py
noxfile.py
@@ -9,13 +9,16 @@ import nox
# this file will continue to be checked by mypy. Errors from other files are
# ignored.
TYPED_FILES = {
+ "src/urllib3/contrib/__init__.py",
"src/urllib3/exceptions.py",
"src/urllib3/fields.py",
+ "src/urllib3/filepost.py",
"src/urllib3/packages/__init__.py",
"src/urllib3/packages/six.py",
"src/urllib3/packages/ssl_match_hostname/__init__.py",
"src/urllib3/packages/ssl_match_hostname/_implementation.py",
"src/urllib3/util/queue.py",
+ "src/urllib3/util/url.py",
}
SOURCE_FILES = [
"docs/",

ADD
src/urllib3/contrib/__init__.pyi
src/urllib3/contrib/__init__.pyi
ADD
src/urllib3/filepost.pyi
+from typing import Any, Generator, List, Mapping, Optional, Tuple, Union
+
+from . import fields
+
+RequestField = fields.RequestField
+Fields = Union[Mapping[str, str], List[Tuple[str]], List[RequestField]]
+Iterator = Generator[Tuple[str], None, None]
+
+writer: Any
+
+def choose_boundary() -> str: ...
+def iter_field_objects(fields: Fields) -> Iterator: ...
+def iter_fields(fields: Fields) -> Iterator: ...
+def encode_multipart_formdata(
+ fields: Fields, boundary: Optional[str]
+) -> Tuple[str]: ...

ADD
src/urllib3/util/url.pyi
+from typing import Any, List, Optional, Tuple, Union
+
+from .. import exceptions
+
+LocationParseError = exceptions.LocationParseError
+
+url_attrs: List[str]
+
+class Url:
+ slots: Any
+ def __new__(
+ cls,
+ scheme: Optional[str],
+ auth: Optional[str],
+ host: Optional[str],
+ port: Optional[str],
+ path: Optional[str],
+ query: Optional[str],
+ fragment: Optional[str],
+ ) -> Url: ...
+ @property
+ def hostname(self) -> str: ...
+ @property
+ def request_uri(self) -> str: ...
+ @property
+ def netloc(self) -> str: ...
+ @property
+ def url(self) -> str: ...
+
+def split_first(s: str, delims: str) -> Tuple[str, str, Optional[str]]: ...
+def parse_url(url: str) -> Url: ...
+def get_host(url: str) -> Union[str, Tuple[str]]: ...

Include filepost.pyi and util/url.pyi (#1955)