Skip to content

Commit acc30ed

Browse files
committed
Nitpicking
1 parent 5c55426 commit acc30ed

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

include/xtensor-python/xtensor_type_caster_base.hpp

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,90 +24,90 @@ namespace pybind11
2424
namespace detail
2525
{
2626
template <typename T, xt::layout_type L>
27-
struct xtensor_get_buffer
27+
struct pybind_array_getter_impl
2828
{
29-
static auto get(handle src)
29+
static auto run(handle src)
3030
{
3131
return array_t<T, array::c_style | array::forcecast>::ensure(src);
3232
}
3333
};
3434

3535
template <typename T>
36-
struct xtensor_get_buffer<T, xt::layout_type::column_major>
36+
struct pybind_array_getter_impl<T, xt::layout_type::column_major>
3737
{
38-
static auto get(handle src)
38+
static auto run(handle src)
3939
{
4040
return array_t<T, array::f_style | array::forcecast>::ensure(src);
4141
}
4242
};
4343

4444
template <class T>
45-
struct xtensor_check_buffer
45+
struct pybind_array_getter
4646
{
4747
};
4848

4949
template <class T, xt::layout_type L>
50-
struct xtensor_check_buffer<xt::xarray<T, L>>
50+
struct pybind_array_getter<xt::xarray<T, L>>
5151
{
52-
static auto get(handle src)
52+
static auto run(handle src)
5353
{
54-
return xtensor_get_buffer<T, L>::get(src);
54+
return pybind_array_getter_impl<T, L>::run(src);
5555
}
5656
};
5757

5858
template <class T, std::size_t N, xt::layout_type L>
59-
struct xtensor_check_buffer<xt::xtensor<T, N, L>>
59+
struct pybind_array_getter<xt::xtensor<T, N, L>>
6060
{
61-
static auto get(handle src)
61+
static auto run(handle src)
6262
{
63-
return xtensor_get_buffer<T, L>::get(src);
63+
return pybind_array_getter_impl<T, L>::run(src);
6464
}
6565
};
6666

6767
template <class CT, class S, xt::layout_type L, class FST>
68-
struct xtensor_check_buffer<xt::xstrided_view<CT, S, L, FST>>
68+
struct pybind_array_getter<xt::xstrided_view<CT, S, L, FST>>
6969
{
70-
static auto get(handle /*src*/)
70+
static auto run(handle /*src*/)
7171
{
7272
return false;
7373
}
7474
};
7575

7676
template <class EC, xt::layout_type L, class SC, class Tag>
77-
struct xtensor_check_buffer<xt::xarray_adaptor<EC, L, SC, Tag>>
77+
struct pybind_array_getter<xt::xarray_adaptor<EC, L, SC, Tag>>
7878
{
79-
static auto get(handle src)
79+
static auto run(handle src)
8080
{
81-
auto buf = xtensor_get_buffer<EC, L>::get(src);
81+
auto buf = pybind_array_getter_impl<EC, L>::run(src);
8282
return buf;
8383
}
8484
};
8585

8686
template <class EC, std::size_t N, xt::layout_type L, class Tag>
87-
struct xtensor_check_buffer<xt::xtensor_adaptor<EC, N, L, Tag>>
87+
struct pybind_array_getter<xt::xtensor_adaptor<EC, N, L, Tag>>
8888
{
89-
static auto get(handle /*src*/)
89+
static auto run(handle /*src*/)
9090
{
9191
return false;
9292
}
9393
};
9494

9595

9696
template <class T>
97-
struct xtensor_verify
97+
struct pybind_array_dim_checker
9898
{
9999
template <class B>
100-
static bool get(const B& buf)
100+
static bool run(const B& buf)
101101
{
102102
return true;
103103
}
104104
};
105105

106106
template <class T, std::size_t N, xt::layout_type L>
107-
struct xtensor_verify<xt::xtensor<T, N, L>>
107+
struct pybind_array_dim_checker<xt::xtensor<T, N, L>>
108108
{
109109
template <class B>
110-
static bool get(const B& buf)
110+
static bool run(const B& buf)
111111
{
112112
return buf.ndim() == N;
113113
}
@@ -199,16 +199,19 @@ namespace pybind11
199199
{
200200
using T = typename Type::value_type;
201201

202-
if (!convert && !array_t<T>::check_(src)) {
202+
if (!convert && !array_t<T>::check_(src))
203+
{
203204
return false;
204205
}
205206

206-
auto buf = xtensor_check_buffer<Type>::get(src);
207+
auto buf = pybind_array_getter<Type>::run(src);
207208

208-
if (!buf) {
209+
if (!buf)
210+
{
209211
return false;
210212
}
211-
if (!xtensor_verify<Type>::get(buf)) {
213+
if (!pybind_array_dim_checker<Type>::run(buf))
214+
{
212215
return false;
213216
}
214217

0 commit comments

Comments
 (0)