File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -1195,9 +1195,7 @@ def maybe_cast_to_datetime(
1195
1195
1196
1196
# TODO: _from_sequence would raise ValueError in cases where
1197
1197
# _ensure_nanosecond_dtype raises TypeError
1198
- # Incompatible types in assignment (expression has type "Union[dtype[Any],
1199
- # ExtensionDtype]", variable has type "Optional[dtype[Any]]")
1200
- dtype = _ensure_nanosecond_dtype (dtype ) # type: ignore[assignment]
1198
+ _ensure_nanosecond_dtype (dtype )
1201
1199
1202
1200
if is_timedelta64_dtype (dtype ):
1203
1201
res = TimedeltaArray ._from_sequence (value , dtype = dtype )
@@ -1235,12 +1233,11 @@ def sanitize_to_nanoseconds(values: np.ndarray, copy: bool = False) -> np.ndarra
1235
1233
return values
1236
1234
1237
1235
1238
- def _ensure_nanosecond_dtype (dtype : DtypeObj ) -> DtypeObj :
1236
+ def _ensure_nanosecond_dtype (dtype : DtypeObj ) -> None :
1239
1237
"""
1240
1238
Convert dtypes with granularity less than nanosecond to nanosecond
1241
1239
1242
1240
>>> _ensure_nanosecond_dtype(np.dtype("M8[us]"))
1243
- dtype('<M8[us]')
1244
1241
1245
1242
>>> _ensure_nanosecond_dtype(np.dtype("M8[D]"))
1246
1243
Traceback (most recent call last):
@@ -1277,7 +1274,6 @@ def _ensure_nanosecond_dtype(dtype: DtypeObj) -> DtypeObj:
1277
1274
f"dtype={ dtype } is not supported. Supported resolutions are 's', "
1278
1275
"'ms', 'us', and 'ns'"
1279
1276
)
1280
- return dtype
1281
1277
1282
1278
1283
1279
# TODO: other value-dependent functions to standardize here include
You can’t perform that action at this time.
0 commit comments