Skip to content

Commit

Permalink
Move ignore comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Dec 20, 2023
1 parent 14a5f02 commit da084fb
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,8 @@ def wrapper(*args, **kwargs):
# [..., Any] | str] | dict[Hashable,Callable[..., Any] | str |
# list[Callable[..., Any] | str]]"; expected "Hashable"
nb_looper = generate_apply_looper(
self.func,
**engine_kwargs, # type: ignore[arg-type]
self.func, # type: ignore[arg-type]
**engine_kwargs,
)
result = nb_looper(self.values, self.axis)
# If we made the result 2-D, squeeze it back to 1-D
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ def fillna(
# "ExtensionArray"; expected "ndarray"
value = missing.check_value_size(
value,
mask,
len(self), # type: ignore[arg-type]
mask, # type: ignore[arg-type]
len(self),
)

if mask.any():
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2696,8 +2696,8 @@ def _dt_tz_localize(
"shift_backward": "earliest",
"shift_forward": "latest",
}.get(
nonexistent,
None, # type: ignore[arg-type]
nonexistent, # type: ignore[arg-type]
None,
)
if nonexistent_pa is None:
raise NotImplementedError(f"{nonexistent=} is not supported")
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,8 @@ def fillna(
# "ExtensionArray"; expected "ndarray"
value = missing.check_value_size(
value,
mask,
len(self), # type: ignore[arg-type]
mask, # type: ignore[arg-type]
len(self),
)

if mask.any():
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ def _add_timedeltalike(self, other: Timedelta | TimedeltaArray):
# dtype[timedelta64]]"; expected "Union[dtype[datetime64], DatetimeTZDtype]"
return type(self)._simple_new(
res_values,
dtype=self.dtype,
dtype=self.dtype, # type: ignore[arg-type]
freq=new_freq, # type: ignore[arg-type]
)

Expand All @@ -1266,9 +1266,9 @@ def _add_nat(self):
# incompatible type "Union[dtype[timedelta64], dtype[datetime64],
# DatetimeTZDtype]"; expected "Union[dtype[datetime64], DatetimeTZDtype]"
return type(self)._simple_new(
result,
dtype=self.dtype,
freq=None, # type: ignore[arg-type]
result, # type: ignore[arg-type]
dtype=self.dtype, # type: ignore[arg-type]
freq=None,
)

@final
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,8 @@ def value_counts(self, dropna: bool = True) -> Series:
arr = IntegerArray(value_counts, mask)
index = Index(
self.dtype.construct_array_type()(
keys,
mask_index, # type: ignore[arg-type]
keys, # type: ignore[arg-type]
mask_index,
)
)
return Series(arr, index=index, name="count", copy=False)
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,10 @@ def value_counts(
# "List[ndarray[Any, Any]]"; expected "List[Union[Union[ExtensionArray,
# ndarray[Any, Any]], Index, Series]]
_, idx = get_join_indexers(
left,
right,
left, # type: ignore[arg-type]
right, # type: ignore[arg-type]
sort=False,
how="left", # type: ignore[arg-type]
how="left",
)
if idx is not None:
out = np.where(idx != -1, out[idx], 0)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/groupby/grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ def is_in_obj(gpr) -> bool:
return False
if isinstance(gpr, Series) and isinstance(obj_gpr_column, Series):
return gpr._mgr.references_same_values( # type: ignore[union-attr]
obj_gpr_column._mgr,
0, # type: ignore[arg-type]
obj_gpr_column._mgr, # type: ignore[arg-type]
0,
)
return False
try:
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1842,8 +1842,8 @@ def shift(self, periods: int, fill_value: Any = None) -> list[Block]:
# error: Argument 1 to "np_can_hold_element" has incompatible type
# "Union[dtype[Any], ExtensionDtype]"; expected "dtype[Any]"
casted = np_can_hold_element(
self.dtype,
fill_value, # type: ignore[arg-type]
self.dtype, # type: ignore[arg-type]
fill_value,
)
except LossySetitemError:
nb = self.coerce_to_target_dtype(fill_value)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/internals/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def concatenate_managers(
# type "List[BlockManager]"; expected "List[Union[ArrayManager,
# SingleArrayManager, BlockManager, SingleBlockManager]]"
return _concatenate_array_managers(
mgrs,
mgrs, # type: ignore[arg-type]
axes,
concat_axis, # type: ignore[arg-type]
concat_axis,
)

# Assertions disabled for performance
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ def pivot(
# error: Unsupported operand types for + ("List[Any]" and "ExtensionArray")
# error: Unsupported left operand type for + ("ExtensionArray")
indexed = data.set_index(
cols + columns_listlike,
append=append, # type: ignore[operator]
cols + columns_listlike, # type: ignore[operator]
append=append,
)
else:
index_list: list[Index] | list[Series]
Expand Down
12 changes: 6 additions & 6 deletions pandas/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ def get_handle(
# "Union[str, BaseBuffer]"; expected "Union[Union[str, PathLike[str]],
# ReadBuffer[bytes], WriteBuffer[bytes]]"
handle = _BytesZipFile(
handle,
handle, # type: ignore[arg-type]
ioargs.mode,
**compression_args, # type: ignore[arg-type]
**compression_args,
)
if handle.buffer.mode == "r":
handles.append(handle)
Expand All @@ -819,8 +819,8 @@ def get_handle(
# type "BaseBuffer"; expected "Union[ReadBuffer[bytes],
# WriteBuffer[bytes], None]"
handle = _BytesTarFile(
fileobj=handle,
**compression_args, # type: ignore[arg-type]
fileobj=handle, # type: ignore[arg-type]
**compression_args,
)
assert isinstance(handle, _BytesTarFile)
if "r" in handle.buffer.mode:
Expand All @@ -844,9 +844,9 @@ def get_handle(
# BaseBuffer]"; expected "Optional[Union[Union[str, bytes, PathLike[str],
# PathLike[bytes]], IO[bytes]], None]"
handle = get_lzma_file()(
handle,
handle, # type: ignore[arg-type]
ioargs.mode,
**compression_args, # type: ignore[arg-type]
**compression_args,
)

# Zstd Compression
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/excel/_calamine.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def load_workbook(
from python_calamine import load_workbook

return load_workbook(
filepath_or_buffer,
**engine_kwargs, # type: ignore[arg-type]
filepath_or_buffer, # type: ignore[arg-type]
**engine_kwargs,
)

@property
Expand Down

0 comments on commit da084fb

Please sign in to comment.