Skip to content

Commit

Permalink
python: SeqId made hashable
Browse files Browse the repository at this point in the history
  • Loading branch information
keitaroyam authored May 24, 2024
1 parent f289649 commit 1658ac3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ void add_meta(py::module& m) {
throw std::runtime_error("invalid tuple size");
return SeqId(t[0].cast<int>(), t[1].cast<char>());
}
));
))
.def("__hash__", [](const SeqId& self) {
return py::hash(py::make_tuple(self.num, self.icode));
});

py::class_<ResidueId>(m, "ResidueId")
.def(py::init<>())
Expand Down

0 comments on commit 1658ac3

Please sign in to comment.