Skip to content

Commit d5e2818

Browse files
committed
Review
1 parent 473df65 commit d5e2818

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pandas/core/ops/invalid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def make_invalid_op(name: str) -> Callable[..., NoReturn]:
6868
invalid_op : function
6969
"""
7070

71-
def invalid_op(self: Any, other: Any = None) -> NoReturn:
71+
def invalid_op(self: object, other: object = None) -> NoReturn:
7272
typ = type(self).__name__
7373
raise TypeError(f"cannot perform {name} with this index type: {typ}")
7474

pandas/io/formats/printing.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
)
1212
import sys
1313
from typing import (
14+
TYPE_CHECKING,
1415
Any,
1516
Callable,
1617
TypeVar,
@@ -24,6 +25,8 @@
2425

2526
from pandas.io.formats.console import get_console_size
2627

28+
if TYPE_CHECKING:
29+
from pandas._typing import ListLike
2730
EscapeChars = Union[Mapping[str, str], Iterable[str]]
2831
_KT = TypeVar("_KT")
2932
_VT = TypeVar("_VT")
@@ -98,7 +101,7 @@ def _adj_justify(texts: Iterable[str], max_len: int, mode: str = "right") -> lis
98101

99102

100103
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
102105
) -> str:
103106
"""
104107
internal. pprinter for iterables. you should probably use pprint_thing()
@@ -167,7 +170,7 @@ def _pprint_dict(
167170

168171

169172
def pprint_thing(
170-
thing: Any,
173+
thing: object,
171174
_nest_lvl: int = 0,
172175
escape_chars: EscapeChars | None = None,
173176
default_escapes: bool = False,
@@ -225,7 +228,7 @@ def as_escaped_string(
225228
)
226229
elif is_sequence(thing) and _nest_lvl < get_option("display.pprint_nest_depth"):
227230
result = _pprint_seq(
228-
thing,
231+
thing, # type: ignore[arg-type]
229232
_nest_lvl,
230233
escape_chars=escape_chars,
231234
quote_strings=quote_strings,
@@ -240,7 +243,7 @@ def as_escaped_string(
240243

241244

242245
def pprint_thing_encoded(
243-
object: Any, encoding: str = "utf-8", errors: str = "replace"
246+
object: object, encoding: str = "utf-8", errors: str = "replace"
244247
) -> bytes:
245248
value = pprint_thing(object) # get unicode representation of object
246249
return value.encode(encoding, errors)
@@ -289,7 +292,7 @@ def default_pprint(thing: Any, max_seq_items: int | None = None) -> str:
289292

290293

291294
def format_object_summary(
292-
obj: Any,
295+
obj: ListLike,
293296
formatter: Callable,
294297
is_justify: bool = True,
295298
name: str | None = None,

0 commit comments

Comments
 (0)