Skip to content

Commit 8aca548

Browse files
committed
more typing
1 parent 752bbfd commit 8aca548

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

pandas/core/indexes/base.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,12 @@ def _mpl_repr(self):
902902
# how to represent ourselves to matplotlib
903903
return self.values
904904

905-
def format(self, name: bool = False, formatter=None, na_rep="NaN") -> List[str_t]:
905+
def format(
906+
self,
907+
name: bool = False,
908+
formatter: Optional[Callable] = None,
909+
na_rep: str_t = "NaN",
910+
) -> List[str_t]:
906911
"""
907912
Render a string representation of the Index.
908913
"""

pandas/core/indexes/datetimelike.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas._libs import NaT, Timedelta, iNaT, join as libjoin, lib
1010
from pandas._libs.tslibs import BaseOffset, Resolution, Tick, timezones
1111
from pandas._libs.tslibs.parsing import DateParseError
12-
from pandas._typing import Label
12+
from pandas._typing import Callable, Label
1313
from pandas.compat.numpy import function as nv
1414
from pandas.errors import AbstractMethodError
1515
from pandas.util._decorators import Appender, cache_readonly, doc
@@ -339,7 +339,11 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs):
339339
# Rendering Methods
340340

341341
def format(
342-
self, name: bool = False, formatter=None, na_rep="NaT", date_format=None
342+
self,
343+
name: bool = False,
344+
formatter: Optional[Callable] = None,
345+
na_rep: str = "NaT",
346+
date_format: Optional[str] = None,
343347
) -> List[str]:
344348
"""
345349
Render a string representation of the Index.
@@ -352,7 +356,7 @@ def format(
352356
if formatter is not None:
353357
return header + list(self.map(formatter))
354358

355-
return self._format_with_header(header, date_format=date_format, na_rep=na_rep)
359+
return self._format_with_header(header, na_rep=na_rep, date_format=date_format)
356360

357361
def _format_with_header(self, header, na_rep="NaT", date_format=None) -> List[str]:
358362
return header + list(

0 commit comments

Comments
 (0)