Skip to content

Commit

Permalink
pre-commit autoupdate (#2754)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus authored Dec 5, 2023
1 parent 7008d95 commit cd06b35
Show file tree
Hide file tree
Showing 52 changed files with 621 additions and 800 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -24,14 +24,14 @@ repos:
- id: remove-tabs
args: [--whitespaces-count, '4']
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.11.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
types: [file]
files: \.(yaml|yml|clang-format)
- repo: https://github.com/tdegeus/cpp_comment_format
rev: v0.2.0
rev: v0.2.1
hooks:
- id: cpp_comment_format
- repo: https://github.com/tdegeus/conda_envfile
Expand All @@ -41,7 +41,7 @@ repos:
files: environment.yaml
# Externally provided executables (so we can use them with editors as well).
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.6
hooks:
- id: clang-format
files: .*\.[hc]pp$
24 changes: 12 additions & 12 deletions include/xtensor/xadapt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ namespace xt
/**
* Adapt a smart pointer to a typed memory block (unique_ptr or shared_ptr)
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
* #include <xtensor/xio.hpp>
*
Expand All @@ -674,7 +674,7 @@ namespace xt
* auto xptr = adapt_smart_ptr(sptr, shape);
* xptr(1, 3) = 123.;
* std::cout << xptr;
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @param smart_ptr a smart pointer to a memory block of T[]
Expand All @@ -701,7 +701,7 @@ namespace xt
* a given shape and operate naturally on it. Memory will be automatically
* handled by the smart pointer implementation.
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
* #include <xtensor/xio.hpp>
*
Expand Down Expand Up @@ -733,7 +733,7 @@ namespace xt
* shape, std::move(unique_buf));
* std::cout << obj << std::endl;
* }
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @param data_ptr A pointer to a typed data block (e.g. double*)
Expand Down Expand Up @@ -763,7 +763,7 @@ namespace xt
/**
* Adapt a smart pointer to a typed memory block (unique_ptr or shared_ptr)
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
* #include <xtensor/xio.hpp>
*
Expand All @@ -772,7 +772,7 @@ namespace xt
* auto xptr = adapt_smart_ptr(sptr, {4, 2});
* xptr(1, 3) = 123.;
* std::cout << xptr;
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @param smart_ptr a smart pointer to a memory block of T[]
Expand Down Expand Up @@ -802,7 +802,7 @@ namespace xt
* a given shape and operate naturally on it. Memory will be automatically
* handled by the smart pointer implementation.
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
* #include <xtensor/xio.hpp>
*
Expand Down Expand Up @@ -832,7 +832,7 @@ namespace xt
* {2, 4}, std::move(unique_buf));
* std::cout << obj << std::endl;
* }
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @param data_ptr A pointer to a typed data block (e.g. double*)
Expand Down Expand Up @@ -868,14 +868,14 @@ namespace xt
*
* Construct for example with:
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
*
* std::array<size_t, 2> shape = {2, 2};
* std::vector<double> data = {1, 2, 3, 4};
*
* xt::xtensor_pointer<double, 2> a = xt::adapt(data.data(), 4, xt::no_ownership(), shape);
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @tparam T The data type (e.g. ``double``).
Expand All @@ -893,14 +893,14 @@ namespace xt
*
* Construct for example with:
*
* \code{.cpp}
* @code{.cpp}
* #include <xtensor/xadapt.hpp>
*
* std::vector<int> data(4, 0);
* xt::svector<size_t> shape({2, 2});
*
* xt::xarray_pointer<int> a = xt::adapt(data.data(), data.size(), xt::no_ownership(), shape);
* \endcode
* @endcode
*
* @ingroup xt_xadapt
* @tparam T The data type (e.g. ``double``).
Expand Down
3 changes: 2 additions & 1 deletion include/xtensor/xblockwise_reducer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ namespace xt
}
return input_chunk_range_type{
multiindex_iterator_begin<input_chunk_index_type>(input_chunks_begin, input_chunks_end),
multiindex_iterator_end<input_chunk_index_type>(input_chunks_begin, input_chunks_end)};
multiindex_iterator_end<input_chunk_index_type>(input_chunks_begin, input_chunks_end)
};
}

template <class CT, class F, class X, class O>
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor/xbroadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.uncheked(0, 1);
* \endcode
* @endcode
*/
template <class CT, class X>
template <class... Args>
Expand Down
16 changes: 8 additions & 8 deletions include/xtensor/xbuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,13 @@ namespace xt
* @param axis axis along which elements are concatenated
* @returns xgenerator evaluating to concatenated elements
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{1, 2, 3}};
* xt::xarray<double> b = {{2, 3, 4}};
* xt::xarray<double> c = xt::concatenate(xt::xtuple(a, b)); // => {{1, 2, 3},
* // {2, 3, 4}}
* xt::xarray<double> d = xt::concatenate(xt::xtuple(a, b), 1); // => {{1, 2, 3, 2, 3, 4}}
* \endcode
* @endcode
*/
template <class... CT>
inline auto concatenate(std::tuple<CT...>&& t, std::size_t axis = 0)
Expand Down Expand Up @@ -823,15 +823,15 @@ namespace xt
* @param axis axis along which elements are stacked
* @returns xgenerator evaluating to stacked elements
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {1, 2, 3};
* xt::xarray<double> b = {5, 6, 7};
* xt::xarray<double> s = xt::stack(xt::xtuple(a, b)); // => {{1, 2, 3},
* // {5, 6, 7}}
* xt::xarray<double> t = xt::stack(xt::xtuple(a, b), 1); // => {{1, 5},
* // {2, 6},
* // {3, 7}}
* \endcode
* @endcode
*/
template <class... CT>
inline auto stack(std::tuple<CT...>&& t, std::size_t axis = 0)
Expand Down Expand Up @@ -1093,12 +1093,12 @@ namespace xt
* from which the diagonals should be taken.
* @returns xexpression with values of the diagonal
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{1, 2, 3},
* {4, 5, 6}
* {7, 8, 9}};
* auto b = xt::diagonal(a); // => {1, 5, 9}
* \endcode
* @endcode
*/
template <class E>
inline auto diagonal(E&& arr, int offset = 0, std::size_t axis_1 = 0, std::size_t axis_2 = 1)
Expand Down Expand Up @@ -1145,12 +1145,12 @@ namespace xt
* @param k the offset of the considered diagonal
* @returns xexpression function with shape n x n and arr on the diagonal
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {1, 5, 9};
* auto b = xt::diag(a); // => {{1, 0, 0},
* // {0, 5, 0},
* // {0, 0, 9}}
* \endcode
* @endcode
*/
template <class E>
inline auto diag(E&& arr, int k = 0)
Expand Down
12 changes: 6 additions & 6 deletions include/xtensor/xcontainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.uncheked(0, 1);
* \endcode
* @endcode
*/
template <class D>
template <class... Args>
Expand All @@ -506,12 +506,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.uncheked(0, 1);
* \endcode
* @endcode
*/
template <class D>
template <class... Args>
Expand Down Expand Up @@ -1080,11 +1080,11 @@ namespace xt
* Reshapes the container and keeps old elements. The `shape` argument can have one of its value
* equal to `-1`, in this case the value is inferred from the number of elements in the container
* and the remaining values in the `shape`.
* \code{.cpp}
* @code{.cpp}
* xt::xarray<int> a = { 1, 2, 3, 4, 5, 6, 7, 8 };
* a.reshape({-1, 4});
* //a.shape() is {2, 4}
* \endcode
* @endcode
* @param shape the new shape (has to have same number of elements as the original container)
* @param layout the layout to compute the strides (defaults to static layout of the container,
* or for a container with dynamic layout to XTENSOR_DEFAULT_LAYOUT)
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/xeval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ namespace xt
/**
* Force evaluation of xexpression.
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {1, 2, 3, 4};
* auto&& b = xt::eval(a); // b is a reference to a, no copy!
* auto&& c = xt::eval(a + b); // c is xarray<double>, not an xexpression
* \endcode
* @endcode
*
* @ingroup xt_xeval
* @return xt::xarray or xt::xtensor depending on shape type
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace xt
* Force evaluation of xexpression not providing a data interface
* and convert to the required layout.
*
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double, xt::layout_type::row_major> a = {1, 2, 3, 4};
*
* // take reference to a (no copy!)
Expand All @@ -137,7 +137,7 @@ namespace xt
*
* // xarray<int> with the required layout
* auto&& e = xt::as_strided<xt::layout_type::column_major>(a_cast);
* \endcode
* @endcode
*
* @warning This function should be used in a local context only.
* Returning the value returned by this function could lead to a dangling reference.
Expand Down
20 changes: 10 additions & 10 deletions include/xtensor/xexpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,16 @@ namespace xt
{
};

#define XTENSOR_FORWARD_CONST_METHOD(name) \
auto name() const->decltype(std::declval<xtl::constify_t<E>>().name()) \
{ \
return m_ptr->name(); \
#define XTENSOR_FORWARD_CONST_METHOD(name) \
auto name() const -> decltype(std::declval<xtl::constify_t<E>>().name()) \
{ \
return m_ptr->name(); \
}

#define XTENSOR_FORWARD_METHOD(name) \
auto name()->decltype(std::declval<E>().name()) \
{ \
return m_ptr->name(); \
#define XTENSOR_FORWARD_METHOD(name) \
auto name() -> decltype(std::declval<E>().name()) \
{ \
return m_ptr->name(); \
}

#define XTENSOR_FORWARD_CONST_ITERATOR_METHOD(name) \
Expand Down Expand Up @@ -489,7 +489,7 @@ namespace xt
* For example, when a temporary expression needs to be used twice in another
* expression, shared expressions can come to the rescue:
*
* \code{.cpp}
* @code{.cpp}
* template <class E>
* auto cos_plus_sin(xexpression<E>&& expr)
* {
Expand All @@ -502,7 +502,7 @@ namespace xt
* std::cout << shared_expr.use_count() << std::endl; // Will print 3 because used twice in expression
* return result; // all valid because expr lifetime managed by xshared_expression / shared_ptr.
* }
* \endcode
* @endcode
*/
template <class E>
class xshared_expression : public xexpression<xshared_expression<E>>
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor/xfunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.unchecked(0, 1);
* \endcode
* @endcode
*/
template <class F, class... CT>
template <class... Args>
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/xfunctor_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.unchecked(0, 1);
* \endcode
* @endcode
*/
template <class D>
template <class... Args>
Expand Down Expand Up @@ -842,12 +842,12 @@ namespace xt
* it is possible.
* @warning This method is NOT compatible with broadcasting, meaning the following
* code has undefined behavior:
* \code{.cpp}
* @code{.cpp}
* xt::xarray<double> a = {{0, 1}, {2, 3}};
* xt::xarray<double> b = {0, 1};
* auto fd = a + b;
* double res = fd.uncheked(0, 1);
* \endcode
* @endcode
*/
template <class D>
template <class... Args>
Expand Down
Loading

0 comments on commit cd06b35

Please sign in to comment.