@@ -31,7 +31,7 @@ use smallvec::SmallVec;
3131use pyo3:: exceptions:: PyIndexError ;
3232use pyo3:: gc:: PyVisit ;
3333use pyo3:: prelude:: * ;
34- use pyo3:: types:: { IntoPyDict , PyBool , PyDict , PyList , PyString , PyTuple } ;
34+ use pyo3:: types:: { IntoPyDict , PyBool , PyDict , PyList , PyString , PyTuple , PyType } ;
3535use pyo3:: PyTraverseError ;
3636use pyo3:: Python ;
3737
@@ -55,8 +55,8 @@ use super::iterators::{
5555 EdgeIndexMap , EdgeIndices , EdgeList , NodeIndices , NodeMap , WeightedEdgeList ,
5656} ;
5757use super :: {
58- find_node_by_weight, weight_callable, DAGHasCycle , DAGWouldCycle , IsNan , NoEdgeBetweenNodes ,
59- NoSuitableNeighbors , NodesRemoved , StablePyGraph ,
58+ find_node_by_weight, generic_class_getitem , weight_callable, DAGHasCycle , DAGWouldCycle , IsNan ,
59+ NoEdgeBetweenNodes , NoSuitableNeighbors , NodesRemoved , StablePyGraph ,
6060} ;
6161
6262use super :: dag_algo:: is_directed_acyclic_graph;
@@ -3143,6 +3143,15 @@ impl PyDiGraph {
31433143 }
31443144 }
31453145
3146+ #[ classmethod]
3147+ #[ pyo3( signature = ( key, /) ) ]
3148+ pub fn __class_getitem__ (
3149+ cls : & Bound < ' _ , PyType > ,
3150+ key : & Bound < ' _ , PyAny > ,
3151+ ) -> PyResult < PyObject > {
3152+ generic_class_getitem ( cls, key)
3153+ }
3154+
31463155 // Functions to enable Python Garbage Collection
31473156
31483157 // Function for PyTypeObject.tp_traverse [1][2] used to tell Python what
0 commit comments