multipartparser.pyi
1 from io import BytesIO, StringIO 2 from typing import Any, Dict, Iterator, List, Optional, Tuple, Union 3 4 from django.http.request import QueryDict 5 from django.utils.datastructures import ImmutableList, MultiValueDict 6 7 class MultiPartParserError(Exception): ... 8 class InputStreamExhausted(Exception): ... 9 10 class MultiPartParser: 11 def __init__( 12 self, 13 META: Dict[str, Any], 14 input_data: Union[StringIO, BytesIO], 15 upload_handlers: Union[List[Any], ImmutableList], 16 encoding: Optional[str] = ..., 17 ) -> None: ... 18 def parse(self) -> Tuple[QueryDict, MultiValueDict]: ... 19 def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ... 20 def IE_sanitize(self, filename: str) -> str: ... 21 22 class LazyStream: 23 length: None = ... 24 position: int = ... 25 def __init__(self, producer: Union[BoundaryIter, ChunkIter], length: None = ...) -> None: ... 26 def tell(self): ... 27 def read(self, size: Optional[int] = ...) -> bytes: ... 28 def __next__(self) -> bytes: ... 29 def close(self) -> None: ... 30 def __iter__(self) -> LazyStream: ... 31 def unget(self, bytes: bytes) -> None: ... 32 33 class ChunkIter: 34 flo: BytesIO = ... 35 chunk_size: int = ... 36 def __init__(self, flo: BytesIO, chunk_size: int = ...) -> None: ... 37 def __next__(self) -> bytes: ... 38 def __iter__(self): ... 39 40 class InterBoundaryIter: 41 def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... 42 def __iter__(self) -> InterBoundaryIter: ... 43 def __next__(self) -> LazyStream: ... 44 45 class BoundaryIter: 46 def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... 47 def __iter__(self): ... 48 def __next__(self) -> bytes: ... 49 50 class Parser: 51 def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... 52 def __iter__(self) -> Iterator[Tuple[str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream]]: ... 53 54 def parse_header(line: bytes) -> Tuple[str, Dict[str, Any]]: ...