Skip to content

Commit dc9df6a

Browse files
committed
Fix indentation based on review
(plus a bonus tab-to-space fix)
1 parent 27a1c1e commit dc9df6a

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

‎src/_image_wrapper.cpp‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ _get_transform_mesh(const py::object& transform, const py::ssize_t *dims)
7373
for (auto y = 0; y < dims[0]; ++y) {
7474
for (auto x = 0; x < dims[1]; ++x) {
7575
// The convention for the supplied transform is that pixel centers
76-
// are at 0.5, 1.5, 2.5, etc.
76+
// are at 0.5, 1.5, 2.5, etc.
7777
*p++ = (double)x + 0.5;
7878
*p++ = (double)y + 0.5;
7979
}
@@ -87,16 +87,16 @@ _get_transform_mesh(const py::object& transform, const py::ssize_t *dims)
8787
if (output_mesh_array.ndim() != 2) {
8888
throw std::runtime_error(mpl::format(
8989
"Inverse transformed mesh array should be 2D not {}D",
90-
output_mesh_array.ndim()));
90+
output_mesh_array.ndim()));
9191
}
9292

9393
// An undersized mesh would be read out of bounds by the resampler.
9494
if (output_mesh_array.shape(0) != mesh_dims[0] ||
9595
output_mesh_array.shape(1) != mesh_dims[1]) {
9696
throw std::runtime_error(mpl::format(
9797
"Inverse transformed mesh array should have shape ({}, {}) not ({}, {})",
98-
mesh_dims[0], mesh_dims[1],
99-
output_mesh_array.shape(0), output_mesh_array.shape(1)));
98+
mesh_dims[0], mesh_dims[1],
99+
output_mesh_array.shape(0), output_mesh_array.shape(1)));
100100
}
101101

102102
return output_mesh_array;
@@ -126,7 +126,7 @@ image_resample(py::array input_array,
126126
if (ndim == 3 && input_array.shape(2) != 4) {
127127
throw std::invalid_argument(mpl::format(
128128
"3D input array must be RGBA with shape (M, N, 4), has trailing dimension of {}",
129-
input_array.shape(2)));
129+
input_array.shape(2)));
130130
}
131131

132132
// Ensure input array is contiguous, regardless of dtype
@@ -141,13 +141,13 @@ image_resample(py::array input_array,
141141
if (out_ndim != ndim) {
142142
throw std::invalid_argument(mpl::format(
143143
"Input ({}D) and output ({}D) arrays have different dimensionalities",
144-
ndim, out_ndim));
144+
ndim, out_ndim));
145145
}
146146

147147
if (out_ndim == 3 && output_array.shape(2) != 4) {
148148
throw std::invalid_argument(mpl::format(
149149
"3D output array must be RGBA with shape (M, N, 4), has trailing dimension of {}",
150-
output_array.shape(2)));
150+
output_array.shape(2)));
151151
}
152152

153153
if (!output_array.dtype().is(dtype)) {
@@ -225,7 +225,7 @@ raise_image_comparison_failure(std::string msg)
225225
{
226226
auto exceptions = py::module_::import("matplotlib.testing.exceptions");
227227
auto ImageComparisonFailure = exceptions.attr("ImageComparisonFailure");
228-
py::set_error(ImageComparisonFailure.ptr(), msg.c_str());
228+
py::set_error(ImageComparisonFailure, msg.c_str());
229229
throw py::error_already_set();
230230
}
231231

@@ -241,7 +241,7 @@ calculate_rms_and_diff(py::array_t<unsigned char> expected_image,
241241
if (image.ndim() != 3) {
242242
raise_image_comparison_failure(mpl::format(
243243
"{} image must be 3-dimensional, but is {}-dimensional",
244-
name, image.ndim()));
244+
name, image.ndim()));
245245
}
246246
}
247247

@@ -259,7 +259,7 @@ calculate_rms_and_diff(py::array_t<unsigned char> expected_image,
259259
raise_image_comparison_failure(mpl::format(
260260
"Image sizes do not match expected size: {expected_image.shape} "
261261
"actual size {actual_image.shape}",
262-
"expected_image"_a=expected_image, "actual_image"_a=actual_image));
262+
"expected_image"_a=expected_image, "actual_image"_a=actual_image));
263263
}
264264
auto expected = expected_image.unchecked<3>();
265265
auto actual = actual_image.unchecked<3>();

‎src/_tkagg.cpp‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,17 @@ mpl_tk_blit(py::object interp_obj, const char *photo_name,
111111
auto data_ptr = data.mutable_unchecked<3>(); // Checks ndim and writeable flag.
112112
if (data.shape(2) != 4) {
113113
throw py::value_error(mpl::format(
114-
"Data pointer must be RGBA; last dimension is {}, not 4",
115-
data.shape(2)));
114+
"Data pointer must be RGBA; last dimension is {}, not 4", data.shape(2)));
116115
}
117116
if (data.shape(0) > INT_MAX) { // Limited by Tk_PhotoPutBlock argument type.
118117
throw std::range_error(mpl::format(
119118
"Height ({}) exceeds maximum allowable size ({})",
120-
data.shape(0), INT_MAX));
119+
data.shape(0), INT_MAX));
121120
}
122121
if (data.shape(1) > INT_MAX / 4) { // Limited by Tk_PhotoImageBlock.pitch field.
123122
throw std::range_error(mpl::format(
124123
"Width ({}) exceeds maximum allowable size ({})",
125-
data.shape(1), INT_MAX / 4));
124+
data.shape(1), INT_MAX / 4));
126125
}
127126
const auto height = static_cast<int>(data.shape(0));
128127
const auto width = static_cast<int>(data.shape(1));

‎src/mplutils.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ inline void check_trailing_shape(T array, char const* name, long d1)
9090
if (array.shape(1) != d1) {
9191
throw py::value_error(mpl::format(
9292
"{} must have shape (N, {}), got ({}, {})",
93-
name, d1, array.shape(0), array.shape(1)));
93+
name, d1, array.shape(0), array.shape(1)));
9494
}
9595
}
9696

@@ -109,7 +109,7 @@ inline void check_trailing_shape(T array, char const* name, long d1, long d2)
109109
if (array.shape(1) != d1 || array.shape(2) != d2) {
110110
throw py::value_error(mpl::format(
111111
"{} must have shape (N, {}, {}), got ({}, {}, {})",
112-
name, d1, d2, array.shape(0), array.shape(1), array.shape(2)));
112+
name, d1, d2, array.shape(0), array.shape(1), array.shape(2)));
113113
}
114114
}
115115

0 commit comments

Comments
 (0)