From 94ad5582c6bfb428d34a2a92a58c508b7fc5fbc8 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 23 Feb 2021 11:19:30 +0100 Subject: [PATCH] CLN: rename do_integrity_check to verify_integrity in internals --- pandas/core/internals/array_manager.py | 12 ++++++------ pandas/core/internals/concat.py | 4 ++-- pandas/core/internals/managers.py | 14 +++++++------- pandas/core/internals/ops.py | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pandas/core/internals/array_manager.py b/pandas/core/internals/array_manager.py index d38d278e89a67..1d954d52147fb 100644 --- a/pandas/core/internals/array_manager.py +++ b/pandas/core/internals/array_manager.py @@ -79,7 +79,7 @@ class ArrayManager(DataManager): ---------- arrays : Sequence of arrays axes : Sequence of Index - do_integrity_check : bool, default True + verify_integrity : bool, default True """ @@ -95,14 +95,14 @@ def __init__( self, arrays: List[Union[np.ndarray, ExtensionArray]], axes: List[Index], - do_integrity_check: bool = True, + verify_integrity: bool = True, ): # Note: we are storing the axes in "_axes" in the (row, columns) order # which contrasts the order how it is stored in BlockManager self._axes = axes self.arrays = arrays - if do_integrity_check: + if verify_integrity: self._axes = [ensure_index(ax) for ax in axes] self._verify_integrity() @@ -607,7 +607,7 @@ def get_slice(self, slobj: slice, axis: int = 0) -> ArrayManager: new_axes = list(self._axes) new_axes[axis] = new_axes[axis][slobj] - return type(self)(arrays, new_axes, do_integrity_check=False) + return type(self)(arrays, new_axes, verify_integrity=False) def fast_xs(self, loc: int) -> ArrayLike: """ @@ -831,7 +831,7 @@ def _reindex_indexer( new_axes = list(self._axes) new_axes[axis] = new_axis - return type(self)(new_arrays, new_axes, do_integrity_check=False) + return type(self)(new_arrays, new_axes, verify_integrity=False) def take(self, indexer, axis: int = 1, verify: bool = True, convert: bool = True): """ @@ -909,7 +909,7 @@ def unstack(self, unstacker, fill_value) -> ArrayManager: new_columns = unstacker.get_new_columns(self._axes[1]) new_axes = [new_index, new_columns] - return type(self)(new_arrays, new_axes, do_integrity_check=False) + return type(self)(new_arrays, new_axes, verify_integrity=False) # TODO # equals diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 362f2fde47e0b..a71fdff043212 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -80,12 +80,12 @@ def concatenate_array_managers( concat_compat([mgrs[i].arrays[j] for i in range(len(mgrs))]) for j in range(len(mgrs[0].arrays)) ] - return ArrayManager(arrays, [axes[1], axes[0]], do_integrity_check=False) + return ArrayManager(arrays, [axes[1], axes[0]], verify_integrity=False) else: # concatting along the columns -> combine reindexed arrays in a single manager assert concat_axis == 0 arrays = list(itertools.chain.from_iterable([mgr.arrays for mgr in mgrs])) - return ArrayManager(arrays, [axes[1], axes[0]], do_integrity_check=False) + return ArrayManager(arrays, [axes[1], axes[0]], verify_integrity=False) def concatenate_managers( diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index 86df773147e21..c43261716076c 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -128,7 +128,7 @@ class BlockManager(DataManager): ---------- blocks: Sequence of Block axes: Sequence of Index - do_integrity_check: bool, default True + verify_integrity: bool, default True Notes ----- @@ -151,7 +151,7 @@ def __init__( self, blocks: Sequence[Block], axes: Sequence[Index], - do_integrity_check: bool = True, + verify_integrity: bool = True, ): self.axes = [ensure_index(ax) for ax in axes] self.blocks: Tuple[Block, ...] = tuple(blocks) @@ -163,7 +163,7 @@ def __init__( f"number of axes ({self.ndim})" ) - if do_integrity_check: + if verify_integrity: self._verify_integrity() # Populate known_consolidate, blknos, and blklocs lazily @@ -176,7 +176,7 @@ def from_blocks(cls, blocks: List[Block], axes: List[Index]): """ Constructor for BlockManager and SingleBlockManager with same signature. """ - return cls(blocks, axes, do_integrity_check=False) + return cls(blocks, axes, verify_integrity=False) @property def blknos(self): @@ -760,7 +760,7 @@ def get_slice(self, slobj: slice, axis: int = 0) -> BlockManager: new_axes = list(self.axes) new_axes[axis] = new_axes[axis][slobj] - bm = type(self)(new_blocks, new_axes, do_integrity_check=False) + bm = type(self)(new_blocks, new_axes, verify_integrity=False) return bm @property @@ -1499,7 +1499,7 @@ def __init__( self, block: Block, axis: Index, - do_integrity_check: bool = False, + verify_integrity: bool = False, fastpath=lib.no_default, ): assert isinstance(block, Block), type(block) @@ -1523,7 +1523,7 @@ def from_blocks(cls, blocks: List[Block], axes: List[Index]) -> SingleBlockManag """ assert len(blocks) == 1 assert len(axes) == 1 - return cls(blocks[0], axes[0], do_integrity_check=False) + return cls(blocks[0], axes[0], verify_integrity=False) @classmethod def from_array(cls, array: ArrayLike, index: Index) -> SingleBlockManager: diff --git a/pandas/core/internals/ops.py b/pandas/core/internals/ops.py index 70d4f3b91c245..602c4bfd740ca 100644 --- a/pandas/core/internals/ops.py +++ b/pandas/core/internals/ops.py @@ -80,7 +80,7 @@ def operate_blockwise( # assert len(slocs) == nlocs, (len(slocs), nlocs) # assert slocs == set(range(nlocs)), slocs - new_mgr = type(right)(res_blks, axes=right.axes, do_integrity_check=False) + new_mgr = type(right)(res_blks, axes=right.axes, verify_integrity=False) return new_mgr