Skip to content

Commit

Permalink
Ignore override in type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
annika-rudolph committed Apr 25, 2024
1 parent 3e58fa7 commit 19d396d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pandas/core/indexes/datetimelike.py
Expand Up @@ -843,11 +843,16 @@ def take(
result._data._freq = freq
return result

def _shallow_copy(
self, values, name: Hashable = no_default, level_codes=no_default
@doc(Index._shallow_copy)
def _shallow_copy( # type: ignore[override]
self,
values,
name: Hashable = no_default,
level_codes=no_default,
) -> Self:
result = super()._shallow_copy(values=values, name=name)
if level_codes is not lib.no_default:
name = self._name if name is no_default else name
result = self._simple_new(values, name=name, refs=self._references)
if level_codes is not no_default:
indices = np.asarray(level_codes, dtype=np.intp)
maybe_slice = lib.maybe_indices_to_slice(indices, len(values))
if isinstance(maybe_slice, slice):
Expand Down

0 comments on commit 19d396d

Please sign in to comment.