Skip to content

Commit 9373333

Browse files
TYP: Fix mypy errors with type ignores
1 parent 5a211cc commit 9373333

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,9 @@ def __new__(
689689
if isinstance(data, (ExtensionArray, np.ndarray)):
690690
# GH 63388
691691
if copy is not False:
692-
if dtype is None or astype_is_view(data.dtype, dtype):
692+
if dtype is None or astype_is_view(
693+
data.dtype, dtype # type: ignore[arg-type]
694+
):
693695
data = data.copy()
694696
copy = False
695697

@@ -708,7 +710,7 @@ def __new__(
708710
dtarr = DatetimeArray._from_sequence_not_strict(
709711
data,
710712
dtype=dtype,
711-
copy=copy,
713+
copy=bool(copy),
712714
tz=tz,
713715
freq=freq,
714716
dayfirst=dayfirst,

pandas/core/indexes/interval.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,17 @@ def __new__(
268268
if isinstance(data, (ExtensionArray, np.ndarray)):
269269
# GH#63388
270270
if copy is not False:
271-
if dtype is None or astype_is_view(data.dtype, dtype):
271+
if dtype is None or astype_is_view(
272+
data.dtype, dtype # type: ignore[arg-type]
273+
):
272274
data = data.copy()
273275
copy = False
274276

275277
with rewrite_exception("IntervalArray", cls.__name__):
276278
array = IntervalArray(
277279
data,
278280
closed=closed,
279-
copy=copy,
281+
copy=bool(copy),
280282
dtype=dtype,
281283
verify_integrity=verify_integrity,
282284
)

pandas/core/indexes/period.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ def __new__(
241241
if isinstance(data, (ExtensionArray, np.ndarray)):
242242
# GH 63388
243243
if copy is not False:
244-
if dtype is None or astype_is_view(data.dtype, dtype):
244+
if dtype is None or astype_is_view(
245+
data.dtype, dtype # type: ignore[arg-type]
246+
):
245247
data = data.copy()
246248
copy = False
247249

0 commit comments

Comments
 (0)