file_storage.pyi 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from collections.abc import Iterator
  2. from os import PathLike
  3. from typing import Any
  4. from typing import IO
  5. from .headers import Headers
  6. from .structures import MultiDict
  7. class FileStorage:
  8. name: str | None
  9. stream: IO[bytes]
  10. filename: str | None
  11. headers: Headers
  12. _parsed_content_type: tuple[str, dict[str, str]]
  13. def __init__(
  14. self,
  15. stream: IO[bytes] | None = None,
  16. filename: str | PathLike | None = None,
  17. name: str | None = None,
  18. content_type: str | None = None,
  19. content_length: int | None = None,
  20. headers: Headers | None = None,
  21. ) -> None: ...
  22. def _parse_content_type(self) -> None: ...
  23. @property
  24. def content_type(self) -> str: ...
  25. @property
  26. def content_length(self) -> int: ...
  27. @property
  28. def mimetype(self) -> str: ...
  29. @property
  30. def mimetype_params(self) -> dict[str, str]: ...
  31. def save(self, dst: str | PathLike | IO[bytes], buffer_size: int = ...) -> None: ...
  32. def close(self) -> None: ...
  33. def __bool__(self) -> bool: ...
  34. def __getattr__(self, name: str) -> Any: ...
  35. def __iter__(self) -> Iterator[bytes]: ...
  36. def __repr__(self) -> str: ...
  37. class FileMultiDict(MultiDict[str, FileStorage]):
  38. def add_file(
  39. self,
  40. name: str,
  41. file: FileStorage | str | IO[bytes],
  42. filename: str | None = None,
  43. content_type: str | None = None,
  44. ) -> None: ...