Skip to content

Commit

Permalink
bind_map and bind_vector: add sig to __eq__ and __ne__ (#723)
Browse files Browse the repository at this point in the history
Use the sig attribute to avoid mypy [override] error.
  • Loading branch information
wojdyr authored Sep 18, 2024
1 parent 14878e4 commit 90844bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/nanobind/stl/bind_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ class_<Map> bind_map(handle scope, const char *name, Args &&...args) {
}

if constexpr (detail::is_equality_comparable_v<Map>) {
cl.def(self == self)
.def(self != self);
cl.def(self == self, sig("def __eq__(self, arg: object, /) -> bool"))
.def(self != self, sig("def __ne__(self, arg: object, /) -> bool"));
}

// Item, value, and key views
Expand Down
4 changes: 2 additions & 2 deletions include/nanobind/stl/bind_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ class_<Vector> bind_vector(handle scope, const char *name, Args &&...args) {
}

if constexpr (detail::is_equality_comparable_v<Value>) {
cl.def(self == self)
.def(self != self)
cl.def(self == self, sig("def __eq__(self, arg: object, /) -> bool"))
.def(self != self, sig("def __ne__(self, arg: object, /) -> bool"))

.def("__contains__",
[](const Vector &v, const Value &x) {
Expand Down

0 comments on commit 90844bd

Please sign in to comment.