From cfde32b93fe6fd2f32aa095c1acd1460224defae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rousset?= Date: Fri, 29 Jul 2016 14:50:46 +0200 Subject: [PATCH] Add mimetypes (#404) * remove old mimetypes, new stubgen * reorder, cleanup * py3 pass (py2 pass empty) --- stdlib/2.7/mimetypes.pyi | 26 -------------------------- stdlib/2and3/mimetypes.pyi | 38 ++++++++++++++++++++++++++++++++++++++ stdlib/3/mimetypes.pyi | 26 -------------------------- 3 files changed, 38 insertions(+), 52 deletions(-) delete mode 100644 stdlib/2.7/mimetypes.pyi create mode 100644 stdlib/2and3/mimetypes.pyi delete mode 100644 stdlib/3/mimetypes.pyi diff --git a/stdlib/2.7/mimetypes.pyi b/stdlib/2.7/mimetypes.pyi deleted file mode 100644 index a06fcd9a9..000000000 --- a/stdlib/2.7/mimetypes.pyi +++ /dev/null @@ -1,26 +0,0 @@ -# Stubs for mimetypes (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -class MimeTypes: - encodings_map = ... # type: Any - suffix_map = ... # type: Any - types_map = ... # type: Any - types_map_inv = ... # type: Any - def __init__(self, filenames=..., strict=True): ... - def add_type(self, type, ext, strict=True): ... - def guess_type(self, url, strict=True): ... - def guess_all_extensions(self, type, strict=True): ... - def guess_extension(self, type, strict=True): ... - def read(self, filename, strict=True): ... - def readfp(self, fp, strict=True): ... - def read_windows_registry(self, strict=True): ... - -def guess_type(url, strict=True): ... -def guess_all_extensions(type, strict=True): ... -def guess_extension(type, strict=True): ... -def add_type(type, ext, strict=True): ... -def init(files=None): ... -def read_mime_types(file): ... diff --git a/stdlib/2and3/mimetypes.pyi b/stdlib/2and3/mimetypes.pyi new file mode 100644 index 000000000..ee1540f3e --- /dev/null +++ b/stdlib/2and3/mimetypes.pyi @@ -0,0 +1,38 @@ +# Stubs for mimetypes + +from typing import Dict, IO, Optional, Sequence, Tuple +import sys + +def guess_type(url: str, + strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... +def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... +def guess_extension(type: str, strict: bool = ...) -> Optional[str]: ... + +def init(files: Optional[Sequence[str]] = ...) -> None: ... +def read_mime_types(filename: str) -> Optional[Dict[str, str]]: ... +def add_type(type: str, ext: str, strict: bool = ...) -> None: ... + +inited = ... # type: bool +knownfiles = ... # type: List[str] +suffix_map = ... # type: Dict[str, str] +encodings_map = ... # type: Dict[str, str] +types_map = ... # type: Dict[str, str] +common_types = ... # type: Dict[str, str] + +class MimeTypes: + suffix_map = ... # type: Dict[str, str] + encodings_map = ... # type: Dict[str, str] + types_map = ... # type: Tuple[Dict[str, str], Dict[str, str]] + types_map_inv = ... # type: Tuple[Dict[str, str], Dict[str, str]] + def __init__(self, filenames: Tuple[str, ...] = ..., + strict: bool = ...) -> None: ... + def guess_extension(self, type: str, + strict: bool = ...) -> Optional[str]: ... + def guess_type(self, url: str, + strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... + def guess_all_extensions(self, type: str, + strict: bool = ...) -> List[str]: ... + def read(self, filename: str, strict: bool = ...) -> None: ... + def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... + if sys.platform == 'win32': + def read_windows_registry(self, strict: bool = ...) -> None: ... diff --git a/stdlib/3/mimetypes.pyi b/stdlib/3/mimetypes.pyi deleted file mode 100644 index a0144475b..000000000 --- a/stdlib/3/mimetypes.pyi +++ /dev/null @@ -1,26 +0,0 @@ -# Stubs for mimetypes (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -class MimeTypes: - encodings_map = ... # type: Any - suffix_map = ... # type: Any - types_map = ... # type: Any - types_map_inv = ... # type: Any - def __init__(self, filenames=..., strict=True): ... - def add_type(self, type, ext, strict=True): ... - def guess_type(self, url, strict=True): ... - def guess_all_extensions(self, type, strict=True): ... - def guess_extension(self, type, strict=True): ... - def read(self, filename, strict=True): ... - def readfp(self, fp, strict=True): ... - def read_windows_registry(self, strict=True): ... - -def guess_type(url, strict=True): ... -def guess_all_extensions(type, strict=True): ... -def guess_extension(type, strict=True): ... -def add_type(type, ext, strict=True): ... -def init(files=None): ... -def read_mime_types(file): ...