mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
chore(deps): update pre-commit hooks (#6002)
* chore(deps): update pre-commit hooks updates: - [github.com/pre-commit/mirrors-clang-format: v21.1.8 → v22.1.0](https://github.com/pre-commit/mirrors-clang-format/compare/v21.1.8...v22.1.0) - [github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.4) - [github.com/adhtruong/mirrors-typos: v1.42.3 → v1.44.0](https://github.com/adhtruong/mirrors-typos/compare/v1.42.3...v1.44.0) - [github.com/PyCQA/pylint: v4.0.4 → v4.0.5](https://github.com/PyCQA/pylint/compare/v4.0.4...v4.0.5) - [github.com/python-jsonschema/check-jsonschema: 0.36.1 → 0.37.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.36.1...0.37.0) * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
cd538ed118
commit
4d51aefc2c
@@ -25,14 +25,14 @@ repos:
|
||||
|
||||
# Clang format the codebase automatically
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: "v21.1.8"
|
||||
rev: "v22.1.0"
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c++, c, cuda]
|
||||
|
||||
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.14
|
||||
rev: v0.15.4
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: ["--fix", "--show-fixes"]
|
||||
@@ -122,7 +122,7 @@ repos:
|
||||
# Use mirror because pre-commit autoupdate confuses tags in the upstream repo.
|
||||
# See https://github.com/crate-ci/typos/issues/390
|
||||
- repo: https://github.com/adhtruong/mirrors-typos
|
||||
rev: "v1.42.3"
|
||||
rev: "v1.44.0"
|
||||
hooks:
|
||||
- id: typos
|
||||
args: []
|
||||
@@ -144,14 +144,14 @@ repos:
|
||||
|
||||
# PyLint has native support - not always usable, but works for us
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: "v4.0.4"
|
||||
rev: "v4.0.5"
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^pybind11
|
||||
|
||||
# Check schemas on some of our YAML files
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.36.1
|
||||
rev: 0.37.0
|
||||
hooks:
|
||||
- id: check-readthedocs
|
||||
- id: check-github-workflows
|
||||
|
||||
@@ -199,8 +199,7 @@ public:
|
||||
template <typename T_, \
|
||||
::pybind11::detail::enable_if_t< \
|
||||
std::is_same<type, ::pybind11::detail::remove_cv_t<T_>>::value, \
|
||||
int> \
|
||||
= 0> \
|
||||
int> = 0> \
|
||||
static ::pybind11::handle cast( \
|
||||
T_ *src, ::pybind11::return_value_policy policy, ::pybind11::handle parent) { \
|
||||
if (!src) \
|
||||
@@ -1663,8 +1662,7 @@ PYBIND11_NAMESPACE_END(detail)
|
||||
template <typename T,
|
||||
detail::enable_if_t<!detail::is_pyobject<T>::value
|
||||
&& !detail::is_same_ignoring_cvref<T, PyObject *>::value,
|
||||
int>
|
||||
= 0>
|
||||
int> = 0>
|
||||
T cast(const handle &handle) {
|
||||
using namespace detail;
|
||||
constexpr bool is_enum_cast = type_uses_type_caster_enum_type<intrinsic_t<T>>::value;
|
||||
@@ -1699,8 +1697,7 @@ template <typename T,
|
||||
typename Handle,
|
||||
detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value
|
||||
&& detail::is_same_ignoring_cvref<Handle, handle>::value,
|
||||
int>
|
||||
= 0>
|
||||
int> = 0>
|
||||
T cast(Handle &&handle) {
|
||||
return handle.inc_ref().ptr();
|
||||
}
|
||||
@@ -1709,8 +1706,7 @@ template <typename T,
|
||||
typename Object,
|
||||
detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value
|
||||
&& detail::is_same_ignoring_cvref<Object, object>::value,
|
||||
int>
|
||||
= 0>
|
||||
int> = 0>
|
||||
T cast(Object &&obj) {
|
||||
return obj.release().ptr();
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ public:
|
||||
return src;
|
||||
}
|
||||
static const std::chrono::duration<rep, period> &
|
||||
get_duration(const std::chrono::duration<rep, period> &&)
|
||||
= delete;
|
||||
get_duration(const std::chrono::duration<rep, period> &&) = delete;
|
||||
|
||||
// If this is a time_point get the time_since_epoch
|
||||
template <typename Clock>
|
||||
|
||||
@@ -304,11 +304,10 @@ struct constructor {
|
||||
extra...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && std::is_constructible<Cpp<Class>, Args...>::value, int>
|
||||
= 0>
|
||||
template <typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && std::is_constructible<Cpp<Class>, Args...>::value,
|
||||
int> = 0>
|
||||
static void execute(Class &cl, const Extra &...extra) {
|
||||
cl.def(
|
||||
"__init__",
|
||||
@@ -325,11 +324,10 @@ struct constructor {
|
||||
extra...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && !std::is_constructible<Cpp<Class>, Args...>::value, int>
|
||||
= 0>
|
||||
template <typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && !std::is_constructible<Cpp<Class>, Args...>::value,
|
||||
int> = 0>
|
||||
static void execute(Class &cl, const Extra &...extra) {
|
||||
cl.def(
|
||||
"__init__",
|
||||
@@ -345,11 +343,10 @@ struct constructor {
|
||||
// Implementing class for py::init_alias<...>()
|
||||
template <typename... Args>
|
||||
struct alias_constructor {
|
||||
template <
|
||||
typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value, int>
|
||||
= 0>
|
||||
template <typename Class,
|
||||
typename... Extra,
|
||||
enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value,
|
||||
int> = 0>
|
||||
static void execute(Class &cl, const Extra &...extra) {
|
||||
cl.def(
|
||||
"__init__",
|
||||
|
||||
@@ -59,15 +59,13 @@ using ExceptionTranslator = void (*)(std::exception_ptr);
|
||||
# define PYBIND11_TLS_KEY_INIT(var) \
|
||||
_Pragma("clang diagnostic push") /**/ \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
|
||||
Py_tss_t var \
|
||||
= Py_tss_NEEDS_INIT; \
|
||||
Py_tss_t var = Py_tss_NEEDS_INIT; \
|
||||
_Pragma("clang diagnostic pop")
|
||||
#elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
# define PYBIND11_TLS_KEY_INIT(var) \
|
||||
_Pragma("GCC diagnostic push") /**/ \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
|
||||
Py_tss_t var \
|
||||
= Py_tss_NEEDS_INIT; \
|
||||
Py_tss_t var = Py_tss_NEEDS_INIT; \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
# define PYBIND11_TLS_KEY_INIT(var) Py_tss_t var = Py_tss_NEEDS_INIT;
|
||||
|
||||
@@ -259,8 +259,7 @@ public:
|
||||
detail::enable_if_t<detail::all_of<detail::none_of<std::is_base_of<handle, T>,
|
||||
detail::is_pyobj_ptr_or_nullptr_t<T>>,
|
||||
std::is_convertible<T, PyObject *>>::value,
|
||||
int>
|
||||
= 0>
|
||||
int> = 0>
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
handle(T &obj) : m_ptr(obj) {}
|
||||
|
||||
@@ -1694,8 +1693,7 @@ public:
|
||||
template <typename T,
|
||||
detail::enable_if_t<!std::is_base_of<object, detail::remove_cvref_t<T>>::value
|
||||
&& std::is_constructible<handle, T>::value,
|
||||
int>
|
||||
= 0>
|
||||
int> = 0>
|
||||
explicit str(T &&h) : object(raw_str(handle(std::forward<T>(h)).ptr()), stolen_t{}) {
|
||||
if (!m_ptr) {
|
||||
throw error_already_set();
|
||||
|
||||
@@ -1086,8 +1086,7 @@ TEST_SUBMODULE(pytypes, m) {
|
||||
static_class.def(py::init());
|
||||
static_class.attr_with_type_hint<py::typing::ClassVar<float>>("x") = 1.0;
|
||||
static_class.attr_with_type_hint<py::typing::ClassVar<py::typing::Dict<py::str, int>>>(
|
||||
"dict_str_int")
|
||||
= py::dict();
|
||||
"dict_str_int") = py::dict();
|
||||
|
||||
struct Instance {};
|
||||
auto instance = py::class_<Instance>(m, "Instance", py::dynamic_attr());
|
||||
|
||||
@@ -173,8 +173,7 @@ struct AdderBase {
|
||||
using DataVisitor = std::function<void(const Data &)>;
|
||||
|
||||
virtual void
|
||||
operator()(const Data &first, const Data &second, const DataVisitor &visitor) const
|
||||
= 0;
|
||||
operator()(const Data &first, const Data &second, const DataVisitor &visitor) const = 0;
|
||||
virtual ~AdderBase() = default;
|
||||
AdderBase() = default;
|
||||
AdderBase(const AdderBase &) = delete;
|
||||
|
||||
Reference in New Issue
Block a user