From bf944dbf9410d894e15b22e4a6c00d65613f2693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 24 Oct 2019 20:19:08 -0700 Subject: [PATCH] Update stubs for tabulate (#3391) --- third_party/2and3/tabulate.pyi | 54 +++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/third_party/2and3/tabulate.pyi b/third_party/2and3/tabulate.pyi index a36051575..c3abb2f14 100644 --- a/third_party/2and3/tabulate.pyi +++ b/third_party/2and3/tabulate.pyi @@ -1,18 +1,44 @@ -# Stub for tabulate: https://bitbucket.org/astanin/python-tabulate -from typing import Any, Dict, Iterable, Sequence, Union +# Stub for tabulate: https://github.com/astanin/python-tabulate +from typing import Any, Callable, Container, Iterable, List, Mapping, NamedTuple, Optional, Sequence, Union +PRESERVE_WHITESPACE: bool +WIDE_CHARS_MODE: bool +tabulate_formats: List[str] -def __getattr__(name: str) -> Any: ... +class Line(NamedTuple): + begin: str + hline: str + sep: str + end: str +class DataRow(NamedTuple): + begin: str + sep: str + end: str + +_TableFormatLine = Union[None, Line, Callable[[List[int], List[str]], str]] +_TableFormatRow = Union[None, DataRow, Callable[[List[Any], List[int], List[str]], str]] + +class TableFormat(NamedTuple): + lineabove: _TableFormatLine + linebelowheader: _TableFormatLine + linebetweenrows: _TableFormatLine + linebelow: _TableFormatLine + headerrow: _TableFormatRow + datarow: _TableFormatRow + padding: int + with_header_hide: Optional[Container[str]] + +def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( - tabular_data: Iterable[Iterable[Any]], - headers: Union[str, Dict[str, str], Sequence[str]] = ..., - tablefmt: str = ..., - floatfmt: str = ..., - numalign: str = ..., - stralign: str = ..., - missingval: str = ..., - showindex: str = ..., - disable_numparse: bool = ... -) -> str: - ... + tabular_data: Union[Mapping[str, Iterable[Any]], Iterable[Iterable[Any]]], + headers: Union[str, Sequence[str]] = ..., + tablefmt: Union[str, TableFormat] = ..., + floatfmt: Union[str, Iterable[str]] = ..., + numalign: Optional[str] = ..., + stralign: Optional[str] = ..., + missingval: Union[str, Iterable[str]] = ..., + showindex: Union[str, bool, Iterable[Any]] = ..., + disable_numparse: Union[bool, Iterable[int]] = ..., + colalign: Optional[Iterable[Optional[str]]] = ..., +) -> str: ...