@@ -64,6 +64,11 @@ struct declare_component_types {
6464 .def (" __contains__" , &Component::contains,
6565 " vertex" _a,
6666 nb::call_guard<nb::gil_scoped_release>())
67+ .def (" __copy__" , [](const Component& self) {
68+ return Component (self);
69+ }).def (" __deepcopy__" , [](const Component& self, nb::dict) {
70+ return Component (self);
71+ }, " memo" _a)
6772 .def (" __repr__" , [](const Component& c) {
6873 return fmt::format (" {}" , c);
6974 }).def_static (" vertex_type" , []() {
@@ -84,6 +89,11 @@ struct declare_component_types {
8489 python_type_str<ComponentSize>().c_str ())
8590 .def (" size" , &ComponentSize::size,
8691 nb::call_guard<nb::gil_scoped_release>())
92+ .def (" __copy__" , [](const ComponentSize& self) {
93+ return ComponentSize (self);
94+ }).def (" __deepcopy__" , [](const ComponentSize& self, nb::dict) {
95+ return ComponentSize (self);
96+ }, " memo" _a)
8797 .def (" __repr__" , [](const ComponentSize& c) {
8898 return fmt::format (" {}" , c);
8999 }).def_static (" vertex_type" , []() {
@@ -102,6 +112,11 @@ struct declare_component_types {
102112 .def (" size_estimate" ,
103113 &ComponentSizeEstimate::size_estimate,
104114 nb::call_guard<nb::gil_scoped_release>())
115+ .def (" __copy__" , [](const ComponentSizeEstimate& self) {
116+ return ComponentSizeEstimate (self);
117+ }).def (" __deepcopy__" , [](const ComponentSizeEstimate& self, nb::dict) {
118+ return ComponentSizeEstimate (self);
119+ }, " memo" _a)
105120 .def (" __repr__" , [](const ComponentSizeEstimate& c) {
106121 return fmt::format (" {}" , c);
107122 })
0 commit comments