Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class NDFrame(PandasObject, SelectionMixin, indexing.IndexingMixin):
_metadata: List[str] = []
_is_copy: Optional[weakref.ReferenceType[NDFrame]] = None
_mgr: Manager
_attrs: Dict[Optional[Hashable], Any]
_attrs: Dict[Hashable, Any]
_typ: str

# ----------------------------------------------------------------------
Expand All @@ -241,7 +241,7 @@ def __init__(
self,
data: Manager,
copy: bool = False,
attrs: Optional[Mapping[Optional[Hashable], Any]] = None,
attrs: Optional[Mapping[Hashable, Any]] = None,
):
# copy kwarg is retained for mypy compat, is not used

Expand Down Expand Up @@ -320,7 +320,7 @@ def _as_manager(self: FrameOrSeries, typ: str) -> FrameOrSeries:
# attrs and flags

@property
def attrs(self) -> Dict[Optional[Hashable], Any]:
def attrs(self) -> Dict[Hashable, Any]:
"""
Dictionary of global attributes of this dataset.

Expand All @@ -337,7 +337,7 @@ def attrs(self) -> Dict[Optional[Hashable], Any]:
return self._attrs

@attrs.setter
def attrs(self, value: Mapping[Optional[Hashable], Any]) -> None:
def attrs(self, value: Mapping[Hashable, Any]) -> None:
self._attrs = dict(value)

@final
Expand Down Expand Up @@ -803,7 +803,7 @@ def swapaxes(self: FrameOrSeries, axis1, axis2, copy=True) -> FrameOrSeries:
# error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
# None, None]"; expected "bool" [arg-type]
# error: Argument 2 to "NDFrame" has incompatible type "*Generator[Index,
# None, None]"; expected "Optional[Mapping[Optional[Hashable], Any]]"
# None, None]"; expected "Optional[Mapping[Hashable, Any]]"
new_values, # type: ignore[arg-type]
*new_axes, # type: ignore[arg-type]
).__finalize__(self, method="swapaxes")
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def read_json(
if dtype is None and orient != "table":
# error: Incompatible types in assignment (expression has type "bool", variable
# has type "Union[ExtensionDtype, str, dtype[Any], Type[str], Type[float],
# Type[int], Type[complex], Type[bool], Type[object], Dict[Optional[Hashable],
# Type[int], Type[complex], Type[bool], Type[object], Dict[Hashable,
# Union[ExtensionDtype, Union[str, dtype[Any]], Type[str], Type[float],
# Type[int], Type[complex], Type[bool], Type[object]]], None]")
dtype = True # type: ignore[assignment]
Expand Down Expand Up @@ -921,7 +921,7 @@ def _try_convert_data(self, name, data, use_dtypes=True, convert_dates=True):

# error: Non-overlapping identity check (left operand type:
# "Union[ExtensionDtype, str, dtype[Any], Type[object],
# Dict[Optional[Hashable], Union[ExtensionDtype, Union[str, dtype[Any]],
# Dict[Hashable, Union[ExtensionDtype, Union[str, dtype[Any]],
# Type[str], Type[float], Type[int], Type[complex], Type[bool],
# Type[object]]]]", right operand type: "Literal[True]")
elif self.dtype is True: # type: ignore[comparison-overlap]
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ def to_sql(
if not is_dict_like(dtype):
# error: Value expression in dictionary comprehension has incompatible
# type "Union[ExtensionDtype, str, dtype[Any], Type[object],
# Dict[Optional[Hashable], Union[ExtensionDtype, Union[str, dtype[Any]],
# Dict[Hashable, Union[ExtensionDtype, Union[str, dtype[Any]],
# Type[str], Type[float], Type[int], Type[complex], Type[bool],
# Type[object]]]]"; expected type "Union[ExtensionDtype, str,
# dtype[Any], Type[object]]"
Expand Down Expand Up @@ -2060,7 +2060,7 @@ def to_sql(
if not is_dict_like(dtype):
# error: Value expression in dictionary comprehension has incompatible
# type "Union[ExtensionDtype, str, dtype[Any], Type[object],
# Dict[Optional[Hashable], Union[ExtensionDtype, Union[str, dtype[Any]],
# Dict[Hashable, Union[ExtensionDtype, Union[str, dtype[Any]],
# Type[str], Type[float], Type[int], Type[complex], Type[bool],
# Type[object]]]]"; expected type "Union[ExtensionDtype, str,
# dtype[Any], Type[object]]"
Expand Down
4 changes: 2 additions & 2 deletions pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ def _make_legend(self):
self.legend_handles
)
# error: Incompatible types in assignment (expression has type
# "Iterator[Optional[Hashable]]", variable has type
# "List[Optional[Hashable]]")
# "Iterator[Hashable]", variable has type
# "List[Hashable]")
self.legend_labels = reversed( # type: ignore[assignment]
self.legend_labels
)
Expand Down