From da084fbcc7b2680814e65f356187243549b12493 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 20 Dec 2023 10:38:51 -0800 Subject: [PATCH] Move ignore comments --- pandas/core/apply.py | 4 ++-- pandas/core/arrays/_mixins.py | 4 ++-- pandas/core/arrays/arrow/array.py | 4 ++-- pandas/core/arrays/base.py | 4 ++-- pandas/core/arrays/datetimelike.py | 8 ++++---- pandas/core/arrays/masked.py | 4 ++-- pandas/core/groupby/generic.py | 6 +++--- pandas/core/groupby/grouper.py | 4 ++-- pandas/core/internals/blocks.py | 4 ++-- pandas/core/internals/concat.py | 4 ++-- pandas/core/reshape/pivot.py | 4 ++-- pandas/io/common.py | 12 ++++++------ pandas/io/excel/_calamine.py | 4 ++-- 13 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pandas/core/apply.py b/pandas/core/apply.py index 5072ada6fbd06..22b77fec34eb4 100644 --- a/pandas/core/apply.py +++ b/pandas/core/apply.py @@ -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 diff --git a/pandas/core/arrays/_mixins.py b/pandas/core/arrays/_mixins.py index f529502e8ab8d..a4449bfc3490f 100644 --- a/pandas/core/arrays/_mixins.py +++ b/pandas/core/arrays/_mixins.py @@ -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(): diff --git a/pandas/core/arrays/arrow/array.py b/pandas/core/arrays/arrow/array.py index 4b55c2d493130..783573b1a72b9 100644 --- a/pandas/core/arrays/arrow/array.py +++ b/pandas/core/arrays/arrow/array.py @@ -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") diff --git a/pandas/core/arrays/base.py b/pandas/core/arrays/base.py index ef7fb1f4ed7ce..f22c192194bc3 100644 --- a/pandas/core/arrays/base.py +++ b/pandas/core/arrays/base.py @@ -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(): diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 5bc4d88757324..025b7a7c0e228 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -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] ) @@ -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 diff --git a/pandas/core/arrays/masked.py b/pandas/core/arrays/masked.py index c12766e10b73a..e75ced9be5eca 100644 --- a/pandas/core/arrays/masked.py +++ b/pandas/core/arrays/masked.py @@ -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) diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index 850bf4fc46dcd..efe212c9b9345 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -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) diff --git a/pandas/core/groupby/grouper.py b/pandas/core/groupby/grouper.py index 654f71b1443e9..da51a18dd6354 100644 --- a/pandas/core/groupby/grouper.py +++ b/pandas/core/groupby/grouper.py @@ -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: diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index e3f90d2281deb..5085ee0988e5a 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -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) diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 3d5bd9eb94f50..4445627732a9b 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -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 diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index a8d81e6b5b81e..20691fe3124b8 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -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] diff --git a/pandas/io/common.py b/pandas/io/common.py index 42e54ee3b1744..c86a05c7c493f 100644 --- a/pandas/io/common.py +++ b/pandas/io/common.py @@ -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) @@ -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: @@ -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 diff --git a/pandas/io/excel/_calamine.py b/pandas/io/excel/_calamine.py index 3d61f70dc7800..1f721c65982d4 100644 --- a/pandas/io/excel/_calamine.py +++ b/pandas/io/excel/_calamine.py @@ -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