1# Stubs for mimetypes 2 3from typing import Dict, IO, List, Optional, Sequence, Text, Tuple, AnyStr, Union 4import sys 5 6if sys.version_info >= (3, 8): 7 from os import PathLike 8 def guess_type(url: Union[Text, PathLike[str]], 9 strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... 10else: 11 def guess_type(url: Text, 12 strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... 13 14def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... 15def guess_extension(type: str, strict: bool = ...) -> Optional[str]: ... 16 17def init(files: Optional[Sequence[str]] = ...) -> None: ... 18def read_mime_types(filename: str) -> Optional[Dict[str, str]]: ... 19def add_type(type: str, ext: str, strict: bool = ...) -> None: ... 20 21inited: bool 22knownfiles: List[str] 23suffix_map: Dict[str, str] 24encodings_map: Dict[str, str] 25types_map: Dict[str, str] 26common_types: Dict[str, str] 27 28class MimeTypes: 29 suffix_map: Dict[str, str] 30 encodings_map: Dict[str, str] 31 types_map: Tuple[Dict[str, str], Dict[str, str]] 32 types_map_inv: Tuple[Dict[str, str], Dict[str, str]] 33 def __init__(self, filenames: Tuple[str, ...] = ..., 34 strict: bool = ...) -> None: ... 35 def guess_extension(self, type: str, 36 strict: bool = ...) -> Optional[str]: ... 37 def guess_type(self, url: str, 38 strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... 39 def guess_all_extensions(self, type: str, 40 strict: bool = ...) -> List[str]: ... 41 def read(self, filename: str, strict: bool = ...) -> None: ... 42 def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... 43 if sys.platform == 'win32': 44 def read_windows_registry(self, strict: bool = ...) -> None: ... 45