Skip to content

Commit 8142300

Browse files
try fix typing
1 parent fccd220 commit 8142300

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pandas/_libs/index.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class UInt16Engine(IndexEngine): ...
5454
class UInt8Engine(IndexEngine): ...
5555
class ObjectEngine(IndexEngine): ...
5656
class StringEngine(IndexEngine): ...
57-
class StringObjectEngine(ObjectEngine): ...
5857
class DatetimeEngine(Int64Engine): ...
5958
class TimedeltaEngine(DatetimeEngine): ...
6059
class PeriodEngine(Int64Engine): ...
@@ -73,6 +72,9 @@ class MaskedUInt16Engine(MaskedIndexEngine): ...
7372
class MaskedUInt8Engine(MaskedIndexEngine): ...
7473
class MaskedBoolEngine(MaskedUInt8Engine): ...
7574

75+
class StringObjectEngine(ObjectEngine):
76+
def __init__(self, values: object, na_value) -> None: ...
77+
7678
class BaseMultiIndexCodesEngine:
7779
levels: list[np.ndarray]
7880
offsets: np.ndarray # np.ndarray[..., ndim=1]

pandas/core/indexes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ def _engine(
876876
# ndarray[Any, Any]]" has no attribute "_ndarray" [union-attr]
877877
target_values = self._data._ndarray # type: ignore[union-attr]
878878
elif is_string_dtype(self.dtype) and not is_object_dtype(self.dtype):
879-
return libindex.StringObjectEngine(target_values, self.dtype.na_value)
879+
return libindex.StringObjectEngine(target_values, self.dtype.na_value) # type: ignore[union-attr]
880880

881881
# error: Argument 1 to "ExtensionEngine" has incompatible type
882882
# "ndarray[Any, Any]"; expected "ExtensionArray"
@@ -6223,7 +6223,7 @@ def _maybe_downcast_for_indexing(self, other: Index) -> tuple[Index, Index]:
62236223
self = Index(self._values)
62246224

62256225
elif self.dtype == "string" and other.dtype == "object":
6226-
if lib.is_string_array(other._values, skipna=True):
6226+
if lib.is_string_array(other._values, skipna=True): # type: ignore[arg-type]
62276227
return self, other.astype(self.dtype)
62286228

62296229
if not is_object_dtype(self.dtype) and is_object_dtype(other.dtype):

0 commit comments

Comments
 (0)