From 0bc98a18f0d6209d26c5a4a753febc3e6ae75b63 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 10 Jul 2018 18:10:25 +0300 Subject: [PATCH] Add stdlib/2and3/imghdr stubs (#2318) Ad defined in https://docs.python.org/3/library/imghdr.html. --- stdlib/2and3/imghdr.pyi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 stdlib/2and3/imghdr.pyi diff --git a/stdlib/2and3/imghdr.pyi b/stdlib/2and3/imghdr.pyi new file mode 100644 index 000000000..3d6f660f2 --- /dev/null +++ b/stdlib/2and3/imghdr.pyi @@ -0,0 +1,16 @@ +from typing import overload, Union, Text, BinaryIO, Optional, Any, List, Callable +import sys +import os + + +if sys.version_info >= (3, 6): + _File = Union[Text, os.PathLike[Text], BinaryIO] +else: + _File = Union[Text, BinaryIO] + + +@overload +def what(file: _File) -> Optional[str]: ... +@overload +def what(file: Any, h: bytes)-> Optional[str]: ... +tests: List[Callable[[bytes, BinaryIO], Optional[str]]]