11
11
)
12
12
import sys
13
13
from typing import (
14
+ TYPE_CHECKING ,
14
15
Any ,
15
16
Callable ,
16
17
TypeVar ,
24
25
25
26
from pandas .io .formats .console import get_console_size
26
27
28
+ if TYPE_CHECKING :
29
+ from pandas ._typing import ListLike
27
30
EscapeChars = Union [Mapping [str , str ], Iterable [str ]]
28
31
_KT = TypeVar ("_KT" )
29
32
_VT = TypeVar ("_VT" )
@@ -98,7 +101,7 @@ def _adj_justify(texts: Iterable[str], max_len: int, mode: str = "right") -> lis
98
101
99
102
100
103
def _pprint_seq (
101
- seq : Sequence , _nest_lvl : int = 0 , max_seq_items : int | None = None , ** kwds : Any
104
+ seq : ListLike , _nest_lvl : int = 0 , max_seq_items : int | None = None , ** kwds : Any
102
105
) -> str :
103
106
"""
104
107
internal. pprinter for iterables. you should probably use pprint_thing()
@@ -167,7 +170,7 @@ def _pprint_dict(
167
170
168
171
169
172
def pprint_thing (
170
- thing : Any ,
173
+ thing : object ,
171
174
_nest_lvl : int = 0 ,
172
175
escape_chars : EscapeChars | None = None ,
173
176
default_escapes : bool = False ,
@@ -225,7 +228,7 @@ def as_escaped_string(
225
228
)
226
229
elif is_sequence (thing ) and _nest_lvl < get_option ("display.pprint_nest_depth" ):
227
230
result = _pprint_seq (
228
- thing ,
231
+ thing , # type: ignore[arg-type]
229
232
_nest_lvl ,
230
233
escape_chars = escape_chars ,
231
234
quote_strings = quote_strings ,
@@ -240,7 +243,7 @@ def as_escaped_string(
240
243
241
244
242
245
def pprint_thing_encoded (
243
- object : Any , encoding : str = "utf-8" , errors : str = "replace"
246
+ object : object , encoding : str = "utf-8" , errors : str = "replace"
244
247
) -> bytes :
245
248
value = pprint_thing (object ) # get unicode representation of object
246
249
return value .encode (encoding , errors )
@@ -289,7 +292,7 @@ def default_pprint(thing: Any, max_seq_items: int | None = None) -> str:
289
292
290
293
291
294
def format_object_summary (
292
- obj : Any ,
295
+ obj : ListLike ,
293
296
formatter : Callable ,
294
297
is_justify : bool = True ,
295
298
name : str | None = None ,
0 commit comments