diff --git a/cpp/src/arrow/array/util.cc b/cpp/src/arrow/array/util.cc index 38aa3d0e4d4be..7f00d4a3fe44c 100644 --- a/cpp/src/arrow/array/util.cc +++ b/cpp/src/arrow/array/util.cc @@ -916,18 +916,17 @@ Result> MakeEmptyArray(std::shared_ptr type, return builder->Finish(); } -Result> MakeMaskArray(const std::vector &indices, int64_t length, - MemoryPool* memory_pool) { +Result> MakeMaskArray(const std::vector& indices, + int64_t length, MemoryPool* memory_pool) { BooleanBuilder builder(memory_pool); RETURN_NOT_OK(builder.Resize(length)); auto i = indices.begin(); - for(int64_t builder_i = 0; builder_i < length; builder_i++) { + for (int64_t builder_i = 0; builder_i < length; builder_i++) { if (builder_i == *i) { builder.UnsafeAppend(true); i++; - } - else { + } else { builder.UnsafeAppend(false); } } diff --git a/cpp/src/arrow/array/util.h b/cpp/src/arrow/array/util.h index 0f01ba673e256..90f92d096d7c7 100644 --- a/cpp/src/arrow/array/util.h +++ b/cpp/src/arrow/array/util.h @@ -69,7 +69,6 @@ ARROW_EXPORT Result> MakeEmptyArray(std::shared_ptr type, MemoryPool* pool = default_memory_pool()); - /// \brief Create an Array representing a boolean mask /// /// The mask will have all elements set to false except for those @@ -80,8 +79,9 @@ Result> MakeEmptyArray(std::shared_ptr type, /// \param[in] pool the memory pool to allocate memory from /// \return the resulting Array ARROW_EXPORT -Result> MakeMaskArray(const std::vector &indices, int64_t length, - MemoryPool* memory_pool = default_memory_pool()); +Result> MakeMaskArray( + const std::vector& indices, int64_t length, + MemoryPool* memory_pool = default_memory_pool()); /// @} namespace internal { diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 0319929ab3ada..6a4df8391cfc9 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -1884,7 +1884,8 @@ cdef class Array(_PandasConvertible): inner_array = pyarrow_unwrap_array(casted_array) except ArrowInvalid as e: raise ValueError( - f"Could not cast {self.type} to requested type {target_type}: {e}" + f"Could not cast {self.type} to requested type { + target_type}: {e}" ) else: inner_array = self.sp_array @@ -2029,7 +2030,8 @@ cdef class Array(_PandasConvertible): inner_array = pyarrow_unwrap_array(casted_array) except ArrowInvalid as e: raise ValueError( - f"Could not cast {self.type} to requested type {target_type}: {e}" + f"Could not cast {self.type} to requested type { + target_type}: {e}" ) else: inner_array = self.sp_array diff --git a/python/pyarrow/lib.pyx b/python/pyarrow/lib.pyx index 6b82eb6566896..95f09537c02cc 100644 --- a/python/pyarrow/lib.pyx +++ b/python/pyarrow/lib.pyx @@ -175,7 +175,8 @@ def _ensure_cuda_loaded(): if __cuda_loaded is not True: raise ImportError( "Trying to import data on a CUDA device, but PyArrow is not built with " - f"CUDA support.\n(importing 'pyarrow.cuda' resulted in \"{__cuda_loaded}\")." + f"CUDA support.\n(importing 'pyarrow.cuda' resulted in \"{ + __cuda_loaded}\")." ) diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 819bbc34c66b9..22f2dfef6a050 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -1395,7 +1395,8 @@ cdef class ChunkedArray(_PandasConvertible): chunked = self.cast(target_type, safe=True) except ArrowInvalid as e: raise ValueError( - f"Could not cast {self.type} to requested type {target_type}: {e}" + f"Could not cast {self.type} to requested type { + target_type}: {e}" ) else: chunked = self @@ -3776,7 +3777,8 @@ cdef class RecordBatch(_Tabular): inner_batch = pyarrow_unwrap_batch(casted_batch) except ArrowInvalid as e: raise ValueError( - f"Could not cast {self.schema} to requested schema {target_schema}: {e}" + f"Could not cast {self.schema} to requested schema { + target_schema}: {e}" ) else: inner_batch = self.sp_batch @@ -3955,7 +3957,8 @@ cdef class RecordBatch(_Tabular): inner_batch = pyarrow_unwrap_batch(casted_batch) except ArrowInvalid as e: raise ValueError( - f"Could not cast {self.schema} to requested schema {target_schema}: {e}" + f"Could not cast {self.schema} to requested schema { + target_schema}: {e}" ) else: inner_batch = self.sp_batch diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 1aa1ba8b75934..11c6eab317cd7 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -4207,4 +4207,4 @@ def test_non_cpu_array(): def test_mask_array(): expected = pa.array([False, False, True, False, True, False]) mask_array = pa.mask([2, 4], 6) - assert mask_array.equals(expected) \ No newline at end of file + assert mask_array.equals(expected) diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi index 70f12e9796e80..edfb53ab5a70b 100644 --- a/python/pyarrow/types.pxi +++ b/python/pyarrow/types.pxi @@ -141,7 +141,8 @@ cdef void* _as_c_pointer(v, allow_null=False) except *: else: capsule_name_str = capsule_name.decode() raise ValueError( - f"Can't convert PyCapsule with name '{capsule_name_str}' to pointer address" + f"Can't convert PyCapsule with name '{ + capsule_name_str}' to pointer address" ) else: raise TypeError(f"Expected a pointer value, got {type(v)!r}")