Files
django-stubs/django/http/multipartparser.pyi
Maxim Kurnikov a9f215bf64 initial commit
2018-07-29 18:12:23 +03:00

82 lines
2.6 KiB
Python

from io import BytesIO
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import QueryDict
from django.utils.datastructures import (
ImmutableList,
MultiValueDict,
)
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
def _parse_header_params(s: bytes) -> List[bytes]: ...
def exhaust(stream_or_iterable: Union[BytesIO, WSGIRequest]) -> None: ...
def parse_boundary_stream(
stream: LazyStream,
max_header_size: int
) -> Union[Tuple[str, Dict[Any, Any], LazyStream], Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, str]], Tuple[str, Dict[Any, Any]]]], LazyStream]]: ...
def parse_header(line: bytes) -> Union[Tuple[str, Dict[Any, Any]], Tuple[str, Dict[str, bytes]]]: ...
class BoundaryIter:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __next__(self) -> bytes: ...
def _find_boundary(self, data: bytes) -> Optional[Tuple[int, int]]: ...
class ChunkIter:
def __init__(self, flo: WSGIRequest, chunk_size: int = ...) -> None: ...
def __next__(self) -> bytes: ...
class InterBoundaryIter:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(self) -> InterBoundaryIter: ...
def __next__(self) -> LazyStream: ...
class LazyStream:
def __init__(
self,
producer: Union[BoundaryIter, ChunkIter],
length: None = ...
) -> None: ...
def __iter__(self) -> LazyStream: ...
def __next__(self) -> bytes: ...
def _update_unget_history(self, num_bytes: int) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def unget(self, bytes: bytes) -> None: ...
class MultiPartParser:
def IE_sanitize(self, filename: str) -> str: ...
def __init__(
self,
META: Dict[str, Any],
input_data: WSGIRequest,
upload_handlers: ImmutableList,
encoding: None = ...
) -> None: ...
def _close_files(self) -> None: ...
def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ...
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
class Parser:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(
self
) -> Iterator[Union[Tuple[str, Dict[Any, Any], LazyStream], Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]], LazyStream]]]: ...