From 0bf71d0941759eedbb3650ef04daf34190abf93f Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Mon, 23 Dec 2019 11:00:50 +0200 Subject: [PATCH] TYP: Type annotations in pandas/io/formats/{html,printing}.py --- pandas/io/formats/html.py | 4 ++-- pandas/io/formats/printing.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py index 3a3347a5c86ea..b88478b3da181 100644 --- a/pandas/io/formats/html.py +++ b/pandas/io/formats/html.py @@ -109,12 +109,12 @@ def write_th( ---------- s : object The data to be written inside the cell. - header : boolean, default False + header : bool, default False Set to True if the is for use inside . This will cause min-width to be set if there is one. indent : int, default 0 The indentation level of the cell. - tags : string, default None + tags : str, default None Tags to include in the cell. Returns diff --git a/pandas/io/formats/printing.py b/pandas/io/formats/printing.py index 2176487ff6a36..4b5b5e9a0ce15 100644 --- a/pandas/io/formats/printing.py +++ b/pandas/io/formats/printing.py @@ -1,5 +1,5 @@ """ -printing tools +Printing tools. """ import sys @@ -182,13 +182,12 @@ def pprint_thing( replacements default_escapes : bool, default False Whether the input escape characters replaces or adds to the defaults - max_seq_items : False, int, default None - Pass thru to other pretty printers to limit sequence printing + max_seq_items : int or None, default None + Pass through to other pretty printers to limit sequence printing Returns ------- str - """ def as_escaped_string( @@ -312,7 +311,6 @@ def format_object_summary( Returns ------- summary string - """ from pandas.io.formats.console import get_console_size from pandas.io.formats.format import _get_adjustment @@ -346,7 +344,9 @@ def format_object_summary( # adj can optionally handle unicode eastern asian width adj = _get_adjustment() - def _extend_line(s, line, value, display_width, next_line_prefix): + def _extend_line( + s: str, line: str, value: str, display_width: int, next_line_prefix: str + ) -> Tuple[str, str]: if adj.len(line.rstrip()) + adj.len(value.rstrip()) >= display_width: s += line.rstrip() @@ -354,7 +354,7 @@ def _extend_line(s, line, value, display_width, next_line_prefix): line += value return s, line - def best_len(values): + def best_len(values: List[str]) -> int: if values: return max(adj.len(x) for x in values) else: