4242)
4343
4444
45- class AttributeValueList (Sequence [T | None ]):
45+ class AttributeValueList (Sequence [T ]):
4646 """List-like data structure that stores the values of a vertex or an edge
4747 attribute for every vertex and edge in the graph, while supporting
4848 NumPy-style fancy indexing operations.
@@ -281,7 +281,7 @@ def __delitem__(self, index: IndexLike) -> None: # noqa: C901
281281 raise RuntimeError ("cannot delete items from a fixed-length list" )
282282
283283 @overload
284- def __getitem__ (self , index : IntLike ) -> T | None : ...
284+ def __getitem__ (self , index : IntLike ) -> T : ...
285285
286286 @overload
287287 def __getitem__ (
@@ -307,17 +307,18 @@ def __getitem__(self, index: IndexLike):
307307
308308 elif isinstance (index , Sequence ):
309309 return self .__class__ (
310- self ._items [index ,],
310+ self ._items [index ,], # type: ignore
311311 type = self ._type ,
312- _wrap = True , # type: ignore
312+ _wrap = True ,
313313 )
314314
315315 elif isinstance (index , np .ndarray ):
316316 return self ._items [index ]
317317
318318 self ._raise_invalid_index_error ()
319319
320- def __iter__ (self ) -> Iterable [T ]:
320+ def __iter__ (self ):
321+ # No return value typing here to make mypy happy
321322 return iter (self ._items )
322323
323324 def __len__ (self ) -> int :
@@ -381,7 +382,7 @@ def __setitem__( # noqa: C901
381382 value = value .ravel ()
382383 if isinstance (value , Iterator ):
383384 value = list (value )
384- self ._items [index ,] = value
385+ self ._items [index ,] = value # type: ignore
385386
386387 else :
387388 self ._raise_invalid_index_error ()
@@ -398,6 +399,7 @@ def _extend_length_by(self, n: int) -> None:
398399 # We do not have enough space pre-allocated, find the nearest
399400 # power of two that will suffice
400401 new_length = 2 ** int (np .ceil (np .log2 (target_length )))
402+ default_value : Any
401403 if self ._type is AttributeType .BOOLEAN :
402404 default_value = False
403405 elif self ._type is AttributeType .NUMERIC :
0 commit comments