44 py_object ,
55)
66from dataclasses import dataclass , field
7- from typing import Any , Callable , Dict , Optional
7+ from typing import Any , Callable , Optional
88
99from .lib import igraph_error , igraph_vector_ptr_size
1010from .refcount import incref , decref
@@ -34,7 +34,7 @@ class AttributeHandlerBase:
3434 _table : Optional [igraph_attribute_table_t ] = None
3535 _table_ptr = None
3636
37- def _get_attribute_handler_functions (self ) -> Dict [str , Callable ]:
37+ def _get_attribute_handler_functions (self ) -> dict [str , Callable ]:
3838 """Returns an ``igraph_attribute_table_t`` instance that can be used
3939 to register this attribute handler in the core igraph library.
4040 """
@@ -60,7 +60,7 @@ class AttributeStorage(ABC):
6060 """
6161
6262 @abstractmethod
63- def add_vertices (self , n : int ) -> None :
63+ def add_vertices (self , graph , n : int ) -> None :
6464 """Notifies the attribute storage object that the given number of
6565 new vertices were added to the graph.
6666 """
@@ -82,17 +82,17 @@ def copy(
8282
8383
8484@dataclass (frozen = True )
85- class DictAttributeStorage (AttributeStorage ):
86- """Dictionary -based storage area for the graph, vertex and edge attributes
85+ class dictAttributeStorage (AttributeStorage ):
86+ """dictionary -based storage area for the graph, vertex and edge attributes
8787 of a graph.
8888 """
8989
90- graph_attributes : Dict [str , Any ] = field (default_factory = dict )
91- vertex_attributes : Dict [str , Any ] = field (default_factory = dict )
92- edge_attributes : Dict [str , Any ] = field (default_factory = dict )
90+ graph_attributes : dict [str , Any ] = field (default_factory = dict )
91+ vertex_attributes : dict [str , list ] = field (default_factory = dict )
92+ edge_attributes : dict [str , Any ] = field (default_factory = dict )
9393
9494 def add_vertices (self , graph , n : int ) -> None :
95- print ( "Added" , n , "vertices" )
95+ pass
9696
9797 def clear (self ) -> None :
9898 """Clears the storage area, removing all attributes from the
@@ -148,12 +148,12 @@ def _detach_storage_from_graph(graph) -> None:
148148
149149
150150class AttributeHandler (AttributeHandlerBase ):
151- """Attribute handler implementation that uses a DictAttributeStorage_
151+ """Attribute handler implementation that uses a dictAttributeStorage_
152152 as its storage backend.
153153 """
154154
155155 def init (self , graph , attr ):
156- _assign_storage_to_graph (graph , DictAttributeStorage ())
156+ _assign_storage_to_graph (graph , dictAttributeStorage ())
157157
158158 def destroy (self , graph ) -> None :
159159 storage = _get_storage_from_graph (graph )
0 commit comments