Skip to content

Commit

Permalink
TYP: add types to params
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Aug 17, 2020
1 parent fabec53 commit bbb33d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,9 @@ def format(

return self._format_with_header(header, na_rep=na_rep)

def _format_with_header(self, header, na_rep="NaN") -> List[str_t]:
def _format_with_header(
self, header: List[str_t], na_rep: str_t = "NaN"
) -> List[str_t]:
from pandas.io.formats.format import format_array

values = self._values
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def _format_attrs(self):
attrs.append(("length", len(self)))
return attrs

def _format_with_header(self, header, na_rep="NaN") -> List[str]:
def _format_with_header(self, header: List[str], na_rep: str = "NaN") -> List[str]:
from pandas.io.formats.printing import pprint_thing

result = [
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ def format(

return self._format_with_header(header, na_rep=na_rep, date_format=date_format)

def _format_with_header(self, header, na_rep="NaT", date_format=None) -> List[str]:
def _format_with_header(
self, header: List[str], na_rep: str = "NaT", date_format: Optional[str] = None
) -> List[str]:
return header + list(
self._format_native_types(na_rep=na_rep, date_format=date_format)
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
# Rendering Methods
# __repr__ associated methods are based on MultiIndex

def _format_with_header(self, header, na_rep="NaN") -> List[str]:
def _format_with_header(self, header: List[str], na_rep: str = "NaN") -> List[str]:
return header + list(self._format_native_types(na_rep=na_rep))

def _format_native_types(self, na_rep="NaN", quoting=None, **kwargs):
Expand Down

0 comments on commit bbb33d5

Please sign in to comment.