1use crate::{
2 graphrecord::traits::DeepInto,
3 prelude::{PyAttributes, PyGraphRecord, PyGroup, PyNodeIndex, PySchema},
4};
5use graphrecords_core::{
6 errors::{GraphRecordError, GraphRecordResult},
7 graphrecord::{
8 EdgeDataFrameInput, EdgeIndex, GraphRecord, NodeDataFrameInput,
9 plugins::{
10 Plugin, PostAddEdgeContext, PostAddEdgeToGroupContext, PostAddEdgeToGroupsContext,
11 PostAddEdgeWithGroupContext, PostAddEdgeWithGroupsContext, PostAddEdgesContext,
12 PostAddEdgesDataframesContext, PostAddEdgesDataframesWithGroupContext,
13 PostAddEdgesDataframesWithGroupsContext, PostAddEdgesToGroupsContext,
14 PostAddEdgesWithGroupContext, PostAddEdgesWithGroupsContext, PostAddGroupContext,
15 PostAddNodeContext, PostAddNodeToGroupContext, PostAddNodeToGroupsContext,
16 PostAddNodeWithGroupContext, PostAddNodeWithGroupsContext, PostAddNodesContext,
17 PostAddNodesDataframesContext, PostAddNodesDataframesWithGroupContext,
18 PostAddNodesDataframesWithGroupsContext, PostAddNodesToGroupsContext,
19 PostAddNodesWithGroupContext, PostAddNodesWithGroupsContext, PostRemoveEdgeContext,
20 PostRemoveEdgeFromGroupContext, PostRemoveEdgeFromGroupsContext,
21 PostRemoveEdgesFromGroupsContext, PostRemoveGroupContext, PostRemoveNodeContext,
22 PostRemoveNodeFromGroupContext, PostRemoveNodeFromGroupsContext,
23 PostRemoveNodesFromGroupsContext, PreAddEdgeContext, PreAddEdgeToGroupContext,
24 PreAddEdgeToGroupsContext, PreAddEdgeWithGroupContext, PreAddEdgeWithGroupsContext,
25 PreAddEdgesContext, PreAddEdgesDataframesContext,
26 PreAddEdgesDataframesWithGroupContext, PreAddEdgesDataframesWithGroupsContext,
27 PreAddEdgesToGroupsContext, PreAddEdgesWithGroupContext, PreAddEdgesWithGroupsContext,
28 PreAddGroupContext, PreAddNodeContext, PreAddNodeToGroupContext,
29 PreAddNodeToGroupsContext, PreAddNodeWithGroupContext, PreAddNodeWithGroupsContext,
30 PreAddNodesContext, PreAddNodesDataframesContext,
31 PreAddNodesDataframesWithGroupContext, PreAddNodesDataframesWithGroupsContext,
32 PreAddNodesToGroupsContext, PreAddNodesWithGroupContext, PreAddNodesWithGroupsContext,
33 PreRemoveEdgeContext, PreRemoveEdgeFromGroupContext, PreRemoveEdgeFromGroupsContext,
34 PreRemoveEdgesFromGroupsContext, PreRemoveGroupContext, PreRemoveNodeContext,
35 PreRemoveNodeFromGroupContext, PreRemoveNodeFromGroupsContext,
36 PreRemoveNodesFromGroupsContext, PreSetSchemaContext,
37 },
38 },
39};
40use pyo3::{IntoPyObjectExt, Py, PyAny, Python, pyclass, pymethods, types::PyAnyMethods};
41use pyo3_polars::PyDataFrame;
42use serde::{Deserialize, Deserializer, Serialize, Serializer};
43
44macro_rules! impl_pre_hook {
45 ($method:ident, $py_context_type:ident, $core_context_type:ident) => {
46 fn $method(
47 &self,
48 graphrecord: &mut GraphRecord,
49 context: $core_context_type,
50 ) -> GraphRecordResult<$core_context_type> {
51 Python::attach(|py| {
52 PyGraphRecord::scope_mut(py, graphrecord, |py, graphrecord| {
53 let py_context = $py_context_type::bind(py, context);
54
55 let result = self
56 .0
57 .call_method1(py, stringify!($method), (graphrecord, py_context))
58 .map_err(|err| GraphRecordError::ConversionError(format!("{}", err)))?;
59
60 Ok(result
61 .extract::<$py_context_type>(py)
62 .map_err(|err| GraphRecordError::ConversionError(format!("{}", err)))?
63 .extract(py))
64 })
65 })
66 }
67 };
68}
69
70macro_rules! impl_post_hook {
71 ($method:ident) => {
72 fn $method(&self, graphrecord: &mut GraphRecord) -> GraphRecordResult<()> {
73 Python::attach(|py| {
74 PyGraphRecord::scope_mut(py, graphrecord, |py, graphrecord| {
75 self.0
76 .call_method1(py, stringify!($method), (graphrecord,))
77 .map_err(|err| GraphRecordError::ConversionError(format!("{}", err)))?;
78
79 Ok(())
80 })
81 })
82 }
83 };
84 ($method:ident, $py_context_type:ident, $core_context_type:ident) => {
85 fn $method(
86 &self,
87 graphrecord: &mut GraphRecord,
88 context: $core_context_type,
89 ) -> GraphRecordResult<()> {
90 Python::attach(|py| {
91 PyGraphRecord::scope_mut(py, graphrecord, |py, graphrecord| {
92 let py_context = $py_context_type::bind(py, context);
93
94 self.0
95 .call_method1(py, stringify!($method), (graphrecord, py_context))
96 .map_err(|err| GraphRecordError::ConversionError(format!("{}", err)))?;
97
98 Ok(())
99 })
100 })
101 }
102 };
103}
104
105#[derive(Debug)]
106pub struct PyPlugin(Py<PyAny>);
107
108impl Serialize for PyPlugin {
109 fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
110 Python::attach(|py| {
111 let cloudpickle = py
112 .import("cloudpickle")
113 .map_err(serde::ser::Error::custom)?;
114
115 let bytes: Vec<u8> = cloudpickle
116 .call_method1("dumps", (&self.0,))
117 .map_err(serde::ser::Error::custom)?
118 .extract()
119 .map_err(serde::ser::Error::custom)?;
120
121 serializer.serialize_bytes(&bytes)
122 })
123 }
124}
125
126impl<'de> Deserialize<'de> for PyPlugin {
127 fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
128 let bytes: Vec<u8> = Deserialize::deserialize(deserializer)?;
129
130 Python::attach(|py| {
131 let cloudpickle = py.import("cloudpickle").map_err(serde::de::Error::custom)?;
132
133 let obj: Py<PyAny> = cloudpickle
134 .call_method1("loads", (bytes.as_slice(),))
135 .map_err(serde::de::Error::custom)?
136 .into();
137
138 Ok(Self(obj))
139 })
140 }
141}
142
143impl PyPlugin {
144 pub const fn new(py_obj: Py<PyAny>) -> Self {
145 Self(py_obj)
146 }
147}
148
149fn node_dataframe_inputs_to_py(inputs: Vec<NodeDataFrameInput>) -> Vec<(PyDataFrame, String)> {
150 inputs
151 .into_iter()
152 .map(|input| (PyDataFrame(input.dataframe), input.index_column))
153 .collect()
154}
155
156fn py_to_node_dataframe_inputs(inputs: Vec<(PyDataFrame, String)>) -> Vec<NodeDataFrameInput> {
157 inputs
158 .into_iter()
159 .map(|(dataframe, index_column)| NodeDataFrameInput {
160 dataframe: dataframe.0,
161 index_column,
162 })
163 .collect()
164}
165
166fn edge_dataframe_inputs_to_py(
167 inputs: Vec<EdgeDataFrameInput>,
168) -> Vec<(PyDataFrame, String, String)> {
169 inputs
170 .into_iter()
171 .map(|input| {
172 (
173 PyDataFrame(input.dataframe),
174 input.source_index_column,
175 input.target_index_column,
176 )
177 })
178 .collect()
179}
180
181fn py_to_edge_dataframe_inputs(
182 inputs: Vec<(PyDataFrame, String, String)>,
183) -> Vec<EdgeDataFrameInput> {
184 inputs
185 .into_iter()
186 .map(
187 |(dataframe, source_index_column, target_index_column)| EdgeDataFrameInput {
188 dataframe: dataframe.0,
189 source_index_column,
190 target_index_column,
191 },
192 )
193 .collect()
194}
195
196#[pyclass(frozen)]
197#[derive(Debug)]
198pub struct PyPreSetSchemaContext {
199 schema: Py<PySchema>,
200}
201
202impl Clone for PyPreSetSchemaContext {
203 fn clone(&self) -> Self {
204 Python::attach(|py| Self {
205 schema: self.schema.clone_ref(py),
206 })
207 }
208}
209
210impl PyPreSetSchemaContext {
211 pub fn bind(py: Python<'_>, context: PreSetSchemaContext) -> Self {
215 Self {
216 schema: Py::new(py, PySchema::from(context.schema))
217 .expect("PySchema should be creatable"),
218 }
219 }
220
221 pub fn extract(self, py: Python<'_>) -> PreSetSchemaContext {
225 let py_schema: PySchema = self
226 .schema
227 .extract(py)
228 .expect("PySchema should be extractable");
229
230 PreSetSchemaContext {
231 schema: py_schema.into(),
232 }
233 }
234}
235
236#[pymethods]
237impl PyPreSetSchemaContext {
238 #[new]
239 pub const fn new(schema: Py<PySchema>) -> Self {
240 Self { schema }
241 }
242
243 #[getter]
244 pub fn schema(&self, py: Python<'_>) -> Py<PySchema> {
245 self.schema.clone_ref(py)
246 }
247}
248
249#[pyclass(frozen)]
250#[derive(Debug)]
251pub struct PyPreAddNodeContext {
252 node_index: Py<PyAny>,
253 attributes: Py<PyAny>,
254}
255
256impl Clone for PyPreAddNodeContext {
257 fn clone(&self) -> Self {
258 Python::attach(|py| Self {
259 node_index: self.node_index.clone_ref(py),
260 attributes: self.attributes.clone_ref(py),
261 })
262 }
263}
264
265impl PyPreAddNodeContext {
266 pub fn bind(py: Python<'_>, context: PreAddNodeContext) -> Self {
270 Self {
271 node_index: PyNodeIndex::from(context.node_index)
272 .into_py_any(py)
273 .expect("PyNodeIndex should be creatable"),
274 attributes: {
275 let py_attrs: PyAttributes = context.attributes.deep_into();
276 py_attrs
277 .into_py_any(py)
278 .expect("PyAttributes should be creatable")
279 },
280 }
281 }
282
283 pub fn extract(self, py: Python<'_>) -> PreAddNodeContext {
287 let node_index: PyNodeIndex = self
288 .node_index
289 .extract(py)
290 .expect("PyNodeIndex should be extractable");
291
292 let attributes: PyAttributes = self
293 .attributes
294 .extract(py)
295 .expect("PyAttributes should be extractable");
296
297 PreAddNodeContext {
298 node_index: node_index.into(),
299 attributes: attributes.deep_into(),
300 }
301 }
302}
303
304#[pymethods]
305impl PyPreAddNodeContext {
306 #[new]
307 pub const fn new(node_index: Py<PyAny>, attributes: Py<PyAny>) -> Self {
308 Self {
309 node_index,
310 attributes,
311 }
312 }
313
314 #[getter]
315 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
316 self.node_index.clone_ref(py)
317 }
318
319 #[getter]
320 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
321 self.attributes.clone_ref(py)
322 }
323}
324
325#[pyclass(frozen)]
326#[derive(Debug)]
327pub struct PyPostAddNodeContext {
328 node_index: Py<PyAny>,
329}
330
331impl Clone for PyPostAddNodeContext {
332 fn clone(&self) -> Self {
333 Python::attach(|py| Self {
334 node_index: self.node_index.clone_ref(py),
335 })
336 }
337}
338
339impl PyPostAddNodeContext {
340 pub fn bind(py: Python<'_>, context: PostAddNodeContext) -> Self {
344 Self {
345 node_index: PyNodeIndex::from(context.node_index)
346 .into_py_any(py)
347 .expect("PyNodeIndex should be creatable"),
348 }
349 }
350}
351
352#[pymethods]
353impl PyPostAddNodeContext {
354 #[new]
355 pub const fn new(node_index: Py<PyAny>) -> Self {
356 Self { node_index }
357 }
358
359 #[getter]
360 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
361 self.node_index.clone_ref(py)
362 }
363}
364
365#[pyclass(frozen)]
366#[derive(Debug)]
367pub struct PyPreAddNodeWithGroupContext {
368 node_index: Py<PyAny>,
369 attributes: Py<PyAny>,
370 group: Py<PyAny>,
371}
372
373impl Clone for PyPreAddNodeWithGroupContext {
374 fn clone(&self) -> Self {
375 Python::attach(|py| Self {
376 node_index: self.node_index.clone_ref(py),
377 attributes: self.attributes.clone_ref(py),
378 group: self.group.clone_ref(py),
379 })
380 }
381}
382
383impl PyPreAddNodeWithGroupContext {
384 pub fn bind(py: Python<'_>, context: PreAddNodeWithGroupContext) -> Self {
388 Self {
389 node_index: PyNodeIndex::from(context.node_index)
390 .into_py_any(py)
391 .expect("PyNodeIndex should be creatable"),
392 attributes: {
393 let py_attrs: PyAttributes = context.attributes.deep_into();
394 py_attrs
395 .into_py_any(py)
396 .expect("PyAttributes should be creatable")
397 },
398 group: PyGroup::from(context.group)
399 .into_py_any(py)
400 .expect("PyGroup should be creatable"),
401 }
402 }
403
404 pub fn extract(self, py: Python<'_>) -> PreAddNodeWithGroupContext {
408 let node_index: PyNodeIndex = self
409 .node_index
410 .extract(py)
411 .expect("PyNodeIndex should be extractable");
412
413 let attributes: PyAttributes = self
414 .attributes
415 .extract(py)
416 .expect("PyAttributes should be extractable");
417
418 let group: PyGroup = self
419 .group
420 .extract(py)
421 .expect("PyGroup should be extractable");
422
423 PreAddNodeWithGroupContext {
424 node_index: node_index.into(),
425 attributes: attributes.deep_into(),
426 group: group.into(),
427 }
428 }
429}
430
431#[pymethods]
432impl PyPreAddNodeWithGroupContext {
433 #[new]
434 pub const fn new(node_index: Py<PyAny>, attributes: Py<PyAny>, group: Py<PyAny>) -> Self {
435 Self {
436 node_index,
437 attributes,
438 group,
439 }
440 }
441
442 #[getter]
443 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
444 self.node_index.clone_ref(py)
445 }
446
447 #[getter]
448 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
449 self.attributes.clone_ref(py)
450 }
451
452 #[getter]
453 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
454 self.group.clone_ref(py)
455 }
456}
457
458#[pyclass(frozen)]
459#[derive(Debug)]
460pub struct PyPostAddNodeWithGroupContext {
461 node_index: Py<PyAny>,
462 group: Py<PyAny>,
463}
464
465impl Clone for PyPostAddNodeWithGroupContext {
466 fn clone(&self) -> Self {
467 Python::attach(|py| Self {
468 node_index: self.node_index.clone_ref(py),
469 group: self.group.clone_ref(py),
470 })
471 }
472}
473
474impl PyPostAddNodeWithGroupContext {
475 pub fn bind(py: Python<'_>, context: PostAddNodeWithGroupContext) -> Self {
479 Self {
480 node_index: PyNodeIndex::from(context.node_index)
481 .into_py_any(py)
482 .expect("PyNodeIndex should be creatable"),
483 group: PyGroup::from(context.group)
484 .into_py_any(py)
485 .expect("PyGroup should be creatable"),
486 }
487 }
488}
489
490#[pymethods]
491impl PyPostAddNodeWithGroupContext {
492 #[new]
493 pub const fn new(node_index: Py<PyAny>, group: Py<PyAny>) -> Self {
494 Self { node_index, group }
495 }
496
497 #[getter]
498 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
499 self.node_index.clone_ref(py)
500 }
501
502 #[getter]
503 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
504 self.group.clone_ref(py)
505 }
506}
507
508#[pyclass(frozen)]
509#[derive(Debug)]
510pub struct PyPreAddNodeWithGroupsContext {
511 node_index: Py<PyAny>,
512 attributes: Py<PyAny>,
513 groups: Py<PyAny>,
514}
515
516impl Clone for PyPreAddNodeWithGroupsContext {
517 fn clone(&self) -> Self {
518 Python::attach(|py| Self {
519 node_index: self.node_index.clone_ref(py),
520 attributes: self.attributes.clone_ref(py),
521 groups: self.groups.clone_ref(py),
522 })
523 }
524}
525
526impl PyPreAddNodeWithGroupsContext {
527 pub fn bind(py: Python<'_>, context: PreAddNodeWithGroupsContext) -> Self {
531 let groups: Vec<PyGroup> = context.groups.deep_into();
532
533 Self {
534 node_index: PyNodeIndex::from(context.node_index)
535 .into_py_any(py)
536 .expect("PyNodeIndex should be creatable"),
537 attributes: {
538 let py_attrs: PyAttributes = context.attributes.deep_into();
539 py_attrs
540 .into_py_any(py)
541 .expect("PyAttributes should be creatable")
542 },
543 groups: groups.into_py_any(py).expect("groups should be creatable"),
544 }
545 }
546
547 pub fn extract(self, py: Python<'_>) -> PreAddNodeWithGroupsContext {
551 let node_index: PyNodeIndex = self
552 .node_index
553 .extract(py)
554 .expect("PyNodeIndex should be extractable");
555
556 let attributes: PyAttributes = self
557 .attributes
558 .extract(py)
559 .expect("PyAttributes should be extractable");
560
561 let groups: Vec<PyGroup> = self
562 .groups
563 .extract(py)
564 .expect("groups should be extractable");
565
566 PreAddNodeWithGroupsContext {
567 node_index: node_index.into(),
568 attributes: attributes.deep_into(),
569 groups: groups.deep_into(),
570 }
571 }
572}
573
574#[pymethods]
575impl PyPreAddNodeWithGroupsContext {
576 #[new]
577 pub const fn new(node_index: Py<PyAny>, attributes: Py<PyAny>, groups: Py<PyAny>) -> Self {
578 Self {
579 node_index,
580 attributes,
581 groups,
582 }
583 }
584
585 #[getter]
586 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
587 self.node_index.clone_ref(py)
588 }
589
590 #[getter]
591 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
592 self.attributes.clone_ref(py)
593 }
594
595 #[getter]
596 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
597 self.groups.clone_ref(py)
598 }
599}
600
601#[pyclass(frozen)]
602#[derive(Debug)]
603pub struct PyPostAddNodeWithGroupsContext {
604 node_index: Py<PyAny>,
605 groups: Py<PyAny>,
606}
607
608impl Clone for PyPostAddNodeWithGroupsContext {
609 fn clone(&self) -> Self {
610 Python::attach(|py| Self {
611 node_index: self.node_index.clone_ref(py),
612 groups: self.groups.clone_ref(py),
613 })
614 }
615}
616
617impl PyPostAddNodeWithGroupsContext {
618 pub fn bind(py: Python<'_>, context: PostAddNodeWithGroupsContext) -> Self {
622 let groups: Vec<PyGroup> = context.groups.deep_into();
623
624 Self {
625 node_index: PyNodeIndex::from(context.node_index)
626 .into_py_any(py)
627 .expect("PyNodeIndex should be creatable"),
628 groups: groups.into_py_any(py).expect("groups should be creatable"),
629 }
630 }
631}
632
633#[pymethods]
634impl PyPostAddNodeWithGroupsContext {
635 #[new]
636 pub const fn new(node_index: Py<PyAny>, groups: Py<PyAny>) -> Self {
637 Self { node_index, groups }
638 }
639
640 #[getter]
641 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
642 self.node_index.clone_ref(py)
643 }
644
645 #[getter]
646 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
647 self.groups.clone_ref(py)
648 }
649}
650
651#[pyclass(frozen)]
652#[derive(Debug)]
653pub struct PyPreRemoveNodeContext {
654 node_index: Py<PyAny>,
655}
656
657impl Clone for PyPreRemoveNodeContext {
658 fn clone(&self) -> Self {
659 Python::attach(|py| Self {
660 node_index: self.node_index.clone_ref(py),
661 })
662 }
663}
664
665impl PyPreRemoveNodeContext {
666 pub fn bind(py: Python<'_>, context: PreRemoveNodeContext) -> Self {
670 Self {
671 node_index: PyNodeIndex::from(context.node_index)
672 .into_py_any(py)
673 .expect("PyNodeIndex should be creatable"),
674 }
675 }
676
677 pub fn extract(self, py: Python<'_>) -> PreRemoveNodeContext {
681 let py_node_index: PyNodeIndex = self
682 .node_index
683 .extract(py)
684 .expect("PyNodeIndex should be extractable");
685
686 PreRemoveNodeContext {
687 node_index: py_node_index.into(),
688 }
689 }
690}
691
692#[pymethods]
693impl PyPreRemoveNodeContext {
694 #[new]
695 pub const fn new(node_index: Py<PyAny>) -> Self {
696 Self { node_index }
697 }
698
699 #[getter]
700 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
701 self.node_index.clone_ref(py)
702 }
703}
704
705#[pyclass(frozen)]
706#[derive(Debug)]
707pub struct PyPostRemoveNodeContext {
708 node_index: Py<PyAny>,
709}
710
711impl Clone for PyPostRemoveNodeContext {
712 fn clone(&self) -> Self {
713 Python::attach(|py| Self {
714 node_index: self.node_index.clone_ref(py),
715 })
716 }
717}
718
719impl PyPostRemoveNodeContext {
720 pub fn bind(py: Python<'_>, context: PostRemoveNodeContext) -> Self {
724 Self {
725 node_index: PyNodeIndex::from(context.node_index)
726 .into_py_any(py)
727 .expect("PyNodeIndex should be creatable"),
728 }
729 }
730}
731
732#[pymethods]
733impl PyPostRemoveNodeContext {
734 #[new]
735 pub const fn new(node_index: Py<PyAny>) -> Self {
736 Self { node_index }
737 }
738
739 #[getter]
740 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
741 self.node_index.clone_ref(py)
742 }
743}
744
745#[pyclass(frozen)]
746#[derive(Debug)]
747pub struct PyPreAddNodesContext {
748 nodes: Py<PyAny>,
749}
750
751impl Clone for PyPreAddNodesContext {
752 fn clone(&self) -> Self {
753 Python::attach(|py| Self {
754 nodes: self.nodes.clone_ref(py),
755 })
756 }
757}
758
759impl PyPreAddNodesContext {
760 pub fn bind(py: Python<'_>, context: PreAddNodesContext) -> Self {
764 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
765
766 Self {
767 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
768 }
769 }
770
771 pub fn extract(self, py: Python<'_>) -> PreAddNodesContext {
775 let nodes: Vec<(PyNodeIndex, PyAttributes)> =
776 self.nodes.extract(py).expect("nodes should be extractable");
777
778 PreAddNodesContext {
779 nodes: nodes.deep_into(),
780 }
781 }
782}
783
784#[pymethods]
785impl PyPreAddNodesContext {
786 #[new]
787 pub const fn new(nodes: Py<PyAny>) -> Self {
788 Self { nodes }
789 }
790
791 #[getter]
792 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
793 self.nodes.clone_ref(py)
794 }
795}
796
797#[pyclass(frozen)]
798#[derive(Debug)]
799pub struct PyPostAddNodesContext {
800 nodes: Py<PyAny>,
801}
802
803impl Clone for PyPostAddNodesContext {
804 fn clone(&self) -> Self {
805 Python::attach(|py| Self {
806 nodes: self.nodes.clone_ref(py),
807 })
808 }
809}
810
811impl PyPostAddNodesContext {
812 pub fn bind(py: Python<'_>, context: PostAddNodesContext) -> Self {
816 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
817
818 Self {
819 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
820 }
821 }
822}
823
824#[pymethods]
825impl PyPostAddNodesContext {
826 #[new]
827 pub const fn new(nodes: Py<PyAny>) -> Self {
828 Self { nodes }
829 }
830
831 #[getter]
832 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
833 self.nodes.clone_ref(py)
834 }
835}
836
837#[pyclass(frozen)]
838#[derive(Debug)]
839pub struct PyPreAddNodesWithGroupContext {
840 nodes: Py<PyAny>,
841 group: Py<PyAny>,
842}
843
844impl Clone for PyPreAddNodesWithGroupContext {
845 fn clone(&self) -> Self {
846 Python::attach(|py| Self {
847 nodes: self.nodes.clone_ref(py),
848 group: self.group.clone_ref(py),
849 })
850 }
851}
852
853impl PyPreAddNodesWithGroupContext {
854 pub fn bind(py: Python<'_>, context: PreAddNodesWithGroupContext) -> Self {
858 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
859
860 Self {
861 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
862 group: PyGroup::from(context.group)
863 .into_py_any(py)
864 .expect("PyGroup should be creatable"),
865 }
866 }
867
868 pub fn extract(self, py: Python<'_>) -> PreAddNodesWithGroupContext {
872 let nodes: Vec<(PyNodeIndex, PyAttributes)> =
873 self.nodes.extract(py).expect("nodes should be extractable");
874
875 let group: PyGroup = self
876 .group
877 .extract(py)
878 .expect("PyGroup should be extractable");
879
880 PreAddNodesWithGroupContext {
881 nodes: nodes.deep_into(),
882 group: group.into(),
883 }
884 }
885}
886
887#[pymethods]
888impl PyPreAddNodesWithGroupContext {
889 #[new]
890 pub const fn new(nodes: Py<PyAny>, group: Py<PyAny>) -> Self {
891 Self { nodes, group }
892 }
893
894 #[getter]
895 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
896 self.nodes.clone_ref(py)
897 }
898
899 #[getter]
900 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
901 self.group.clone_ref(py)
902 }
903}
904
905#[pyclass(frozen)]
906#[derive(Debug)]
907pub struct PyPostAddNodesWithGroupContext {
908 nodes: Py<PyAny>,
909 group: Py<PyAny>,
910}
911
912impl Clone for PyPostAddNodesWithGroupContext {
913 fn clone(&self) -> Self {
914 Python::attach(|py| Self {
915 nodes: self.nodes.clone_ref(py),
916 group: self.group.clone_ref(py),
917 })
918 }
919}
920
921impl PyPostAddNodesWithGroupContext {
922 pub fn bind(py: Python<'_>, context: PostAddNodesWithGroupContext) -> Self {
926 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
927
928 Self {
929 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
930 group: PyGroup::from(context.group)
931 .into_py_any(py)
932 .expect("PyGroup should be creatable"),
933 }
934 }
935}
936
937#[pymethods]
938impl PyPostAddNodesWithGroupContext {
939 #[new]
940 pub const fn new(nodes: Py<PyAny>, group: Py<PyAny>) -> Self {
941 Self { nodes, group }
942 }
943
944 #[getter]
945 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
946 self.nodes.clone_ref(py)
947 }
948
949 #[getter]
950 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
951 self.group.clone_ref(py)
952 }
953}
954
955#[pyclass(frozen)]
956#[derive(Debug)]
957pub struct PyPreAddNodesWithGroupsContext {
958 nodes: Py<PyAny>,
959 groups: Py<PyAny>,
960}
961
962impl Clone for PyPreAddNodesWithGroupsContext {
963 fn clone(&self) -> Self {
964 Python::attach(|py| Self {
965 nodes: self.nodes.clone_ref(py),
966 groups: self.groups.clone_ref(py),
967 })
968 }
969}
970
971impl PyPreAddNodesWithGroupsContext {
972 pub fn bind(py: Python<'_>, context: PreAddNodesWithGroupsContext) -> Self {
976 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
977 let groups: Vec<PyGroup> = context.groups.deep_into();
978
979 Self {
980 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
981 groups: groups.into_py_any(py).expect("groups should be creatable"),
982 }
983 }
984
985 pub fn extract(self, py: Python<'_>) -> PreAddNodesWithGroupsContext {
989 let nodes: Vec<(PyNodeIndex, PyAttributes)> =
990 self.nodes.extract(py).expect("nodes should be extractable");
991
992 let groups: Vec<PyGroup> = self
993 .groups
994 .extract(py)
995 .expect("groups should be extractable");
996
997 PreAddNodesWithGroupsContext {
998 nodes: nodes.deep_into(),
999 groups: groups.deep_into(),
1000 }
1001 }
1002}
1003
1004#[pymethods]
1005impl PyPreAddNodesWithGroupsContext {
1006 #[new]
1007 pub const fn new(nodes: Py<PyAny>, groups: Py<PyAny>) -> Self {
1008 Self { nodes, groups }
1009 }
1010
1011 #[getter]
1012 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
1013 self.nodes.clone_ref(py)
1014 }
1015
1016 #[getter]
1017 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1018 self.groups.clone_ref(py)
1019 }
1020}
1021
1022#[pyclass(frozen)]
1023#[derive(Debug)]
1024pub struct PyPostAddNodesWithGroupsContext {
1025 nodes: Py<PyAny>,
1026 groups: Py<PyAny>,
1027}
1028
1029impl Clone for PyPostAddNodesWithGroupsContext {
1030 fn clone(&self) -> Self {
1031 Python::attach(|py| Self {
1032 nodes: self.nodes.clone_ref(py),
1033 groups: self.groups.clone_ref(py),
1034 })
1035 }
1036}
1037
1038impl PyPostAddNodesWithGroupsContext {
1039 pub fn bind(py: Python<'_>, context: PostAddNodesWithGroupsContext) -> Self {
1043 let nodes: Vec<(PyNodeIndex, PyAttributes)> = context.nodes.deep_into();
1044 let groups: Vec<PyGroup> = context.groups.deep_into();
1045
1046 Self {
1047 nodes: nodes.into_py_any(py).expect("nodes should be creatable"),
1048 groups: groups.into_py_any(py).expect("groups should be creatable"),
1049 }
1050 }
1051}
1052
1053#[pymethods]
1054impl PyPostAddNodesWithGroupsContext {
1055 #[new]
1056 pub const fn new(nodes: Py<PyAny>, groups: Py<PyAny>) -> Self {
1057 Self { nodes, groups }
1058 }
1059
1060 #[getter]
1061 pub fn nodes(&self, py: Python<'_>) -> Py<PyAny> {
1062 self.nodes.clone_ref(py)
1063 }
1064
1065 #[getter]
1066 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1067 self.groups.clone_ref(py)
1068 }
1069}
1070
1071#[pyclass(frozen)]
1072#[derive(Debug)]
1073pub struct PyPreAddNodesDataframesContext {
1074 nodes_dataframes: Py<PyAny>,
1075}
1076
1077impl Clone for PyPreAddNodesDataframesContext {
1078 fn clone(&self) -> Self {
1079 Python::attach(|py| Self {
1080 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1081 })
1082 }
1083}
1084
1085impl PyPreAddNodesDataframesContext {
1086 pub fn bind(py: Python<'_>, context: PreAddNodesDataframesContext) -> Self {
1090 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1091
1092 Self {
1093 nodes_dataframes: nodes_dataframes
1094 .into_py_any(py)
1095 .expect("nodes_dataframes should be creatable"),
1096 }
1097 }
1098
1099 pub fn extract(self, py: Python<'_>) -> PreAddNodesDataframesContext {
1103 let nodes_dataframes: Vec<(PyDataFrame, String)> = self
1104 .nodes_dataframes
1105 .extract(py)
1106 .expect("nodes_dataframes should be extractable");
1107
1108 PreAddNodesDataframesContext {
1109 nodes_dataframes: py_to_node_dataframe_inputs(nodes_dataframes),
1110 }
1111 }
1112}
1113
1114#[pymethods]
1115impl PyPreAddNodesDataframesContext {
1116 #[new]
1117 pub const fn new(nodes_dataframes: Py<PyAny>) -> Self {
1118 Self { nodes_dataframes }
1119 }
1120
1121 #[getter]
1122 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1123 self.nodes_dataframes.clone_ref(py)
1124 }
1125}
1126
1127#[pyclass(frozen)]
1128#[derive(Debug)]
1129pub struct PyPostAddNodesDataframesContext {
1130 nodes_dataframes: Py<PyAny>,
1131}
1132
1133impl Clone for PyPostAddNodesDataframesContext {
1134 fn clone(&self) -> Self {
1135 Python::attach(|py| Self {
1136 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1137 })
1138 }
1139}
1140
1141impl PyPostAddNodesDataframesContext {
1142 pub fn bind(py: Python<'_>, context: PostAddNodesDataframesContext) -> Self {
1146 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1147
1148 Self {
1149 nodes_dataframes: nodes_dataframes
1150 .into_py_any(py)
1151 .expect("nodes_dataframes should be creatable"),
1152 }
1153 }
1154}
1155
1156#[pymethods]
1157impl PyPostAddNodesDataframesContext {
1158 #[new]
1159 pub const fn new(nodes_dataframes: Py<PyAny>) -> Self {
1160 Self { nodes_dataframes }
1161 }
1162
1163 #[getter]
1164 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1165 self.nodes_dataframes.clone_ref(py)
1166 }
1167}
1168
1169#[pyclass(frozen)]
1170#[derive(Debug)]
1171pub struct PyPreAddNodesDataframesWithGroupContext {
1172 nodes_dataframes: Py<PyAny>,
1173 group: Py<PyAny>,
1174}
1175
1176impl Clone for PyPreAddNodesDataframesWithGroupContext {
1177 fn clone(&self) -> Self {
1178 Python::attach(|py| Self {
1179 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1180 group: self.group.clone_ref(py),
1181 })
1182 }
1183}
1184
1185impl PyPreAddNodesDataframesWithGroupContext {
1186 pub fn bind(py: Python<'_>, context: PreAddNodesDataframesWithGroupContext) -> Self {
1190 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1191
1192 Self {
1193 nodes_dataframes: nodes_dataframes
1194 .into_py_any(py)
1195 .expect("nodes_dataframes should be creatable"),
1196 group: PyGroup::from(context.group)
1197 .into_py_any(py)
1198 .expect("PyGroup should be creatable"),
1199 }
1200 }
1201
1202 pub fn extract(self, py: Python<'_>) -> PreAddNodesDataframesWithGroupContext {
1206 let nodes_dataframes: Vec<(PyDataFrame, String)> = self
1207 .nodes_dataframes
1208 .extract(py)
1209 .expect("nodes_dataframes should be extractable");
1210
1211 let group: PyGroup = self
1212 .group
1213 .extract(py)
1214 .expect("PyGroup should be extractable");
1215
1216 PreAddNodesDataframesWithGroupContext {
1217 nodes_dataframes: py_to_node_dataframe_inputs(nodes_dataframes),
1218 group: group.into(),
1219 }
1220 }
1221}
1222
1223#[pymethods]
1224impl PyPreAddNodesDataframesWithGroupContext {
1225 #[new]
1226 pub const fn new(nodes_dataframes: Py<PyAny>, group: Py<PyAny>) -> Self {
1227 Self {
1228 nodes_dataframes,
1229 group,
1230 }
1231 }
1232
1233 #[getter]
1234 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1235 self.nodes_dataframes.clone_ref(py)
1236 }
1237
1238 #[getter]
1239 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
1240 self.group.clone_ref(py)
1241 }
1242}
1243
1244#[pyclass(frozen)]
1245#[derive(Debug)]
1246pub struct PyPostAddNodesDataframesWithGroupContext {
1247 nodes_dataframes: Py<PyAny>,
1248 group: Py<PyAny>,
1249}
1250
1251impl Clone for PyPostAddNodesDataframesWithGroupContext {
1252 fn clone(&self) -> Self {
1253 Python::attach(|py| Self {
1254 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1255 group: self.group.clone_ref(py),
1256 })
1257 }
1258}
1259
1260impl PyPostAddNodesDataframesWithGroupContext {
1261 pub fn bind(py: Python<'_>, context: PostAddNodesDataframesWithGroupContext) -> Self {
1265 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1266
1267 Self {
1268 nodes_dataframes: nodes_dataframes
1269 .into_py_any(py)
1270 .expect("nodes_dataframes should be creatable"),
1271 group: PyGroup::from(context.group)
1272 .into_py_any(py)
1273 .expect("PyGroup should be creatable"),
1274 }
1275 }
1276}
1277
1278#[pymethods]
1279impl PyPostAddNodesDataframesWithGroupContext {
1280 #[new]
1281 pub const fn new(nodes_dataframes: Py<PyAny>, group: Py<PyAny>) -> Self {
1282 Self {
1283 nodes_dataframes,
1284 group,
1285 }
1286 }
1287
1288 #[getter]
1289 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1290 self.nodes_dataframes.clone_ref(py)
1291 }
1292
1293 #[getter]
1294 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
1295 self.group.clone_ref(py)
1296 }
1297}
1298
1299#[pyclass(frozen)]
1300#[derive(Debug)]
1301pub struct PyPreAddNodesDataframesWithGroupsContext {
1302 nodes_dataframes: Py<PyAny>,
1303 groups: Py<PyAny>,
1304}
1305
1306impl Clone for PyPreAddNodesDataframesWithGroupsContext {
1307 fn clone(&self) -> Self {
1308 Python::attach(|py| Self {
1309 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1310 groups: self.groups.clone_ref(py),
1311 })
1312 }
1313}
1314
1315impl PyPreAddNodesDataframesWithGroupsContext {
1316 pub fn bind(py: Python<'_>, context: PreAddNodesDataframesWithGroupsContext) -> Self {
1320 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1321 let groups: Vec<PyGroup> = context.groups.deep_into();
1322
1323 Self {
1324 nodes_dataframes: nodes_dataframes
1325 .into_py_any(py)
1326 .expect("nodes_dataframes should be creatable"),
1327 groups: groups.into_py_any(py).expect("groups should be creatable"),
1328 }
1329 }
1330
1331 pub fn extract(self, py: Python<'_>) -> PreAddNodesDataframesWithGroupsContext {
1335 let nodes_dataframes: Vec<(PyDataFrame, String)> = self
1336 .nodes_dataframes
1337 .extract(py)
1338 .expect("nodes_dataframes should be extractable");
1339
1340 let groups: Vec<PyGroup> = self
1341 .groups
1342 .extract(py)
1343 .expect("groups should be extractable");
1344
1345 PreAddNodesDataframesWithGroupsContext {
1346 nodes_dataframes: py_to_node_dataframe_inputs(nodes_dataframes),
1347 groups: groups.deep_into(),
1348 }
1349 }
1350}
1351
1352#[pymethods]
1353impl PyPreAddNodesDataframesWithGroupsContext {
1354 #[new]
1355 pub const fn new(nodes_dataframes: Py<PyAny>, groups: Py<PyAny>) -> Self {
1356 Self {
1357 nodes_dataframes,
1358 groups,
1359 }
1360 }
1361
1362 #[getter]
1363 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1364 self.nodes_dataframes.clone_ref(py)
1365 }
1366
1367 #[getter]
1368 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1369 self.groups.clone_ref(py)
1370 }
1371}
1372
1373#[pyclass(frozen)]
1374#[derive(Debug)]
1375pub struct PyPostAddNodesDataframesWithGroupsContext {
1376 nodes_dataframes: Py<PyAny>,
1377 groups: Py<PyAny>,
1378}
1379
1380impl Clone for PyPostAddNodesDataframesWithGroupsContext {
1381 fn clone(&self) -> Self {
1382 Python::attach(|py| Self {
1383 nodes_dataframes: self.nodes_dataframes.clone_ref(py),
1384 groups: self.groups.clone_ref(py),
1385 })
1386 }
1387}
1388
1389impl PyPostAddNodesDataframesWithGroupsContext {
1390 pub fn bind(py: Python<'_>, context: PostAddNodesDataframesWithGroupsContext) -> Self {
1394 let nodes_dataframes = node_dataframe_inputs_to_py(context.nodes_dataframes);
1395 let groups: Vec<PyGroup> = context.groups.deep_into();
1396
1397 Self {
1398 nodes_dataframes: nodes_dataframes
1399 .into_py_any(py)
1400 .expect("nodes_dataframes should be creatable"),
1401 groups: groups.into_py_any(py).expect("groups should be creatable"),
1402 }
1403 }
1404}
1405
1406#[pymethods]
1407impl PyPostAddNodesDataframesWithGroupsContext {
1408 #[new]
1409 pub const fn new(nodes_dataframes: Py<PyAny>, groups: Py<PyAny>) -> Self {
1410 Self {
1411 nodes_dataframes,
1412 groups,
1413 }
1414 }
1415
1416 #[getter]
1417 pub fn nodes_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
1418 self.nodes_dataframes.clone_ref(py)
1419 }
1420
1421 #[getter]
1422 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1423 self.groups.clone_ref(py)
1424 }
1425}
1426
1427#[pyclass(frozen)]
1428#[derive(Debug)]
1429pub struct PyPreAddEdgeContext {
1430 source_node_index: Py<PyAny>,
1431 target_node_index: Py<PyAny>,
1432 attributes: Py<PyAny>,
1433}
1434
1435impl Clone for PyPreAddEdgeContext {
1436 fn clone(&self) -> Self {
1437 Python::attach(|py| Self {
1438 source_node_index: self.source_node_index.clone_ref(py),
1439 target_node_index: self.target_node_index.clone_ref(py),
1440 attributes: self.attributes.clone_ref(py),
1441 })
1442 }
1443}
1444
1445impl PyPreAddEdgeContext {
1446 pub fn bind(py: Python<'_>, context: PreAddEdgeContext) -> Self {
1450 Self {
1451 source_node_index: PyNodeIndex::from(context.source_node_index)
1452 .into_py_any(py)
1453 .expect("PyNodeIndex should be creatable"),
1454 target_node_index: PyNodeIndex::from(context.target_node_index)
1455 .into_py_any(py)
1456 .expect("PyNodeIndex should be creatable"),
1457 attributes: {
1458 let py_attrs: PyAttributes = context.attributes.deep_into();
1459 py_attrs
1460 .into_py_any(py)
1461 .expect("PyAttributes should be creatable")
1462 },
1463 }
1464 }
1465
1466 pub fn extract(self, py: Python<'_>) -> PreAddEdgeContext {
1470 let source: PyNodeIndex = self
1471 .source_node_index
1472 .extract(py)
1473 .expect("PyNodeIndex should be extractable");
1474
1475 let target: PyNodeIndex = self
1476 .target_node_index
1477 .extract(py)
1478 .expect("PyNodeIndex should be extractable");
1479
1480 let attributes: PyAttributes = self
1481 .attributes
1482 .extract(py)
1483 .expect("PyAttributes should be extractable");
1484
1485 PreAddEdgeContext {
1486 source_node_index: source.into(),
1487 target_node_index: target.into(),
1488 attributes: attributes.deep_into(),
1489 }
1490 }
1491}
1492
1493#[pymethods]
1494impl PyPreAddEdgeContext {
1495 #[new]
1496 pub const fn new(
1497 source_node_index: Py<PyAny>,
1498 target_node_index: Py<PyAny>,
1499 attributes: Py<PyAny>,
1500 ) -> Self {
1501 Self {
1502 source_node_index,
1503 target_node_index,
1504 attributes,
1505 }
1506 }
1507
1508 #[getter]
1509 pub fn source_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1510 self.source_node_index.clone_ref(py)
1511 }
1512
1513 #[getter]
1514 pub fn target_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1515 self.target_node_index.clone_ref(py)
1516 }
1517
1518 #[getter]
1519 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
1520 self.attributes.clone_ref(py)
1521 }
1522}
1523
1524#[pyclass(frozen)]
1525#[derive(Debug)]
1526pub struct PyPostAddEdgeContext {
1527 edge_index: Py<PyAny>,
1528}
1529
1530impl Clone for PyPostAddEdgeContext {
1531 fn clone(&self) -> Self {
1532 Python::attach(|py| Self {
1533 edge_index: self.edge_index.clone_ref(py),
1534 })
1535 }
1536}
1537
1538impl PyPostAddEdgeContext {
1539 pub fn bind(py: Python<'_>, context: PostAddEdgeContext) -> Self {
1543 Self {
1544 edge_index: context
1545 .edge_index
1546 .into_py_any(py)
1547 .expect("edge_index should be creatable"),
1548 }
1549 }
1550
1551 pub fn extract(self, py: Python<'_>) -> PostAddEdgeContext {
1555 PostAddEdgeContext {
1556 edge_index: self
1557 .edge_index
1558 .extract(py)
1559 .expect("edge_index should be extractable"),
1560 }
1561 }
1562}
1563
1564#[pymethods]
1565impl PyPostAddEdgeContext {
1566 #[new]
1567 pub const fn new(edge_index: Py<PyAny>) -> Self {
1568 Self { edge_index }
1569 }
1570
1571 #[getter]
1572 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
1573 self.edge_index.clone_ref(py)
1574 }
1575}
1576
1577#[pyclass(frozen)]
1578#[derive(Debug)]
1579pub struct PyPreAddEdgeWithGroupContext {
1580 source_node_index: Py<PyAny>,
1581 target_node_index: Py<PyAny>,
1582 attributes: Py<PyAny>,
1583 group: Py<PyAny>,
1584}
1585
1586impl Clone for PyPreAddEdgeWithGroupContext {
1587 fn clone(&self) -> Self {
1588 Python::attach(|py| Self {
1589 source_node_index: self.source_node_index.clone_ref(py),
1590 target_node_index: self.target_node_index.clone_ref(py),
1591 attributes: self.attributes.clone_ref(py),
1592 group: self.group.clone_ref(py),
1593 })
1594 }
1595}
1596
1597impl PyPreAddEdgeWithGroupContext {
1598 pub fn bind(py: Python<'_>, context: PreAddEdgeWithGroupContext) -> Self {
1602 Self {
1603 source_node_index: PyNodeIndex::from(context.source_node_index)
1604 .into_py_any(py)
1605 .expect("PyNodeIndex should be creatable"),
1606 target_node_index: PyNodeIndex::from(context.target_node_index)
1607 .into_py_any(py)
1608 .expect("PyNodeIndex should be creatable"),
1609 attributes: {
1610 let py_attrs: PyAttributes = context.attributes.deep_into();
1611 py_attrs
1612 .into_py_any(py)
1613 .expect("PyAttributes should be creatable")
1614 },
1615 group: PyGroup::from(context.group)
1616 .into_py_any(py)
1617 .expect("PyGroup should be creatable"),
1618 }
1619 }
1620
1621 pub fn extract(self, py: Python<'_>) -> PreAddEdgeWithGroupContext {
1625 let source: PyNodeIndex = self
1626 .source_node_index
1627 .extract(py)
1628 .expect("PyNodeIndex should be extractable");
1629
1630 let target: PyNodeIndex = self
1631 .target_node_index
1632 .extract(py)
1633 .expect("PyNodeIndex should be extractable");
1634
1635 let attributes: PyAttributes = self
1636 .attributes
1637 .extract(py)
1638 .expect("PyAttributes should be extractable");
1639
1640 let group: PyGroup = self
1641 .group
1642 .extract(py)
1643 .expect("PyGroup should be extractable");
1644
1645 PreAddEdgeWithGroupContext {
1646 source_node_index: source.into(),
1647 target_node_index: target.into(),
1648 attributes: attributes.deep_into(),
1649 group: group.into(),
1650 }
1651 }
1652}
1653
1654#[pymethods]
1655impl PyPreAddEdgeWithGroupContext {
1656 #[new]
1657 pub const fn new(
1658 source_node_index: Py<PyAny>,
1659 target_node_index: Py<PyAny>,
1660 attributes: Py<PyAny>,
1661 group: Py<PyAny>,
1662 ) -> Self {
1663 Self {
1664 source_node_index,
1665 target_node_index,
1666 attributes,
1667 group,
1668 }
1669 }
1670
1671 #[getter]
1672 pub fn source_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1673 self.source_node_index.clone_ref(py)
1674 }
1675
1676 #[getter]
1677 pub fn target_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1678 self.target_node_index.clone_ref(py)
1679 }
1680
1681 #[getter]
1682 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
1683 self.attributes.clone_ref(py)
1684 }
1685
1686 #[getter]
1687 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
1688 self.group.clone_ref(py)
1689 }
1690}
1691
1692#[pyclass(frozen)]
1693#[derive(Debug)]
1694pub struct PyPostAddEdgeWithGroupContext {
1695 edge_index: Py<PyAny>,
1696}
1697
1698impl Clone for PyPostAddEdgeWithGroupContext {
1699 fn clone(&self) -> Self {
1700 Python::attach(|py| Self {
1701 edge_index: self.edge_index.clone_ref(py),
1702 })
1703 }
1704}
1705
1706impl PyPostAddEdgeWithGroupContext {
1707 pub fn bind(py: Python<'_>, context: PostAddEdgeWithGroupContext) -> Self {
1711 Self {
1712 edge_index: context
1713 .edge_index
1714 .into_py_any(py)
1715 .expect("edge_index should be creatable"),
1716 }
1717 }
1718}
1719
1720#[pymethods]
1721impl PyPostAddEdgeWithGroupContext {
1722 #[new]
1723 pub const fn new(edge_index: Py<PyAny>) -> Self {
1724 Self { edge_index }
1725 }
1726
1727 #[getter]
1728 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
1729 self.edge_index.clone_ref(py)
1730 }
1731}
1732
1733#[pyclass(frozen)]
1734#[derive(Debug)]
1735pub struct PyPreAddEdgeWithGroupsContext {
1736 source_node_index: Py<PyAny>,
1737 target_node_index: Py<PyAny>,
1738 attributes: Py<PyAny>,
1739 groups: Py<PyAny>,
1740}
1741
1742impl Clone for PyPreAddEdgeWithGroupsContext {
1743 fn clone(&self) -> Self {
1744 Python::attach(|py| Self {
1745 source_node_index: self.source_node_index.clone_ref(py),
1746 target_node_index: self.target_node_index.clone_ref(py),
1747 attributes: self.attributes.clone_ref(py),
1748 groups: self.groups.clone_ref(py),
1749 })
1750 }
1751}
1752
1753impl PyPreAddEdgeWithGroupsContext {
1754 pub fn bind(py: Python<'_>, context: PreAddEdgeWithGroupsContext) -> Self {
1758 let groups: Vec<PyGroup> = context.groups.deep_into();
1759
1760 Self {
1761 source_node_index: PyNodeIndex::from(context.source_node_index)
1762 .into_py_any(py)
1763 .expect("PyNodeIndex should be creatable"),
1764 target_node_index: PyNodeIndex::from(context.target_node_index)
1765 .into_py_any(py)
1766 .expect("PyNodeIndex should be creatable"),
1767 attributes: {
1768 let py_attrs: PyAttributes = context.attributes.deep_into();
1769 py_attrs
1770 .into_py_any(py)
1771 .expect("PyAttributes should be creatable")
1772 },
1773 groups: groups.into_py_any(py).expect("groups should be creatable"),
1774 }
1775 }
1776
1777 pub fn extract(self, py: Python<'_>) -> PreAddEdgeWithGroupsContext {
1781 let source: PyNodeIndex = self
1782 .source_node_index
1783 .extract(py)
1784 .expect("PyNodeIndex should be extractable");
1785
1786 let target: PyNodeIndex = self
1787 .target_node_index
1788 .extract(py)
1789 .expect("PyNodeIndex should be extractable");
1790
1791 let attributes: PyAttributes = self
1792 .attributes
1793 .extract(py)
1794 .expect("PyAttributes should be extractable");
1795
1796 let groups: Vec<PyGroup> = self
1797 .groups
1798 .extract(py)
1799 .expect("groups should be extractable");
1800
1801 PreAddEdgeWithGroupsContext {
1802 source_node_index: source.into(),
1803 target_node_index: target.into(),
1804 attributes: attributes.deep_into(),
1805 groups: groups.deep_into(),
1806 }
1807 }
1808}
1809
1810#[pymethods]
1811impl PyPreAddEdgeWithGroupsContext {
1812 #[new]
1813 pub const fn new(
1814 source_node_index: Py<PyAny>,
1815 target_node_index: Py<PyAny>,
1816 attributes: Py<PyAny>,
1817 groups: Py<PyAny>,
1818 ) -> Self {
1819 Self {
1820 source_node_index,
1821 target_node_index,
1822 attributes,
1823 groups,
1824 }
1825 }
1826
1827 #[getter]
1828 pub fn source_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1829 self.source_node_index.clone_ref(py)
1830 }
1831
1832 #[getter]
1833 pub fn target_node_index(&self, py: Python<'_>) -> Py<PyAny> {
1834 self.target_node_index.clone_ref(py)
1835 }
1836
1837 #[getter]
1838 pub fn attributes(&self, py: Python<'_>) -> Py<PyAny> {
1839 self.attributes.clone_ref(py)
1840 }
1841
1842 #[getter]
1843 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1844 self.groups.clone_ref(py)
1845 }
1846}
1847
1848#[pyclass(frozen)]
1849#[derive(Debug)]
1850pub struct PyPostAddEdgeWithGroupsContext {
1851 edge_index: Py<PyAny>,
1852 groups: Py<PyAny>,
1853}
1854
1855impl Clone for PyPostAddEdgeWithGroupsContext {
1856 fn clone(&self) -> Self {
1857 Python::attach(|py| Self {
1858 edge_index: self.edge_index.clone_ref(py),
1859 groups: self.groups.clone_ref(py),
1860 })
1861 }
1862}
1863
1864impl PyPostAddEdgeWithGroupsContext {
1865 pub fn bind(py: Python<'_>, context: PostAddEdgeWithGroupsContext) -> Self {
1869 let groups: Vec<PyGroup> = context.groups.deep_into();
1870
1871 Self {
1872 edge_index: context
1873 .edge_index
1874 .into_py_any(py)
1875 .expect("edge_index should be creatable"),
1876 groups: groups.into_py_any(py).expect("groups should be creatable"),
1877 }
1878 }
1879}
1880
1881#[pymethods]
1882impl PyPostAddEdgeWithGroupsContext {
1883 #[new]
1884 pub const fn new(edge_index: Py<PyAny>, groups: Py<PyAny>) -> Self {
1885 Self { edge_index, groups }
1886 }
1887
1888 #[getter]
1889 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
1890 self.edge_index.clone_ref(py)
1891 }
1892
1893 #[getter]
1894 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
1895 self.groups.clone_ref(py)
1896 }
1897}
1898
1899#[pyclass(frozen)]
1900#[derive(Debug)]
1901pub struct PyPreRemoveEdgeContext {
1902 edge_index: Py<PyAny>,
1903}
1904
1905impl Clone for PyPreRemoveEdgeContext {
1906 fn clone(&self) -> Self {
1907 Python::attach(|py| Self {
1908 edge_index: self.edge_index.clone_ref(py),
1909 })
1910 }
1911}
1912
1913impl PyPreRemoveEdgeContext {
1914 pub fn bind(py: Python<'_>, context: PreRemoveEdgeContext) -> Self {
1918 Self {
1919 edge_index: context
1920 .edge_index
1921 .into_py_any(py)
1922 .expect("edge_index should be creatable"),
1923 }
1924 }
1925
1926 pub fn extract(self, py: Python<'_>) -> PreRemoveEdgeContext {
1930 PreRemoveEdgeContext {
1931 edge_index: self
1932 .edge_index
1933 .extract(py)
1934 .expect("edge_index should be extractable"),
1935 }
1936 }
1937}
1938
1939#[pymethods]
1940impl PyPreRemoveEdgeContext {
1941 #[new]
1942 pub const fn new(edge_index: Py<PyAny>) -> Self {
1943 Self { edge_index }
1944 }
1945
1946 #[getter]
1947 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
1948 self.edge_index.clone_ref(py)
1949 }
1950}
1951
1952#[pyclass(frozen)]
1953#[derive(Debug)]
1954pub struct PyPostRemoveEdgeContext {
1955 edge_index: Py<PyAny>,
1956}
1957
1958impl Clone for PyPostRemoveEdgeContext {
1959 fn clone(&self) -> Self {
1960 Python::attach(|py| Self {
1961 edge_index: self.edge_index.clone_ref(py),
1962 })
1963 }
1964}
1965
1966impl PyPostRemoveEdgeContext {
1967 pub fn bind(py: Python<'_>, context: PostRemoveEdgeContext) -> Self {
1971 Self {
1972 edge_index: context
1973 .edge_index
1974 .into_py_any(py)
1975 .expect("edge_index should be creatable"),
1976 }
1977 }
1978}
1979
1980#[pymethods]
1981impl PyPostRemoveEdgeContext {
1982 #[new]
1983 pub const fn new(edge_index: Py<PyAny>) -> Self {
1984 Self { edge_index }
1985 }
1986
1987 #[getter]
1988 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
1989 self.edge_index.clone_ref(py)
1990 }
1991}
1992
1993#[pyclass(frozen)]
1994#[derive(Debug)]
1995pub struct PyPreAddEdgesContext {
1996 edges: Py<PyAny>,
1997}
1998
1999impl Clone for PyPreAddEdgesContext {
2000 fn clone(&self) -> Self {
2001 Python::attach(|py| Self {
2002 edges: self.edges.clone_ref(py),
2003 })
2004 }
2005}
2006
2007impl PyPreAddEdgesContext {
2008 pub fn bind(py: Python<'_>, context: PreAddEdgesContext) -> Self {
2012 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> = context.edges.deep_into();
2013
2014 Self {
2015 edges: edges.into_py_any(py).expect("edges should be creatable"),
2016 }
2017 }
2018
2019 pub fn extract(self, py: Python<'_>) -> PreAddEdgesContext {
2023 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> =
2024 self.edges.extract(py).expect("edges should be extractable");
2025
2026 PreAddEdgesContext {
2027 edges: edges.deep_into(),
2028 }
2029 }
2030}
2031
2032#[pymethods]
2033impl PyPreAddEdgesContext {
2034 #[new]
2035 pub const fn new(edges: Py<PyAny>) -> Self {
2036 Self { edges }
2037 }
2038
2039 #[getter]
2040 pub fn edges(&self, py: Python<'_>) -> Py<PyAny> {
2041 self.edges.clone_ref(py)
2042 }
2043}
2044
2045#[pyclass(frozen)]
2046#[derive(Debug)]
2047pub struct PyPostAddEdgesContext {
2048 edge_indices: Py<PyAny>,
2049}
2050
2051impl Clone for PyPostAddEdgesContext {
2052 fn clone(&self) -> Self {
2053 Python::attach(|py| Self {
2054 edge_indices: self.edge_indices.clone_ref(py),
2055 })
2056 }
2057}
2058
2059impl PyPostAddEdgesContext {
2060 pub fn bind(py: Python<'_>, context: PostAddEdgesContext) -> Self {
2064 Self {
2065 edge_indices: context
2066 .edge_indices
2067 .into_py_any(py)
2068 .expect("edge_indices should be creatable"),
2069 }
2070 }
2071}
2072
2073#[pymethods]
2074impl PyPostAddEdgesContext {
2075 #[new]
2076 pub const fn new(edge_indices: Py<PyAny>) -> Self {
2077 Self { edge_indices }
2078 }
2079
2080 #[getter]
2081 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
2082 self.edge_indices.clone_ref(py)
2083 }
2084}
2085
2086#[pyclass(frozen)]
2087#[derive(Debug)]
2088pub struct PyPreAddEdgesWithGroupContext {
2089 edges: Py<PyAny>,
2090 group: Py<PyAny>,
2091}
2092
2093impl Clone for PyPreAddEdgesWithGroupContext {
2094 fn clone(&self) -> Self {
2095 Python::attach(|py| Self {
2096 edges: self.edges.clone_ref(py),
2097 group: self.group.clone_ref(py),
2098 })
2099 }
2100}
2101
2102impl PyPreAddEdgesWithGroupContext {
2103 pub fn bind(py: Python<'_>, context: PreAddEdgesWithGroupContext) -> Self {
2107 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> = context.edges.deep_into();
2108
2109 Self {
2110 edges: edges.into_py_any(py).expect("edges should be creatable"),
2111 group: PyGroup::from(context.group)
2112 .into_py_any(py)
2113 .expect("PyGroup should be creatable"),
2114 }
2115 }
2116
2117 pub fn extract(self, py: Python<'_>) -> PreAddEdgesWithGroupContext {
2121 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> =
2122 self.edges.extract(py).expect("edges should be extractable");
2123
2124 let group: PyGroup = self
2125 .group
2126 .extract(py)
2127 .expect("PyGroup should be extractable");
2128
2129 PreAddEdgesWithGroupContext {
2130 edges: edges.deep_into(),
2131 group: group.into(),
2132 }
2133 }
2134}
2135
2136#[pymethods]
2137impl PyPreAddEdgesWithGroupContext {
2138 #[new]
2139 pub const fn new(edges: Py<PyAny>, group: Py<PyAny>) -> Self {
2140 Self { edges, group }
2141 }
2142
2143 #[getter]
2144 pub fn edges(&self, py: Python<'_>) -> Py<PyAny> {
2145 self.edges.clone_ref(py)
2146 }
2147
2148 #[getter]
2149 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2150 self.group.clone_ref(py)
2151 }
2152}
2153
2154#[pyclass(frozen)]
2155#[derive(Debug)]
2156pub struct PyPostAddEdgesWithGroupContext {
2157 edge_indices: Py<PyAny>,
2158}
2159
2160impl Clone for PyPostAddEdgesWithGroupContext {
2161 fn clone(&self) -> Self {
2162 Python::attach(|py| Self {
2163 edge_indices: self.edge_indices.clone_ref(py),
2164 })
2165 }
2166}
2167
2168impl PyPostAddEdgesWithGroupContext {
2169 pub fn bind(py: Python<'_>, context: PostAddEdgesWithGroupContext) -> Self {
2173 Self {
2174 edge_indices: context
2175 .edge_indices
2176 .into_py_any(py)
2177 .expect("edge_indices should be creatable"),
2178 }
2179 }
2180}
2181
2182#[pymethods]
2183impl PyPostAddEdgesWithGroupContext {
2184 #[new]
2185 pub const fn new(edge_indices: Py<PyAny>) -> Self {
2186 Self { edge_indices }
2187 }
2188
2189 #[getter]
2190 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
2191 self.edge_indices.clone_ref(py)
2192 }
2193}
2194
2195#[pyclass(frozen)]
2196#[derive(Debug)]
2197pub struct PyPreAddEdgesWithGroupsContext {
2198 edges: Py<PyAny>,
2199 groups: Py<PyAny>,
2200}
2201
2202impl Clone for PyPreAddEdgesWithGroupsContext {
2203 fn clone(&self) -> Self {
2204 Python::attach(|py| Self {
2205 edges: self.edges.clone_ref(py),
2206 groups: self.groups.clone_ref(py),
2207 })
2208 }
2209}
2210
2211impl PyPreAddEdgesWithGroupsContext {
2212 pub fn bind(py: Python<'_>, context: PreAddEdgesWithGroupsContext) -> Self {
2216 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> = context.edges.deep_into();
2217 let groups: Vec<PyGroup> = context.groups.deep_into();
2218
2219 Self {
2220 edges: edges.into_py_any(py).expect("edges should be creatable"),
2221 groups: groups.into_py_any(py).expect("groups should be creatable"),
2222 }
2223 }
2224
2225 pub fn extract(self, py: Python<'_>) -> PreAddEdgesWithGroupsContext {
2229 let edges: Vec<(PyNodeIndex, PyNodeIndex, PyAttributes)> =
2230 self.edges.extract(py).expect("edges should be extractable");
2231
2232 let groups: Vec<PyGroup> = self
2233 .groups
2234 .extract(py)
2235 .expect("groups should be extractable");
2236
2237 PreAddEdgesWithGroupsContext {
2238 edges: edges.deep_into(),
2239 groups: groups.deep_into(),
2240 }
2241 }
2242}
2243
2244#[pymethods]
2245impl PyPreAddEdgesWithGroupsContext {
2246 #[new]
2247 pub const fn new(edges: Py<PyAny>, groups: Py<PyAny>) -> Self {
2248 Self { edges, groups }
2249 }
2250
2251 #[getter]
2252 pub fn edges(&self, py: Python<'_>) -> Py<PyAny> {
2253 self.edges.clone_ref(py)
2254 }
2255
2256 #[getter]
2257 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
2258 self.groups.clone_ref(py)
2259 }
2260}
2261
2262#[pyclass(frozen)]
2263#[derive(Debug)]
2264pub struct PyPostAddEdgesWithGroupsContext {
2265 edge_indices: Py<PyAny>,
2266 groups: Py<PyAny>,
2267}
2268
2269impl Clone for PyPostAddEdgesWithGroupsContext {
2270 fn clone(&self) -> Self {
2271 Python::attach(|py| Self {
2272 edge_indices: self.edge_indices.clone_ref(py),
2273 groups: self.groups.clone_ref(py),
2274 })
2275 }
2276}
2277
2278impl PyPostAddEdgesWithGroupsContext {
2279 pub fn bind(py: Python<'_>, context: PostAddEdgesWithGroupsContext) -> Self {
2283 let groups: Vec<PyGroup> = context.groups.deep_into();
2284
2285 Self {
2286 edge_indices: context
2287 .edge_indices
2288 .into_py_any(py)
2289 .expect("edge_indices should be creatable"),
2290 groups: groups.into_py_any(py).expect("groups should be creatable"),
2291 }
2292 }
2293}
2294
2295#[pymethods]
2296impl PyPostAddEdgesWithGroupsContext {
2297 #[new]
2298 pub const fn new(edge_indices: Py<PyAny>, groups: Py<PyAny>) -> Self {
2299 Self {
2300 edge_indices,
2301 groups,
2302 }
2303 }
2304
2305 #[getter]
2306 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
2307 self.edge_indices.clone_ref(py)
2308 }
2309
2310 #[getter]
2311 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
2312 self.groups.clone_ref(py)
2313 }
2314}
2315
2316#[pyclass(frozen)]
2317#[derive(Debug)]
2318pub struct PyPreAddEdgesDataframesContext {
2319 edges_dataframes: Py<PyAny>,
2320}
2321
2322impl Clone for PyPreAddEdgesDataframesContext {
2323 fn clone(&self) -> Self {
2324 Python::attach(|py| Self {
2325 edges_dataframes: self.edges_dataframes.clone_ref(py),
2326 })
2327 }
2328}
2329
2330impl PyPreAddEdgesDataframesContext {
2331 pub fn bind(py: Python<'_>, context: PreAddEdgesDataframesContext) -> Self {
2335 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2336
2337 Self {
2338 edges_dataframes: edges_dataframes
2339 .into_py_any(py)
2340 .expect("edges_dataframes should be creatable"),
2341 }
2342 }
2343
2344 pub fn extract(self, py: Python<'_>) -> PreAddEdgesDataframesContext {
2348 let edges_dataframes: Vec<(PyDataFrame, String, String)> = self
2349 .edges_dataframes
2350 .extract(py)
2351 .expect("edges_dataframes should be extractable");
2352
2353 PreAddEdgesDataframesContext {
2354 edges_dataframes: py_to_edge_dataframe_inputs(edges_dataframes),
2355 }
2356 }
2357}
2358
2359#[pymethods]
2360impl PyPreAddEdgesDataframesContext {
2361 #[new]
2362 pub const fn new(edges_dataframes: Py<PyAny>) -> Self {
2363 Self { edges_dataframes }
2364 }
2365
2366 #[getter]
2367 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2368 self.edges_dataframes.clone_ref(py)
2369 }
2370}
2371
2372#[pyclass(frozen)]
2373#[derive(Debug)]
2374pub struct PyPostAddEdgesDataframesContext {
2375 edges_dataframes: Py<PyAny>,
2376}
2377
2378impl Clone for PyPostAddEdgesDataframesContext {
2379 fn clone(&self) -> Self {
2380 Python::attach(|py| Self {
2381 edges_dataframes: self.edges_dataframes.clone_ref(py),
2382 })
2383 }
2384}
2385
2386impl PyPostAddEdgesDataframesContext {
2387 pub fn bind(py: Python<'_>, context: PostAddEdgesDataframesContext) -> Self {
2391 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2392
2393 Self {
2394 edges_dataframes: edges_dataframes
2395 .into_py_any(py)
2396 .expect("edges_dataframes should be creatable"),
2397 }
2398 }
2399}
2400
2401#[pymethods]
2402impl PyPostAddEdgesDataframesContext {
2403 #[new]
2404 pub const fn new(edges_dataframes: Py<PyAny>) -> Self {
2405 Self { edges_dataframes }
2406 }
2407
2408 #[getter]
2409 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2410 self.edges_dataframes.clone_ref(py)
2411 }
2412}
2413
2414#[pyclass(frozen)]
2415#[derive(Debug)]
2416pub struct PyPreAddEdgesDataframesWithGroupContext {
2417 edges_dataframes: Py<PyAny>,
2418 group: Py<PyAny>,
2419}
2420
2421impl Clone for PyPreAddEdgesDataframesWithGroupContext {
2422 fn clone(&self) -> Self {
2423 Python::attach(|py| Self {
2424 edges_dataframes: self.edges_dataframes.clone_ref(py),
2425 group: self.group.clone_ref(py),
2426 })
2427 }
2428}
2429
2430impl PyPreAddEdgesDataframesWithGroupContext {
2431 pub fn bind(py: Python<'_>, context: PreAddEdgesDataframesWithGroupContext) -> Self {
2435 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2436
2437 Self {
2438 edges_dataframes: edges_dataframes
2439 .into_py_any(py)
2440 .expect("edges_dataframes should be creatable"),
2441 group: PyGroup::from(context.group)
2442 .into_py_any(py)
2443 .expect("PyGroup should be creatable"),
2444 }
2445 }
2446
2447 pub fn extract(self, py: Python<'_>) -> PreAddEdgesDataframesWithGroupContext {
2451 let edges_dataframes: Vec<(PyDataFrame, String, String)> = self
2452 .edges_dataframes
2453 .extract(py)
2454 .expect("edges_dataframes should be extractable");
2455
2456 let group: PyGroup = self
2457 .group
2458 .extract(py)
2459 .expect("PyGroup should be extractable");
2460
2461 PreAddEdgesDataframesWithGroupContext {
2462 edges_dataframes: py_to_edge_dataframe_inputs(edges_dataframes),
2463 group: group.into(),
2464 }
2465 }
2466}
2467
2468#[pymethods]
2469impl PyPreAddEdgesDataframesWithGroupContext {
2470 #[new]
2471 pub const fn new(edges_dataframes: Py<PyAny>, group: Py<PyAny>) -> Self {
2472 Self {
2473 edges_dataframes,
2474 group,
2475 }
2476 }
2477
2478 #[getter]
2479 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2480 self.edges_dataframes.clone_ref(py)
2481 }
2482
2483 #[getter]
2484 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2485 self.group.clone_ref(py)
2486 }
2487}
2488
2489#[pyclass(frozen)]
2490#[derive(Debug)]
2491pub struct PyPostAddEdgesDataframesWithGroupContext {
2492 edges_dataframes: Py<PyAny>,
2493 group: Py<PyAny>,
2494}
2495
2496impl Clone for PyPostAddEdgesDataframesWithGroupContext {
2497 fn clone(&self) -> Self {
2498 Python::attach(|py| Self {
2499 edges_dataframes: self.edges_dataframes.clone_ref(py),
2500 group: self.group.clone_ref(py),
2501 })
2502 }
2503}
2504
2505impl PyPostAddEdgesDataframesWithGroupContext {
2506 pub fn bind(py: Python<'_>, context: PostAddEdgesDataframesWithGroupContext) -> Self {
2510 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2511
2512 Self {
2513 edges_dataframes: edges_dataframes
2514 .into_py_any(py)
2515 .expect("edges_dataframes should be creatable"),
2516 group: PyGroup::from(context.group)
2517 .into_py_any(py)
2518 .expect("PyGroup should be creatable"),
2519 }
2520 }
2521}
2522
2523#[pymethods]
2524impl PyPostAddEdgesDataframesWithGroupContext {
2525 #[new]
2526 pub const fn new(edges_dataframes: Py<PyAny>, group: Py<PyAny>) -> Self {
2527 Self {
2528 edges_dataframes,
2529 group,
2530 }
2531 }
2532
2533 #[getter]
2534 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2535 self.edges_dataframes.clone_ref(py)
2536 }
2537
2538 #[getter]
2539 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2540 self.group.clone_ref(py)
2541 }
2542}
2543
2544#[pyclass(frozen)]
2545#[derive(Debug)]
2546pub struct PyPreAddEdgesDataframesWithGroupsContext {
2547 edges_dataframes: Py<PyAny>,
2548 groups: Py<PyAny>,
2549}
2550
2551impl Clone for PyPreAddEdgesDataframesWithGroupsContext {
2552 fn clone(&self) -> Self {
2553 Python::attach(|py| Self {
2554 edges_dataframes: self.edges_dataframes.clone_ref(py),
2555 groups: self.groups.clone_ref(py),
2556 })
2557 }
2558}
2559
2560impl PyPreAddEdgesDataframesWithGroupsContext {
2561 pub fn bind(py: Python<'_>, context: PreAddEdgesDataframesWithGroupsContext) -> Self {
2565 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2566 let groups: Vec<PyGroup> = context.groups.deep_into();
2567
2568 Self {
2569 edges_dataframes: edges_dataframes
2570 .into_py_any(py)
2571 .expect("edges_dataframes should be creatable"),
2572 groups: groups.into_py_any(py).expect("groups should be creatable"),
2573 }
2574 }
2575
2576 pub fn extract(self, py: Python<'_>) -> PreAddEdgesDataframesWithGroupsContext {
2580 let edges_dataframes: Vec<(PyDataFrame, String, String)> = self
2581 .edges_dataframes
2582 .extract(py)
2583 .expect("edges_dataframes should be extractable");
2584
2585 let groups: Vec<PyGroup> = self
2586 .groups
2587 .extract(py)
2588 .expect("groups should be extractable");
2589
2590 PreAddEdgesDataframesWithGroupsContext {
2591 edges_dataframes: py_to_edge_dataframe_inputs(edges_dataframes),
2592 groups: groups.deep_into(),
2593 }
2594 }
2595}
2596
2597#[pymethods]
2598impl PyPreAddEdgesDataframesWithGroupsContext {
2599 #[new]
2600 pub const fn new(edges_dataframes: Py<PyAny>, groups: Py<PyAny>) -> Self {
2601 Self {
2602 edges_dataframes,
2603 groups,
2604 }
2605 }
2606
2607 #[getter]
2608 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2609 self.edges_dataframes.clone_ref(py)
2610 }
2611
2612 #[getter]
2613 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
2614 self.groups.clone_ref(py)
2615 }
2616}
2617
2618#[pyclass(frozen)]
2619#[derive(Debug)]
2620pub struct PyPostAddEdgesDataframesWithGroupsContext {
2621 edges_dataframes: Py<PyAny>,
2622 groups: Py<PyAny>,
2623}
2624
2625impl Clone for PyPostAddEdgesDataframesWithGroupsContext {
2626 fn clone(&self) -> Self {
2627 Python::attach(|py| Self {
2628 edges_dataframes: self.edges_dataframes.clone_ref(py),
2629 groups: self.groups.clone_ref(py),
2630 })
2631 }
2632}
2633
2634impl PyPostAddEdgesDataframesWithGroupsContext {
2635 pub fn bind(py: Python<'_>, context: PostAddEdgesDataframesWithGroupsContext) -> Self {
2639 let edges_dataframes = edge_dataframe_inputs_to_py(context.edges_dataframes);
2640 let groups: Vec<PyGroup> = context.groups.deep_into();
2641
2642 Self {
2643 edges_dataframes: edges_dataframes
2644 .into_py_any(py)
2645 .expect("edges_dataframes should be creatable"),
2646 groups: groups.into_py_any(py).expect("groups should be creatable"),
2647 }
2648 }
2649}
2650
2651#[pymethods]
2652impl PyPostAddEdgesDataframesWithGroupsContext {
2653 #[new]
2654 pub const fn new(edges_dataframes: Py<PyAny>, groups: Py<PyAny>) -> Self {
2655 Self {
2656 edges_dataframes,
2657 groups,
2658 }
2659 }
2660
2661 #[getter]
2662 pub fn edges_dataframes(&self, py: Python<'_>) -> Py<PyAny> {
2663 self.edges_dataframes.clone_ref(py)
2664 }
2665
2666 #[getter]
2667 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
2668 self.groups.clone_ref(py)
2669 }
2670}
2671
2672#[pyclass(frozen)]
2673#[derive(Debug)]
2674pub struct PyPreAddGroupContext {
2675 group: Py<PyAny>,
2676 node_indices: Py<PyAny>,
2677 edge_indices: Py<PyAny>,
2678}
2679
2680impl Clone for PyPreAddGroupContext {
2681 fn clone(&self) -> Self {
2682 Python::attach(|py| Self {
2683 group: self.group.clone_ref(py),
2684 node_indices: self.node_indices.clone_ref(py),
2685 edge_indices: self.edge_indices.clone_ref(py),
2686 })
2687 }
2688}
2689
2690impl PyPreAddGroupContext {
2691 pub fn bind(py: Python<'_>, context: PreAddGroupContext) -> Self {
2695 let node_indices: Option<Vec<PyNodeIndex>> = context.node_indices.deep_into();
2696
2697 Self {
2698 group: PyGroup::from(context.group)
2699 .into_py_any(py)
2700 .expect("PyGroup should be creatable"),
2701 node_indices: node_indices
2702 .into_py_any(py)
2703 .expect("node_indices should be creatable"),
2704 edge_indices: context
2705 .edge_indices
2706 .into_py_any(py)
2707 .expect("edge_indices should be creatable"),
2708 }
2709 }
2710
2711 pub fn extract(self, py: Python<'_>) -> PreAddGroupContext {
2715 let group: PyGroup = self
2716 .group
2717 .extract(py)
2718 .expect("PyGroup should be extractable");
2719
2720 let node_indices: Option<Vec<PyNodeIndex>> = self
2721 .node_indices
2722 .extract(py)
2723 .expect("node_indices should be extractable");
2724
2725 let edge_indices: Option<Vec<EdgeIndex>> = self
2726 .edge_indices
2727 .extract(py)
2728 .expect("edge_indices should be extractable");
2729
2730 PreAddGroupContext {
2731 group: group.into(),
2732 node_indices: node_indices.deep_into(),
2733 edge_indices,
2734 }
2735 }
2736}
2737
2738#[pymethods]
2739impl PyPreAddGroupContext {
2740 #[new]
2741 pub const fn new(group: Py<PyAny>, node_indices: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
2742 Self {
2743 group,
2744 node_indices,
2745 edge_indices,
2746 }
2747 }
2748
2749 #[getter]
2750 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2751 self.group.clone_ref(py)
2752 }
2753
2754 #[getter]
2755 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
2756 self.node_indices.clone_ref(py)
2757 }
2758
2759 #[getter]
2760 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
2761 self.edge_indices.clone_ref(py)
2762 }
2763}
2764
2765#[pyclass(frozen)]
2766#[derive(Debug)]
2767pub struct PyPostAddGroupContext {
2768 group: Py<PyAny>,
2769 node_indices: Py<PyAny>,
2770 edge_indices: Py<PyAny>,
2771}
2772
2773impl Clone for PyPostAddGroupContext {
2774 fn clone(&self) -> Self {
2775 Python::attach(|py| Self {
2776 group: self.group.clone_ref(py),
2777 node_indices: self.node_indices.clone_ref(py),
2778 edge_indices: self.edge_indices.clone_ref(py),
2779 })
2780 }
2781}
2782
2783impl PyPostAddGroupContext {
2784 pub fn bind(py: Python<'_>, context: PostAddGroupContext) -> Self {
2788 let node_indices: Option<Vec<PyNodeIndex>> = context.node_indices.deep_into();
2789
2790 Self {
2791 group: PyGroup::from(context.group)
2792 .into_py_any(py)
2793 .expect("PyGroup should be creatable"),
2794 node_indices: node_indices
2795 .into_py_any(py)
2796 .expect("node_indices should be creatable"),
2797 edge_indices: context
2798 .edge_indices
2799 .into_py_any(py)
2800 .expect("edge_indices should be creatable"),
2801 }
2802 }
2803}
2804
2805#[pymethods]
2806impl PyPostAddGroupContext {
2807 #[new]
2808 pub const fn new(group: Py<PyAny>, node_indices: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
2809 Self {
2810 group,
2811 node_indices,
2812 edge_indices,
2813 }
2814 }
2815
2816 #[getter]
2817 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2818 self.group.clone_ref(py)
2819 }
2820
2821 #[getter]
2822 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
2823 self.node_indices.clone_ref(py)
2824 }
2825
2826 #[getter]
2827 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
2828 self.edge_indices.clone_ref(py)
2829 }
2830}
2831
2832#[pyclass(frozen)]
2833#[derive(Debug)]
2834pub struct PyPreRemoveGroupContext {
2835 group: Py<PyAny>,
2836}
2837
2838impl Clone for PyPreRemoveGroupContext {
2839 fn clone(&self) -> Self {
2840 Python::attach(|py| Self {
2841 group: self.group.clone_ref(py),
2842 })
2843 }
2844}
2845
2846impl PyPreRemoveGroupContext {
2847 pub fn bind(py: Python<'_>, context: PreRemoveGroupContext) -> Self {
2851 Self {
2852 group: PyGroup::from(context.group)
2853 .into_py_any(py)
2854 .expect("PyGroup should be creatable"),
2855 }
2856 }
2857
2858 pub fn extract(self, py: Python<'_>) -> PreRemoveGroupContext {
2862 let group: PyGroup = self
2863 .group
2864 .extract(py)
2865 .expect("PyGroup should be extractable");
2866
2867 PreRemoveGroupContext {
2868 group: group.into(),
2869 }
2870 }
2871}
2872
2873#[pymethods]
2874impl PyPreRemoveGroupContext {
2875 #[new]
2876 pub const fn new(group: Py<PyAny>) -> Self {
2877 Self { group }
2878 }
2879
2880 #[getter]
2881 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2882 self.group.clone_ref(py)
2883 }
2884}
2885
2886#[pyclass(frozen)]
2887#[derive(Debug)]
2888pub struct PyPostRemoveGroupContext {
2889 group: Py<PyAny>,
2890}
2891
2892impl Clone for PyPostRemoveGroupContext {
2893 fn clone(&self) -> Self {
2894 Python::attach(|py| Self {
2895 group: self.group.clone_ref(py),
2896 })
2897 }
2898}
2899
2900impl PyPostRemoveGroupContext {
2901 pub fn bind(py: Python<'_>, context: PostRemoveGroupContext) -> Self {
2905 Self {
2906 group: PyGroup::from(context.group)
2907 .into_py_any(py)
2908 .expect("PyGroup should be creatable"),
2909 }
2910 }
2911}
2912
2913#[pymethods]
2914impl PyPostRemoveGroupContext {
2915 #[new]
2916 pub const fn new(group: Py<PyAny>) -> Self {
2917 Self { group }
2918 }
2919
2920 #[getter]
2921 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2922 self.group.clone_ref(py)
2923 }
2924}
2925
2926#[pyclass(frozen)]
2927#[derive(Debug)]
2928pub struct PyPreAddNodeToGroupContext {
2929 group: Py<PyAny>,
2930 node_index: Py<PyAny>,
2931}
2932
2933impl Clone for PyPreAddNodeToGroupContext {
2934 fn clone(&self) -> Self {
2935 Python::attach(|py| Self {
2936 group: self.group.clone_ref(py),
2937 node_index: self.node_index.clone_ref(py),
2938 })
2939 }
2940}
2941
2942impl PyPreAddNodeToGroupContext {
2943 pub fn bind(py: Python<'_>, context: PreAddNodeToGroupContext) -> Self {
2947 Self {
2948 group: PyGroup::from(context.group)
2949 .into_py_any(py)
2950 .expect("PyGroup should be creatable"),
2951 node_index: PyNodeIndex::from(context.node_index)
2952 .into_py_any(py)
2953 .expect("PyNodeIndex should be creatable"),
2954 }
2955 }
2956
2957 pub fn extract(self, py: Python<'_>) -> PreAddNodeToGroupContext {
2961 let group: PyGroup = self
2962 .group
2963 .extract(py)
2964 .expect("PyGroup should be extractable");
2965
2966 let node_index: PyNodeIndex = self
2967 .node_index
2968 .extract(py)
2969 .expect("PyNodeIndex should be extractable");
2970
2971 PreAddNodeToGroupContext {
2972 group: group.into(),
2973 node_index: node_index.into(),
2974 }
2975 }
2976}
2977
2978#[pymethods]
2979impl PyPreAddNodeToGroupContext {
2980 #[new]
2981 pub const fn new(group: Py<PyAny>, node_index: Py<PyAny>) -> Self {
2982 Self { group, node_index }
2983 }
2984
2985 #[getter]
2986 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
2987 self.group.clone_ref(py)
2988 }
2989
2990 #[getter]
2991 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
2992 self.node_index.clone_ref(py)
2993 }
2994}
2995
2996#[pyclass(frozen)]
2997#[derive(Debug)]
2998pub struct PyPostAddNodeToGroupContext {
2999 group: Py<PyAny>,
3000 node_index: Py<PyAny>,
3001}
3002
3003impl Clone for PyPostAddNodeToGroupContext {
3004 fn clone(&self) -> Self {
3005 Python::attach(|py| Self {
3006 group: self.group.clone_ref(py),
3007 node_index: self.node_index.clone_ref(py),
3008 })
3009 }
3010}
3011
3012impl PyPostAddNodeToGroupContext {
3013 pub fn bind(py: Python<'_>, context: PostAddNodeToGroupContext) -> Self {
3017 Self {
3018 group: PyGroup::from(context.group)
3019 .into_py_any(py)
3020 .expect("PyGroup should be creatable"),
3021 node_index: PyNodeIndex::from(context.node_index)
3022 .into_py_any(py)
3023 .expect("PyNodeIndex should be creatable"),
3024 }
3025 }
3026}
3027
3028#[pymethods]
3029impl PyPostAddNodeToGroupContext {
3030 #[new]
3031 pub const fn new(group: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3032 Self { group, node_index }
3033 }
3034
3035 #[getter]
3036 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
3037 self.group.clone_ref(py)
3038 }
3039
3040 #[getter]
3041 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3042 self.node_index.clone_ref(py)
3043 }
3044}
3045
3046#[pyclass(frozen)]
3047#[derive(Debug)]
3048pub struct PyPreAddNodeToGroupsContext {
3049 groups: Py<PyAny>,
3050 node_index: Py<PyAny>,
3051}
3052
3053impl Clone for PyPreAddNodeToGroupsContext {
3054 fn clone(&self) -> Self {
3055 Python::attach(|py| Self {
3056 groups: self.groups.clone_ref(py),
3057 node_index: self.node_index.clone_ref(py),
3058 })
3059 }
3060}
3061
3062impl PyPreAddNodeToGroupsContext {
3063 pub fn bind(py: Python<'_>, context: PreAddNodeToGroupsContext) -> Self {
3067 let groups: Vec<PyGroup> = context.groups.deep_into();
3068
3069 Self {
3070 groups: groups.into_py_any(py).expect("groups should be creatable"),
3071 node_index: PyNodeIndex::from(context.node_index)
3072 .into_py_any(py)
3073 .expect("PyNodeIndex should be creatable"),
3074 }
3075 }
3076
3077 pub fn extract(self, py: Python<'_>) -> PreAddNodeToGroupsContext {
3081 let groups: Vec<PyGroup> = self
3082 .groups
3083 .extract(py)
3084 .expect("groups should be extractable");
3085
3086 let node_index: PyNodeIndex = self
3087 .node_index
3088 .extract(py)
3089 .expect("PyNodeIndex should be extractable");
3090
3091 PreAddNodeToGroupsContext {
3092 groups: groups.deep_into(),
3093 node_index: node_index.into(),
3094 }
3095 }
3096}
3097
3098#[pymethods]
3099impl PyPreAddNodeToGroupsContext {
3100 #[new]
3101 pub const fn new(groups: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3102 Self { groups, node_index }
3103 }
3104
3105 #[getter]
3106 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3107 self.groups.clone_ref(py)
3108 }
3109
3110 #[getter]
3111 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3112 self.node_index.clone_ref(py)
3113 }
3114}
3115
3116#[pyclass(frozen)]
3117#[derive(Debug)]
3118pub struct PyPostAddNodeToGroupsContext {
3119 groups: Py<PyAny>,
3120 node_index: Py<PyAny>,
3121}
3122
3123impl Clone for PyPostAddNodeToGroupsContext {
3124 fn clone(&self) -> Self {
3125 Python::attach(|py| Self {
3126 groups: self.groups.clone_ref(py),
3127 node_index: self.node_index.clone_ref(py),
3128 })
3129 }
3130}
3131
3132impl PyPostAddNodeToGroupsContext {
3133 pub fn bind(py: Python<'_>, context: PostAddNodeToGroupsContext) -> Self {
3137 let groups: Vec<PyGroup> = context.groups.deep_into();
3138
3139 Self {
3140 groups: groups.into_py_any(py).expect("groups should be creatable"),
3141 node_index: PyNodeIndex::from(context.node_index)
3142 .into_py_any(py)
3143 .expect("PyNodeIndex should be creatable"),
3144 }
3145 }
3146}
3147
3148#[pymethods]
3149impl PyPostAddNodeToGroupsContext {
3150 #[new]
3151 pub const fn new(groups: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3152 Self { groups, node_index }
3153 }
3154
3155 #[getter]
3156 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3157 self.groups.clone_ref(py)
3158 }
3159
3160 #[getter]
3161 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3162 self.node_index.clone_ref(py)
3163 }
3164}
3165
3166#[pyclass(frozen)]
3167#[derive(Debug)]
3168pub struct PyPreAddNodesToGroupsContext {
3169 groups: Py<PyAny>,
3170 node_indices: Py<PyAny>,
3171}
3172
3173impl Clone for PyPreAddNodesToGroupsContext {
3174 fn clone(&self) -> Self {
3175 Python::attach(|py| Self {
3176 groups: self.groups.clone_ref(py),
3177 node_indices: self.node_indices.clone_ref(py),
3178 })
3179 }
3180}
3181
3182impl PyPreAddNodesToGroupsContext {
3183 pub fn bind(py: Python<'_>, context: PreAddNodesToGroupsContext) -> Self {
3187 let groups: Vec<PyGroup> = context.groups.deep_into();
3188 let node_indices: Vec<PyNodeIndex> = context.node_indices.deep_into();
3189
3190 Self {
3191 groups: groups.into_py_any(py).expect("groups should be creatable"),
3192 node_indices: node_indices
3193 .into_py_any(py)
3194 .expect("node_indices should be creatable"),
3195 }
3196 }
3197
3198 pub fn extract(self, py: Python<'_>) -> PreAddNodesToGroupsContext {
3202 let groups: Vec<PyGroup> = self
3203 .groups
3204 .extract(py)
3205 .expect("groups should be extractable");
3206
3207 let node_indices: Vec<PyNodeIndex> = self
3208 .node_indices
3209 .extract(py)
3210 .expect("node_indices should be extractable");
3211
3212 PreAddNodesToGroupsContext {
3213 groups: groups.deep_into(),
3214 node_indices: node_indices.deep_into(),
3215 }
3216 }
3217}
3218
3219#[pymethods]
3220impl PyPreAddNodesToGroupsContext {
3221 #[new]
3222 pub const fn new(groups: Py<PyAny>, node_indices: Py<PyAny>) -> Self {
3223 Self {
3224 groups,
3225 node_indices,
3226 }
3227 }
3228
3229 #[getter]
3230 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3231 self.groups.clone_ref(py)
3232 }
3233
3234 #[getter]
3235 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
3236 self.node_indices.clone_ref(py)
3237 }
3238}
3239
3240#[pyclass(frozen)]
3241#[derive(Debug)]
3242pub struct PyPostAddNodesToGroupsContext {
3243 groups: Py<PyAny>,
3244 node_indices: Py<PyAny>,
3245}
3246
3247impl Clone for PyPostAddNodesToGroupsContext {
3248 fn clone(&self) -> Self {
3249 Python::attach(|py| Self {
3250 groups: self.groups.clone_ref(py),
3251 node_indices: self.node_indices.clone_ref(py),
3252 })
3253 }
3254}
3255
3256impl PyPostAddNodesToGroupsContext {
3257 pub fn bind(py: Python<'_>, context: PostAddNodesToGroupsContext) -> Self {
3261 let groups: Vec<PyGroup> = context.groups.deep_into();
3262 let node_indices: Vec<PyNodeIndex> = context.node_indices.deep_into();
3263
3264 Self {
3265 groups: groups.into_py_any(py).expect("groups should be creatable"),
3266 node_indices: node_indices
3267 .into_py_any(py)
3268 .expect("node_indices should be creatable"),
3269 }
3270 }
3271}
3272
3273#[pymethods]
3274impl PyPostAddNodesToGroupsContext {
3275 #[new]
3276 pub const fn new(groups: Py<PyAny>, node_indices: Py<PyAny>) -> Self {
3277 Self {
3278 groups,
3279 node_indices,
3280 }
3281 }
3282
3283 #[getter]
3284 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3285 self.groups.clone_ref(py)
3286 }
3287
3288 #[getter]
3289 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
3290 self.node_indices.clone_ref(py)
3291 }
3292}
3293
3294#[pyclass(frozen)]
3295#[derive(Debug)]
3296pub struct PyPreAddEdgeToGroupContext {
3297 group: Py<PyAny>,
3298 edge_index: Py<PyAny>,
3299}
3300
3301impl Clone for PyPreAddEdgeToGroupContext {
3302 fn clone(&self) -> Self {
3303 Python::attach(|py| Self {
3304 group: self.group.clone_ref(py),
3305 edge_index: self.edge_index.clone_ref(py),
3306 })
3307 }
3308}
3309
3310impl PyPreAddEdgeToGroupContext {
3311 pub fn bind(py: Python<'_>, context: PreAddEdgeToGroupContext) -> Self {
3315 Self {
3316 group: PyGroup::from(context.group)
3317 .into_py_any(py)
3318 .expect("PyGroup should be creatable"),
3319 edge_index: context
3320 .edge_index
3321 .into_py_any(py)
3322 .expect("edge_index should be creatable"),
3323 }
3324 }
3325
3326 pub fn extract(self, py: Python<'_>) -> PreAddEdgeToGroupContext {
3330 let group: PyGroup = self
3331 .group
3332 .extract(py)
3333 .expect("PyGroup should be extractable");
3334
3335 PreAddEdgeToGroupContext {
3336 group: group.into(),
3337 edge_index: self
3338 .edge_index
3339 .extract(py)
3340 .expect("edge_index should be extractable"),
3341 }
3342 }
3343}
3344
3345#[pymethods]
3346impl PyPreAddEdgeToGroupContext {
3347 #[new]
3348 pub const fn new(group: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
3349 Self { group, edge_index }
3350 }
3351
3352 #[getter]
3353 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
3354 self.group.clone_ref(py)
3355 }
3356
3357 #[getter]
3358 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
3359 self.edge_index.clone_ref(py)
3360 }
3361}
3362
3363#[pyclass(frozen)]
3364#[derive(Debug)]
3365pub struct PyPostAddEdgeToGroupContext {
3366 group: Py<PyAny>,
3367 edge_index: Py<PyAny>,
3368}
3369
3370impl Clone for PyPostAddEdgeToGroupContext {
3371 fn clone(&self) -> Self {
3372 Python::attach(|py| Self {
3373 group: self.group.clone_ref(py),
3374 edge_index: self.edge_index.clone_ref(py),
3375 })
3376 }
3377}
3378
3379impl PyPostAddEdgeToGroupContext {
3380 pub fn bind(py: Python<'_>, context: PostAddEdgeToGroupContext) -> Self {
3384 Self {
3385 group: PyGroup::from(context.group)
3386 .into_py_any(py)
3387 .expect("PyGroup should be creatable"),
3388 edge_index: context
3389 .edge_index
3390 .into_py_any(py)
3391 .expect("edge_index should be creatable"),
3392 }
3393 }
3394}
3395
3396#[pymethods]
3397impl PyPostAddEdgeToGroupContext {
3398 #[new]
3399 pub const fn new(group: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
3400 Self { group, edge_index }
3401 }
3402
3403 #[getter]
3404 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
3405 self.group.clone_ref(py)
3406 }
3407
3408 #[getter]
3409 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
3410 self.edge_index.clone_ref(py)
3411 }
3412}
3413
3414#[pyclass(frozen)]
3415#[derive(Debug)]
3416pub struct PyPreAddEdgeToGroupsContext {
3417 groups: Py<PyAny>,
3418 edge_index: Py<PyAny>,
3419}
3420
3421impl Clone for PyPreAddEdgeToGroupsContext {
3422 fn clone(&self) -> Self {
3423 Python::attach(|py| Self {
3424 groups: self.groups.clone_ref(py),
3425 edge_index: self.edge_index.clone_ref(py),
3426 })
3427 }
3428}
3429
3430impl PyPreAddEdgeToGroupsContext {
3431 pub fn bind(py: Python<'_>, context: PreAddEdgeToGroupsContext) -> Self {
3435 let groups: Vec<PyGroup> = context.groups.deep_into();
3436
3437 Self {
3438 groups: groups.into_py_any(py).expect("groups should be creatable"),
3439 edge_index: context
3440 .edge_index
3441 .into_py_any(py)
3442 .expect("edge_index should be creatable"),
3443 }
3444 }
3445
3446 pub fn extract(self, py: Python<'_>) -> PreAddEdgeToGroupsContext {
3450 let groups: Vec<PyGroup> = self
3451 .groups
3452 .extract(py)
3453 .expect("groups should be extractable");
3454
3455 PreAddEdgeToGroupsContext {
3456 groups: groups.deep_into(),
3457 edge_index: self
3458 .edge_index
3459 .extract(py)
3460 .expect("edge_index should be extractable"),
3461 }
3462 }
3463}
3464
3465#[pymethods]
3466impl PyPreAddEdgeToGroupsContext {
3467 #[new]
3468 pub const fn new(groups: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
3469 Self { groups, edge_index }
3470 }
3471
3472 #[getter]
3473 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3474 self.groups.clone_ref(py)
3475 }
3476
3477 #[getter]
3478 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
3479 self.edge_index.clone_ref(py)
3480 }
3481}
3482
3483#[pyclass(frozen)]
3484#[derive(Debug)]
3485pub struct PyPostAddEdgeToGroupsContext {
3486 groups: Py<PyAny>,
3487 edge_index: Py<PyAny>,
3488}
3489
3490impl Clone for PyPostAddEdgeToGroupsContext {
3491 fn clone(&self) -> Self {
3492 Python::attach(|py| Self {
3493 groups: self.groups.clone_ref(py),
3494 edge_index: self.edge_index.clone_ref(py),
3495 })
3496 }
3497}
3498
3499impl PyPostAddEdgeToGroupsContext {
3500 pub fn bind(py: Python<'_>, context: PostAddEdgeToGroupsContext) -> Self {
3504 let groups: Vec<PyGroup> = context.groups.deep_into();
3505
3506 Self {
3507 groups: groups.into_py_any(py).expect("groups should be creatable"),
3508 edge_index: context
3509 .edge_index
3510 .into_py_any(py)
3511 .expect("edge_index should be creatable"),
3512 }
3513 }
3514}
3515
3516#[pymethods]
3517impl PyPostAddEdgeToGroupsContext {
3518 #[new]
3519 pub const fn new(groups: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
3520 Self { groups, edge_index }
3521 }
3522
3523 #[getter]
3524 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3525 self.groups.clone_ref(py)
3526 }
3527
3528 #[getter]
3529 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
3530 self.edge_index.clone_ref(py)
3531 }
3532}
3533
3534#[pyclass(frozen)]
3535#[derive(Debug)]
3536pub struct PyPreAddEdgesToGroupsContext {
3537 groups: Py<PyAny>,
3538 edge_indices: Py<PyAny>,
3539}
3540
3541impl Clone for PyPreAddEdgesToGroupsContext {
3542 fn clone(&self) -> Self {
3543 Python::attach(|py| Self {
3544 groups: self.groups.clone_ref(py),
3545 edge_indices: self.edge_indices.clone_ref(py),
3546 })
3547 }
3548}
3549
3550impl PyPreAddEdgesToGroupsContext {
3551 pub fn bind(py: Python<'_>, context: PreAddEdgesToGroupsContext) -> Self {
3555 let groups: Vec<PyGroup> = context.groups.deep_into();
3556
3557 Self {
3558 groups: groups.into_py_any(py).expect("groups should be creatable"),
3559 edge_indices: context
3560 .edge_indices
3561 .into_py_any(py)
3562 .expect("edge_indices should be creatable"),
3563 }
3564 }
3565
3566 pub fn extract(self, py: Python<'_>) -> PreAddEdgesToGroupsContext {
3570 let groups: Vec<PyGroup> = self
3571 .groups
3572 .extract(py)
3573 .expect("groups should be extractable");
3574
3575 PreAddEdgesToGroupsContext {
3576 groups: groups.deep_into(),
3577 edge_indices: self
3578 .edge_indices
3579 .extract(py)
3580 .expect("edge_indices should be extractable"),
3581 }
3582 }
3583}
3584
3585#[pymethods]
3586impl PyPreAddEdgesToGroupsContext {
3587 #[new]
3588 pub const fn new(groups: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
3589 Self {
3590 groups,
3591 edge_indices,
3592 }
3593 }
3594
3595 #[getter]
3596 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3597 self.groups.clone_ref(py)
3598 }
3599
3600 #[getter]
3601 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
3602 self.edge_indices.clone_ref(py)
3603 }
3604}
3605
3606#[pyclass(frozen)]
3607#[derive(Debug)]
3608pub struct PyPostAddEdgesToGroupsContext {
3609 groups: Py<PyAny>,
3610 edge_indices: Py<PyAny>,
3611}
3612
3613impl Clone for PyPostAddEdgesToGroupsContext {
3614 fn clone(&self) -> Self {
3615 Python::attach(|py| Self {
3616 groups: self.groups.clone_ref(py),
3617 edge_indices: self.edge_indices.clone_ref(py),
3618 })
3619 }
3620}
3621
3622impl PyPostAddEdgesToGroupsContext {
3623 pub fn bind(py: Python<'_>, context: PostAddEdgesToGroupsContext) -> Self {
3627 let groups: Vec<PyGroup> = context.groups.deep_into();
3628
3629 Self {
3630 groups: groups.into_py_any(py).expect("groups should be creatable"),
3631 edge_indices: context
3632 .edge_indices
3633 .into_py_any(py)
3634 .expect("edge_indices should be creatable"),
3635 }
3636 }
3637}
3638
3639#[pymethods]
3640impl PyPostAddEdgesToGroupsContext {
3641 #[new]
3642 pub const fn new(groups: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
3643 Self {
3644 groups,
3645 edge_indices,
3646 }
3647 }
3648
3649 #[getter]
3650 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3651 self.groups.clone_ref(py)
3652 }
3653
3654 #[getter]
3655 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
3656 self.edge_indices.clone_ref(py)
3657 }
3658}
3659
3660#[pyclass(frozen)]
3661#[derive(Debug)]
3662pub struct PyPreRemoveNodeFromGroupContext {
3663 group: Py<PyAny>,
3664 node_index: Py<PyAny>,
3665}
3666
3667impl Clone for PyPreRemoveNodeFromGroupContext {
3668 fn clone(&self) -> Self {
3669 Python::attach(|py| Self {
3670 group: self.group.clone_ref(py),
3671 node_index: self.node_index.clone_ref(py),
3672 })
3673 }
3674}
3675
3676impl PyPreRemoveNodeFromGroupContext {
3677 pub fn bind(py: Python<'_>, context: PreRemoveNodeFromGroupContext) -> Self {
3681 Self {
3682 group: PyGroup::from(context.group)
3683 .into_py_any(py)
3684 .expect("PyGroup should be creatable"),
3685 node_index: PyNodeIndex::from(context.node_index)
3686 .into_py_any(py)
3687 .expect("PyNodeIndex should be creatable"),
3688 }
3689 }
3690
3691 pub fn extract(self, py: Python<'_>) -> PreRemoveNodeFromGroupContext {
3695 let group: PyGroup = self
3696 .group
3697 .extract(py)
3698 .expect("PyGroup should be extractable");
3699
3700 let node_index: PyNodeIndex = self
3701 .node_index
3702 .extract(py)
3703 .expect("PyNodeIndex should be extractable");
3704
3705 PreRemoveNodeFromGroupContext {
3706 group: group.into(),
3707 node_index: node_index.into(),
3708 }
3709 }
3710}
3711
3712#[pymethods]
3713impl PyPreRemoveNodeFromGroupContext {
3714 #[new]
3715 pub const fn new(group: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3716 Self { group, node_index }
3717 }
3718
3719 #[getter]
3720 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
3721 self.group.clone_ref(py)
3722 }
3723
3724 #[getter]
3725 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3726 self.node_index.clone_ref(py)
3727 }
3728}
3729
3730#[pyclass(frozen)]
3731#[derive(Debug)]
3732pub struct PyPostRemoveNodeFromGroupContext {
3733 group: Py<PyAny>,
3734 node_index: Py<PyAny>,
3735}
3736
3737impl Clone for PyPostRemoveNodeFromGroupContext {
3738 fn clone(&self) -> Self {
3739 Python::attach(|py| Self {
3740 group: self.group.clone_ref(py),
3741 node_index: self.node_index.clone_ref(py),
3742 })
3743 }
3744}
3745
3746impl PyPostRemoveNodeFromGroupContext {
3747 pub fn bind(py: Python<'_>, context: PostRemoveNodeFromGroupContext) -> Self {
3751 Self {
3752 group: PyGroup::from(context.group)
3753 .into_py_any(py)
3754 .expect("PyGroup should be creatable"),
3755 node_index: PyNodeIndex::from(context.node_index)
3756 .into_py_any(py)
3757 .expect("PyNodeIndex should be creatable"),
3758 }
3759 }
3760}
3761
3762#[pymethods]
3763impl PyPostRemoveNodeFromGroupContext {
3764 #[new]
3765 pub const fn new(group: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3766 Self { group, node_index }
3767 }
3768
3769 #[getter]
3770 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
3771 self.group.clone_ref(py)
3772 }
3773
3774 #[getter]
3775 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3776 self.node_index.clone_ref(py)
3777 }
3778}
3779
3780#[pyclass(frozen)]
3781#[derive(Debug)]
3782pub struct PyPreRemoveNodeFromGroupsContext {
3783 groups: Py<PyAny>,
3784 node_index: Py<PyAny>,
3785}
3786
3787impl Clone for PyPreRemoveNodeFromGroupsContext {
3788 fn clone(&self) -> Self {
3789 Python::attach(|py| Self {
3790 groups: self.groups.clone_ref(py),
3791 node_index: self.node_index.clone_ref(py),
3792 })
3793 }
3794}
3795
3796impl PyPreRemoveNodeFromGroupsContext {
3797 pub fn bind(py: Python<'_>, context: PreRemoveNodeFromGroupsContext) -> Self {
3801 let groups: Vec<PyGroup> = context.groups.deep_into();
3802
3803 Self {
3804 groups: groups.into_py_any(py).expect("groups should be creatable"),
3805 node_index: PyNodeIndex::from(context.node_index)
3806 .into_py_any(py)
3807 .expect("PyNodeIndex should be creatable"),
3808 }
3809 }
3810
3811 pub fn extract(self, py: Python<'_>) -> PreRemoveNodeFromGroupsContext {
3815 let groups: Vec<PyGroup> = self
3816 .groups
3817 .extract(py)
3818 .expect("groups should be extractable");
3819
3820 let node_index: PyNodeIndex = self
3821 .node_index
3822 .extract(py)
3823 .expect("PyNodeIndex should be extractable");
3824
3825 PreRemoveNodeFromGroupsContext {
3826 groups: groups.deep_into(),
3827 node_index: node_index.into(),
3828 }
3829 }
3830}
3831
3832#[pymethods]
3833impl PyPreRemoveNodeFromGroupsContext {
3834 #[new]
3835 pub const fn new(groups: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3836 Self { groups, node_index }
3837 }
3838
3839 #[getter]
3840 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3841 self.groups.clone_ref(py)
3842 }
3843
3844 #[getter]
3845 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3846 self.node_index.clone_ref(py)
3847 }
3848}
3849
3850#[pyclass(frozen)]
3851#[derive(Debug)]
3852pub struct PyPostRemoveNodeFromGroupsContext {
3853 groups: Py<PyAny>,
3854 node_index: Py<PyAny>,
3855}
3856
3857impl Clone for PyPostRemoveNodeFromGroupsContext {
3858 fn clone(&self) -> Self {
3859 Python::attach(|py| Self {
3860 groups: self.groups.clone_ref(py),
3861 node_index: self.node_index.clone_ref(py),
3862 })
3863 }
3864}
3865
3866impl PyPostRemoveNodeFromGroupsContext {
3867 pub fn bind(py: Python<'_>, context: PostRemoveNodeFromGroupsContext) -> Self {
3871 let groups: Vec<PyGroup> = context.groups.deep_into();
3872
3873 Self {
3874 groups: groups.into_py_any(py).expect("groups should be creatable"),
3875 node_index: PyNodeIndex::from(context.node_index)
3876 .into_py_any(py)
3877 .expect("PyNodeIndex should be creatable"),
3878 }
3879 }
3880}
3881
3882#[pymethods]
3883impl PyPostRemoveNodeFromGroupsContext {
3884 #[new]
3885 pub const fn new(groups: Py<PyAny>, node_index: Py<PyAny>) -> Self {
3886 Self { groups, node_index }
3887 }
3888
3889 #[getter]
3890 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3891 self.groups.clone_ref(py)
3892 }
3893
3894 #[getter]
3895 pub fn node_index(&self, py: Python<'_>) -> Py<PyAny> {
3896 self.node_index.clone_ref(py)
3897 }
3898}
3899
3900#[pyclass(frozen)]
3901#[derive(Debug)]
3902pub struct PyPreRemoveNodesFromGroupsContext {
3903 groups: Py<PyAny>,
3904 node_indices: Py<PyAny>,
3905}
3906
3907impl Clone for PyPreRemoveNodesFromGroupsContext {
3908 fn clone(&self) -> Self {
3909 Python::attach(|py| Self {
3910 groups: self.groups.clone_ref(py),
3911 node_indices: self.node_indices.clone_ref(py),
3912 })
3913 }
3914}
3915
3916impl PyPreRemoveNodesFromGroupsContext {
3917 pub fn bind(py: Python<'_>, context: PreRemoveNodesFromGroupsContext) -> Self {
3921 let groups: Vec<PyGroup> = context.groups.deep_into();
3922 let node_indices: Vec<PyNodeIndex> = context.node_indices.deep_into();
3923
3924 Self {
3925 groups: groups.into_py_any(py).expect("groups should be creatable"),
3926 node_indices: node_indices
3927 .into_py_any(py)
3928 .expect("node_indices should be creatable"),
3929 }
3930 }
3931
3932 pub fn extract(self, py: Python<'_>) -> PreRemoveNodesFromGroupsContext {
3936 let groups: Vec<PyGroup> = self
3937 .groups
3938 .extract(py)
3939 .expect("groups should be extractable");
3940
3941 let node_indices: Vec<PyNodeIndex> = self
3942 .node_indices
3943 .extract(py)
3944 .expect("node_indices should be extractable");
3945
3946 PreRemoveNodesFromGroupsContext {
3947 groups: groups.deep_into(),
3948 node_indices: node_indices.deep_into(),
3949 }
3950 }
3951}
3952
3953#[pymethods]
3954impl PyPreRemoveNodesFromGroupsContext {
3955 #[new]
3956 pub const fn new(groups: Py<PyAny>, node_indices: Py<PyAny>) -> Self {
3957 Self {
3958 groups,
3959 node_indices,
3960 }
3961 }
3962
3963 #[getter]
3964 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
3965 self.groups.clone_ref(py)
3966 }
3967
3968 #[getter]
3969 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
3970 self.node_indices.clone_ref(py)
3971 }
3972}
3973
3974#[pyclass(frozen)]
3975#[derive(Debug)]
3976pub struct PyPostRemoveNodesFromGroupsContext {
3977 groups: Py<PyAny>,
3978 node_indices: Py<PyAny>,
3979}
3980
3981impl Clone for PyPostRemoveNodesFromGroupsContext {
3982 fn clone(&self) -> Self {
3983 Python::attach(|py| Self {
3984 groups: self.groups.clone_ref(py),
3985 node_indices: self.node_indices.clone_ref(py),
3986 })
3987 }
3988}
3989
3990impl PyPostRemoveNodesFromGroupsContext {
3991 pub fn bind(py: Python<'_>, context: PostRemoveNodesFromGroupsContext) -> Self {
3995 let groups: Vec<PyGroup> = context.groups.deep_into();
3996 let node_indices: Vec<PyNodeIndex> = context.node_indices.deep_into();
3997
3998 Self {
3999 groups: groups.into_py_any(py).expect("groups should be creatable"),
4000 node_indices: node_indices
4001 .into_py_any(py)
4002 .expect("node_indices should be creatable"),
4003 }
4004 }
4005}
4006
4007#[pymethods]
4008impl PyPostRemoveNodesFromGroupsContext {
4009 #[new]
4010 pub const fn new(groups: Py<PyAny>, node_indices: Py<PyAny>) -> Self {
4011 Self {
4012 groups,
4013 node_indices,
4014 }
4015 }
4016
4017 #[getter]
4018 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
4019 self.groups.clone_ref(py)
4020 }
4021
4022 #[getter]
4023 pub fn node_indices(&self, py: Python<'_>) -> Py<PyAny> {
4024 self.node_indices.clone_ref(py)
4025 }
4026}
4027
4028#[pyclass(frozen)]
4029#[derive(Debug)]
4030pub struct PyPreRemoveEdgeFromGroupContext {
4031 group: Py<PyAny>,
4032 edge_index: Py<PyAny>,
4033}
4034
4035impl Clone for PyPreRemoveEdgeFromGroupContext {
4036 fn clone(&self) -> Self {
4037 Python::attach(|py| Self {
4038 group: self.group.clone_ref(py),
4039 edge_index: self.edge_index.clone_ref(py),
4040 })
4041 }
4042}
4043
4044impl PyPreRemoveEdgeFromGroupContext {
4045 pub fn bind(py: Python<'_>, context: PreRemoveEdgeFromGroupContext) -> Self {
4049 Self {
4050 group: PyGroup::from(context.group)
4051 .into_py_any(py)
4052 .expect("PyGroup should be creatable"),
4053 edge_index: context
4054 .edge_index
4055 .into_py_any(py)
4056 .expect("edge_index should be creatable"),
4057 }
4058 }
4059
4060 pub fn extract(self, py: Python<'_>) -> PreRemoveEdgeFromGroupContext {
4064 let group: PyGroup = self
4065 .group
4066 .extract(py)
4067 .expect("PyGroup should be extractable");
4068
4069 PreRemoveEdgeFromGroupContext {
4070 group: group.into(),
4071 edge_index: self
4072 .edge_index
4073 .extract(py)
4074 .expect("edge_index should be extractable"),
4075 }
4076 }
4077}
4078
4079#[pymethods]
4080impl PyPreRemoveEdgeFromGroupContext {
4081 #[new]
4082 pub const fn new(group: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
4083 Self { group, edge_index }
4084 }
4085
4086 #[getter]
4087 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
4088 self.group.clone_ref(py)
4089 }
4090
4091 #[getter]
4092 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
4093 self.edge_index.clone_ref(py)
4094 }
4095}
4096
4097#[pyclass(frozen)]
4098#[derive(Debug)]
4099pub struct PyPostRemoveEdgeFromGroupContext {
4100 group: Py<PyAny>,
4101 edge_index: Py<PyAny>,
4102}
4103
4104impl Clone for PyPostRemoveEdgeFromGroupContext {
4105 fn clone(&self) -> Self {
4106 Python::attach(|py| Self {
4107 group: self.group.clone_ref(py),
4108 edge_index: self.edge_index.clone_ref(py),
4109 })
4110 }
4111}
4112
4113impl PyPostRemoveEdgeFromGroupContext {
4114 pub fn bind(py: Python<'_>, context: PostRemoveEdgeFromGroupContext) -> Self {
4118 Self {
4119 group: PyGroup::from(context.group)
4120 .into_py_any(py)
4121 .expect("PyGroup should be creatable"),
4122 edge_index: context
4123 .edge_index
4124 .into_py_any(py)
4125 .expect("edge_index should be creatable"),
4126 }
4127 }
4128}
4129
4130#[pymethods]
4131impl PyPostRemoveEdgeFromGroupContext {
4132 #[new]
4133 pub const fn new(group: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
4134 Self { group, edge_index }
4135 }
4136
4137 #[getter]
4138 pub fn group(&self, py: Python<'_>) -> Py<PyAny> {
4139 self.group.clone_ref(py)
4140 }
4141
4142 #[getter]
4143 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
4144 self.edge_index.clone_ref(py)
4145 }
4146}
4147
4148#[pyclass(frozen)]
4149#[derive(Debug)]
4150pub struct PyPreRemoveEdgeFromGroupsContext {
4151 groups: Py<PyAny>,
4152 edge_index: Py<PyAny>,
4153}
4154
4155impl Clone for PyPreRemoveEdgeFromGroupsContext {
4156 fn clone(&self) -> Self {
4157 Python::attach(|py| Self {
4158 groups: self.groups.clone_ref(py),
4159 edge_index: self.edge_index.clone_ref(py),
4160 })
4161 }
4162}
4163
4164impl PyPreRemoveEdgeFromGroupsContext {
4165 pub fn bind(py: Python<'_>, context: PreRemoveEdgeFromGroupsContext) -> Self {
4169 let groups: Vec<PyGroup> = context.groups.deep_into();
4170
4171 Self {
4172 groups: groups.into_py_any(py).expect("groups should be creatable"),
4173 edge_index: context
4174 .edge_index
4175 .into_py_any(py)
4176 .expect("edge_index should be creatable"),
4177 }
4178 }
4179
4180 pub fn extract(self, py: Python<'_>) -> PreRemoveEdgeFromGroupsContext {
4184 let groups: Vec<PyGroup> = self
4185 .groups
4186 .extract(py)
4187 .expect("groups should be extractable");
4188
4189 PreRemoveEdgeFromGroupsContext {
4190 groups: groups.deep_into(),
4191 edge_index: self
4192 .edge_index
4193 .extract(py)
4194 .expect("edge_index should be extractable"),
4195 }
4196 }
4197}
4198
4199#[pymethods]
4200impl PyPreRemoveEdgeFromGroupsContext {
4201 #[new]
4202 pub const fn new(groups: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
4203 Self { groups, edge_index }
4204 }
4205
4206 #[getter]
4207 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
4208 self.groups.clone_ref(py)
4209 }
4210
4211 #[getter]
4212 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
4213 self.edge_index.clone_ref(py)
4214 }
4215}
4216
4217#[pyclass(frozen)]
4218#[derive(Debug)]
4219pub struct PyPostRemoveEdgeFromGroupsContext {
4220 groups: Py<PyAny>,
4221 edge_index: Py<PyAny>,
4222}
4223
4224impl Clone for PyPostRemoveEdgeFromGroupsContext {
4225 fn clone(&self) -> Self {
4226 Python::attach(|py| Self {
4227 groups: self.groups.clone_ref(py),
4228 edge_index: self.edge_index.clone_ref(py),
4229 })
4230 }
4231}
4232
4233impl PyPostRemoveEdgeFromGroupsContext {
4234 pub fn bind(py: Python<'_>, context: PostRemoveEdgeFromGroupsContext) -> Self {
4238 let groups: Vec<PyGroup> = context.groups.deep_into();
4239
4240 Self {
4241 groups: groups.into_py_any(py).expect("groups should be creatable"),
4242 edge_index: context
4243 .edge_index
4244 .into_py_any(py)
4245 .expect("edge_index should be creatable"),
4246 }
4247 }
4248}
4249
4250#[pymethods]
4251impl PyPostRemoveEdgeFromGroupsContext {
4252 #[new]
4253 pub const fn new(groups: Py<PyAny>, edge_index: Py<PyAny>) -> Self {
4254 Self { groups, edge_index }
4255 }
4256
4257 #[getter]
4258 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
4259 self.groups.clone_ref(py)
4260 }
4261
4262 #[getter]
4263 pub fn edge_index(&self, py: Python<'_>) -> Py<PyAny> {
4264 self.edge_index.clone_ref(py)
4265 }
4266}
4267
4268#[pyclass(frozen)]
4269#[derive(Debug)]
4270pub struct PyPreRemoveEdgesFromGroupsContext {
4271 groups: Py<PyAny>,
4272 edge_indices: Py<PyAny>,
4273}
4274
4275impl Clone for PyPreRemoveEdgesFromGroupsContext {
4276 fn clone(&self) -> Self {
4277 Python::attach(|py| Self {
4278 groups: self.groups.clone_ref(py),
4279 edge_indices: self.edge_indices.clone_ref(py),
4280 })
4281 }
4282}
4283
4284impl PyPreRemoveEdgesFromGroupsContext {
4285 pub fn bind(py: Python<'_>, context: PreRemoveEdgesFromGroupsContext) -> Self {
4289 let groups: Vec<PyGroup> = context.groups.deep_into();
4290
4291 Self {
4292 groups: groups.into_py_any(py).expect("groups should be creatable"),
4293 edge_indices: context
4294 .edge_indices
4295 .into_py_any(py)
4296 .expect("edge_indices should be creatable"),
4297 }
4298 }
4299
4300 pub fn extract(self, py: Python<'_>) -> PreRemoveEdgesFromGroupsContext {
4304 let groups: Vec<PyGroup> = self
4305 .groups
4306 .extract(py)
4307 .expect("groups should be extractable");
4308
4309 PreRemoveEdgesFromGroupsContext {
4310 groups: groups.deep_into(),
4311 edge_indices: self
4312 .edge_indices
4313 .extract(py)
4314 .expect("edge_indices should be extractable"),
4315 }
4316 }
4317}
4318
4319#[pymethods]
4320impl PyPreRemoveEdgesFromGroupsContext {
4321 #[new]
4322 pub const fn new(groups: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
4323 Self {
4324 groups,
4325 edge_indices,
4326 }
4327 }
4328
4329 #[getter]
4330 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
4331 self.groups.clone_ref(py)
4332 }
4333
4334 #[getter]
4335 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
4336 self.edge_indices.clone_ref(py)
4337 }
4338}
4339
4340#[pyclass(frozen)]
4341#[derive(Debug)]
4342pub struct PyPostRemoveEdgesFromGroupsContext {
4343 groups: Py<PyAny>,
4344 edge_indices: Py<PyAny>,
4345}
4346
4347impl Clone for PyPostRemoveEdgesFromGroupsContext {
4348 fn clone(&self) -> Self {
4349 Python::attach(|py| Self {
4350 groups: self.groups.clone_ref(py),
4351 edge_indices: self.edge_indices.clone_ref(py),
4352 })
4353 }
4354}
4355
4356impl PyPostRemoveEdgesFromGroupsContext {
4357 pub fn bind(py: Python<'_>, context: PostRemoveEdgesFromGroupsContext) -> Self {
4361 let groups: Vec<PyGroup> = context.groups.deep_into();
4362
4363 Self {
4364 groups: groups.into_py_any(py).expect("groups should be creatable"),
4365 edge_indices: context
4366 .edge_indices
4367 .into_py_any(py)
4368 .expect("edge_indices should be creatable"),
4369 }
4370 }
4371}
4372
4373#[pymethods]
4374impl PyPostRemoveEdgesFromGroupsContext {
4375 #[new]
4376 pub const fn new(groups: Py<PyAny>, edge_indices: Py<PyAny>) -> Self {
4377 Self {
4378 groups,
4379 edge_indices,
4380 }
4381 }
4382
4383 #[getter]
4384 pub fn groups(&self, py: Python<'_>) -> Py<PyAny> {
4385 self.groups.clone_ref(py)
4386 }
4387
4388 #[getter]
4389 pub fn edge_indices(&self, py: Python<'_>) -> Py<PyAny> {
4390 self.edge_indices.clone_ref(py)
4391 }
4392}
4393
4394#[typetag::serde]
4395impl Plugin for PyPlugin {
4396 fn clone_box(&self) -> Box<dyn Plugin> {
4397 Python::attach(|py| Box::new(Self(self.0.clone_ref(py))))
4398 }
4399
4400 fn initialize(&self, graphrecord: &mut GraphRecord) -> GraphRecordResult<()> {
4401 Python::attach(|py| {
4402 PyGraphRecord::scope_mut(py, graphrecord, |py, graphrecord| {
4403 self.0
4404 .call_method1(py, "initialize", (graphrecord,))
4405 .map_err(|err| GraphRecordError::ConversionError(format!("{err}")))?;
4406
4407 Ok(())
4408 })
4409 })
4410 }
4411
4412 fn finalize(&self, graphrecord: &mut GraphRecord) -> GraphRecordResult<()> {
4413 Python::attach(|py| {
4414 PyGraphRecord::scope_mut(py, graphrecord, |py, graphrecord| {
4415 self.0
4416 .call_method1(py, "finalize", (graphrecord,))
4417 .map_err(|err| GraphRecordError::ConversionError(format!("{err}")))?;
4418
4419 Ok(())
4420 })
4421 })
4422 }
4423
4424 impl_pre_hook!(pre_set_schema, PyPreSetSchemaContext, PreSetSchemaContext);
4425 impl_post_hook!(post_set_schema);
4426 impl_post_hook!(pre_freeze_schema);
4427 impl_post_hook!(post_freeze_schema);
4428 impl_post_hook!(pre_unfreeze_schema);
4429 impl_post_hook!(post_unfreeze_schema);
4430 impl_pre_hook!(pre_add_node, PyPreAddNodeContext, PreAddNodeContext);
4431 impl_post_hook!(post_add_node, PyPostAddNodeContext, PostAddNodeContext);
4432 impl_pre_hook!(
4433 pre_add_node_with_group,
4434 PyPreAddNodeWithGroupContext,
4435 PreAddNodeWithGroupContext
4436 );
4437 impl_post_hook!(
4438 post_add_node_with_group,
4439 PyPostAddNodeWithGroupContext,
4440 PostAddNodeWithGroupContext
4441 );
4442 impl_pre_hook!(
4443 pre_add_node_with_groups,
4444 PyPreAddNodeWithGroupsContext,
4445 PreAddNodeWithGroupsContext
4446 );
4447 impl_post_hook!(
4448 post_add_node_with_groups,
4449 PyPostAddNodeWithGroupsContext,
4450 PostAddNodeWithGroupsContext
4451 );
4452 impl_pre_hook!(
4453 pre_remove_node,
4454 PyPreRemoveNodeContext,
4455 PreRemoveNodeContext
4456 );
4457 impl_post_hook!(
4458 post_remove_node,
4459 PyPostRemoveNodeContext,
4460 PostRemoveNodeContext
4461 );
4462 impl_pre_hook!(pre_add_nodes, PyPreAddNodesContext, PreAddNodesContext);
4463 impl_post_hook!(post_add_nodes, PyPostAddNodesContext, PostAddNodesContext);
4464 impl_pre_hook!(
4465 pre_add_nodes_with_group,
4466 PyPreAddNodesWithGroupContext,
4467 PreAddNodesWithGroupContext
4468 );
4469 impl_post_hook!(
4470 post_add_nodes_with_group,
4471 PyPostAddNodesWithGroupContext,
4472 PostAddNodesWithGroupContext
4473 );
4474 impl_pre_hook!(
4475 pre_add_nodes_with_groups,
4476 PyPreAddNodesWithGroupsContext,
4477 PreAddNodesWithGroupsContext
4478 );
4479 impl_post_hook!(
4480 post_add_nodes_with_groups,
4481 PyPostAddNodesWithGroupsContext,
4482 PostAddNodesWithGroupsContext
4483 );
4484 impl_pre_hook!(
4485 pre_add_nodes_dataframes,
4486 PyPreAddNodesDataframesContext,
4487 PreAddNodesDataframesContext
4488 );
4489 impl_post_hook!(
4490 post_add_nodes_dataframes,
4491 PyPostAddNodesDataframesContext,
4492 PostAddNodesDataframesContext
4493 );
4494 impl_pre_hook!(
4495 pre_add_nodes_dataframes_with_group,
4496 PyPreAddNodesDataframesWithGroupContext,
4497 PreAddNodesDataframesWithGroupContext
4498 );
4499 impl_post_hook!(
4500 post_add_nodes_dataframes_with_group,
4501 PyPostAddNodesDataframesWithGroupContext,
4502 PostAddNodesDataframesWithGroupContext
4503 );
4504 impl_pre_hook!(
4505 pre_add_nodes_dataframes_with_groups,
4506 PyPreAddNodesDataframesWithGroupsContext,
4507 PreAddNodesDataframesWithGroupsContext
4508 );
4509 impl_post_hook!(
4510 post_add_nodes_dataframes_with_groups,
4511 PyPostAddNodesDataframesWithGroupsContext,
4512 PostAddNodesDataframesWithGroupsContext
4513 );
4514 impl_pre_hook!(pre_add_edge, PyPreAddEdgeContext, PreAddEdgeContext);
4515 impl_post_hook!(post_add_edge, PyPostAddEdgeContext, PostAddEdgeContext);
4516 impl_pre_hook!(
4517 pre_add_edge_with_group,
4518 PyPreAddEdgeWithGroupContext,
4519 PreAddEdgeWithGroupContext
4520 );
4521 impl_post_hook!(
4522 post_add_edge_with_group,
4523 PyPostAddEdgeWithGroupContext,
4524 PostAddEdgeWithGroupContext
4525 );
4526 impl_pre_hook!(
4527 pre_add_edge_with_groups,
4528 PyPreAddEdgeWithGroupsContext,
4529 PreAddEdgeWithGroupsContext
4530 );
4531 impl_post_hook!(
4532 post_add_edge_with_groups,
4533 PyPostAddEdgeWithGroupsContext,
4534 PostAddEdgeWithGroupsContext
4535 );
4536 impl_pre_hook!(
4537 pre_remove_edge,
4538 PyPreRemoveEdgeContext,
4539 PreRemoveEdgeContext
4540 );
4541 impl_post_hook!(
4542 post_remove_edge,
4543 PyPostRemoveEdgeContext,
4544 PostRemoveEdgeContext
4545 );
4546 impl_pre_hook!(pre_add_edges, PyPreAddEdgesContext, PreAddEdgesContext);
4547 impl_post_hook!(post_add_edges, PyPostAddEdgesContext, PostAddEdgesContext);
4548 impl_pre_hook!(
4549 pre_add_edges_with_group,
4550 PyPreAddEdgesWithGroupContext,
4551 PreAddEdgesWithGroupContext
4552 );
4553 impl_post_hook!(
4554 post_add_edges_with_group,
4555 PyPostAddEdgesWithGroupContext,
4556 PostAddEdgesWithGroupContext
4557 );
4558 impl_pre_hook!(
4559 pre_add_edges_with_groups,
4560 PyPreAddEdgesWithGroupsContext,
4561 PreAddEdgesWithGroupsContext
4562 );
4563 impl_post_hook!(
4564 post_add_edges_with_groups,
4565 PyPostAddEdgesWithGroupsContext,
4566 PostAddEdgesWithGroupsContext
4567 );
4568 impl_pre_hook!(
4569 pre_add_edges_dataframes,
4570 PyPreAddEdgesDataframesContext,
4571 PreAddEdgesDataframesContext
4572 );
4573 impl_post_hook!(
4574 post_add_edges_dataframes,
4575 PyPostAddEdgesDataframesContext,
4576 PostAddEdgesDataframesContext
4577 );
4578 impl_pre_hook!(
4579 pre_add_edges_dataframes_with_group,
4580 PyPreAddEdgesDataframesWithGroupContext,
4581 PreAddEdgesDataframesWithGroupContext
4582 );
4583 impl_post_hook!(
4584 post_add_edges_dataframes_with_group,
4585 PyPostAddEdgesDataframesWithGroupContext,
4586 PostAddEdgesDataframesWithGroupContext
4587 );
4588 impl_pre_hook!(
4589 pre_add_edges_dataframes_with_groups,
4590 PyPreAddEdgesDataframesWithGroupsContext,
4591 PreAddEdgesDataframesWithGroupsContext
4592 );
4593 impl_post_hook!(
4594 post_add_edges_dataframes_with_groups,
4595 PyPostAddEdgesDataframesWithGroupsContext,
4596 PostAddEdgesDataframesWithGroupsContext
4597 );
4598 impl_pre_hook!(pre_add_group, PyPreAddGroupContext, PreAddGroupContext);
4599 impl_post_hook!(post_add_group, PyPostAddGroupContext, PostAddGroupContext);
4600 impl_pre_hook!(
4601 pre_remove_group,
4602 PyPreRemoveGroupContext,
4603 PreRemoveGroupContext
4604 );
4605 impl_post_hook!(
4606 post_remove_group,
4607 PyPostRemoveGroupContext,
4608 PostRemoveGroupContext
4609 );
4610 impl_pre_hook!(
4611 pre_add_node_to_group,
4612 PyPreAddNodeToGroupContext,
4613 PreAddNodeToGroupContext
4614 );
4615 impl_post_hook!(
4616 post_add_node_to_group,
4617 PyPostAddNodeToGroupContext,
4618 PostAddNodeToGroupContext
4619 );
4620 impl_pre_hook!(
4621 pre_add_node_to_groups,
4622 PyPreAddNodeToGroupsContext,
4623 PreAddNodeToGroupsContext
4624 );
4625 impl_post_hook!(
4626 post_add_node_to_groups,
4627 PyPostAddNodeToGroupsContext,
4628 PostAddNodeToGroupsContext
4629 );
4630 impl_pre_hook!(
4631 pre_add_nodes_to_groups,
4632 PyPreAddNodesToGroupsContext,
4633 PreAddNodesToGroupsContext
4634 );
4635 impl_post_hook!(
4636 post_add_nodes_to_groups,
4637 PyPostAddNodesToGroupsContext,
4638 PostAddNodesToGroupsContext
4639 );
4640 impl_pre_hook!(
4641 pre_add_edge_to_group,
4642 PyPreAddEdgeToGroupContext,
4643 PreAddEdgeToGroupContext
4644 );
4645 impl_post_hook!(
4646 post_add_edge_to_group,
4647 PyPostAddEdgeToGroupContext,
4648 PostAddEdgeToGroupContext
4649 );
4650 impl_pre_hook!(
4651 pre_add_edge_to_groups,
4652 PyPreAddEdgeToGroupsContext,
4653 PreAddEdgeToGroupsContext
4654 );
4655 impl_post_hook!(
4656 post_add_edge_to_groups,
4657 PyPostAddEdgeToGroupsContext,
4658 PostAddEdgeToGroupsContext
4659 );
4660 impl_pre_hook!(
4661 pre_add_edges_to_groups,
4662 PyPreAddEdgesToGroupsContext,
4663 PreAddEdgesToGroupsContext
4664 );
4665 impl_post_hook!(
4666 post_add_edges_to_groups,
4667 PyPostAddEdgesToGroupsContext,
4668 PostAddEdgesToGroupsContext
4669 );
4670 impl_pre_hook!(
4671 pre_remove_node_from_group,
4672 PyPreRemoveNodeFromGroupContext,
4673 PreRemoveNodeFromGroupContext
4674 );
4675 impl_post_hook!(
4676 post_remove_node_from_group,
4677 PyPostRemoveNodeFromGroupContext,
4678 PostRemoveNodeFromGroupContext
4679 );
4680 impl_pre_hook!(
4681 pre_remove_node_from_groups,
4682 PyPreRemoveNodeFromGroupsContext,
4683 PreRemoveNodeFromGroupsContext
4684 );
4685 impl_post_hook!(
4686 post_remove_node_from_groups,
4687 PyPostRemoveNodeFromGroupsContext,
4688 PostRemoveNodeFromGroupsContext
4689 );
4690 impl_pre_hook!(
4691 pre_remove_nodes_from_groups,
4692 PyPreRemoveNodesFromGroupsContext,
4693 PreRemoveNodesFromGroupsContext
4694 );
4695 impl_post_hook!(
4696 post_remove_nodes_from_groups,
4697 PyPostRemoveNodesFromGroupsContext,
4698 PostRemoveNodesFromGroupsContext
4699 );
4700 impl_pre_hook!(
4701 pre_remove_edge_from_group,
4702 PyPreRemoveEdgeFromGroupContext,
4703 PreRemoveEdgeFromGroupContext
4704 );
4705 impl_post_hook!(
4706 post_remove_edge_from_group,
4707 PyPostRemoveEdgeFromGroupContext,
4708 PostRemoveEdgeFromGroupContext
4709 );
4710 impl_pre_hook!(
4711 pre_remove_edge_from_groups,
4712 PyPreRemoveEdgeFromGroupsContext,
4713 PreRemoveEdgeFromGroupsContext
4714 );
4715 impl_post_hook!(
4716 post_remove_edge_from_groups,
4717 PyPostRemoveEdgeFromGroupsContext,
4718 PostRemoveEdgeFromGroupsContext
4719 );
4720 impl_pre_hook!(
4721 pre_remove_edges_from_groups,
4722 PyPreRemoveEdgesFromGroupsContext,
4723 PreRemoveEdgesFromGroupsContext
4724 );
4725 impl_post_hook!(
4726 post_remove_edges_from_groups,
4727 PyPostRemoveEdgesFromGroupsContext,
4728 PostRemoveEdgesFromGroupsContext
4729 );
4730 impl_post_hook!(pre_clear);
4731 impl_post_hook!(post_clear);
4732}