@@ -57,7 +57,7 @@ def supports_put(self, value: Any) -> bool:
5757 """Check if this strategy can store the given value."""
5858
5959 @abstractmethod
60- def put (self , keys : list [str ], values : list [Any ]):
60+ def put (self , keys : list [str ], values : list [Any ]) -> None :
6161 """Store key-value pairs using this strategy."""
6262
6363 @abstractmethod
@@ -73,7 +73,7 @@ def supports_clear(self, strategy_tag: Any) -> bool:
7373 """Check if this strategy owns data identified by metadata."""
7474
7575 @abstractmethod
76- def clear (self , keys : list [str ]):
76+ def clear (self , keys : list [str ]) -> None :
7777 """Delete keys from storage."""
7878
7979
@@ -131,7 +131,7 @@ def supports_put(self, value: Any) -> bool:
131131 # Only contiguous NPU tensors are supported by this adapter.
132132 return value .is_contiguous ()
133133
134- def put (self , keys : list [str ], values : list [Any ]):
134+ def put (self , keys : list [str ], values : list [Any ]) -> None :
135135 """Store NPU tensors in batches; deletes before overwrite."""
136136 for i in range (0 , len (keys ), self .KEYS_LIMIT ):
137137 batch_keys = keys [i : i + self .KEYS_LIMIT ]
@@ -169,22 +169,22 @@ def supports_clear(self, strategy_tag: str) -> bool:
169169 """Matches 'DsTensorClient' strategy tag."""
170170 return isinstance (strategy_tag , str ) and strategy_tag == self .strategy_tag ()
171171
172- def clear (self , keys : list [str ]):
172+ def clear (self , keys : list [str ]) -> None :
173173 """Delete NPU tensor keys in batches."""
174174 for i in range (0 , len (keys ), self .KEYS_LIMIT ):
175175 batch = keys [i : i + self .KEYS_LIMIT ]
176176 # Todo(dpj): Test call clear when no (key,value) put in ds
177177 self ._ds_client .delete (batch )
178178
179- def _create_empty_npu_tensorlist (self , shapes : list , dtypes : list ) :
179+ def _create_empty_npu_tensorlist (self , shapes : list [ Any ] , dtypes : list [ Any ]) -> list [ Tensor ] :
180180 """
181181 Create a list of empty NPU tensors with given shapes and dtypes.
182182
183183 Args:
184184 shapes (list): List of tensor shapes (e.g., [(3,), (2, 4)])
185185 dtypes (list): List of torch dtypes (e.g., [torch.float32, torch.int64])
186186 Returns:
187- list: List of uninitialized NPU tensors
187+ list[Tensor] : List of uninitialized NPU tensors
188188 """
189189 tensors : list [Tensor ] = []
190190 for shape , dtype in zip (shapes , dtypes , strict = True ):
@@ -243,7 +243,7 @@ def supports_put(self, value: Any) -> bool:
243243 """Accepts any Python object."""
244244 return True
245245
246- def put (self , keys : list [str ], values : list [Any ]):
246+ def put (self , keys : list [str ], values : list [Any ]) -> None :
247247 """Store objects via zero-copy serialization in batches."""
248248 for i in range (0 , len (keys ), self .PUT_KEYS_LIMIT ):
249249 batch_keys = keys [i : i + self .PUT_KEYS_LIMIT ]
@@ -267,7 +267,7 @@ def supports_clear(self, strategy_tag: str) -> bool:
267267 """Matches 'KVClient' strategy tag."""
268268 return isinstance (strategy_tag , str ) and strategy_tag == self .strategy_tag ()
269269
270- def clear (self , keys : list [str ]):
270+ def clear (self , keys : list [str ]) -> None :
271271 """Delete keys in batches."""
272272 for i in range (0 , len (keys ), self .GET_CLEAR_KEYS_LIMIT ):
273273 batch_keys = keys [i : i + self .GET_CLEAR_KEYS_LIMIT ]
@@ -433,7 +433,13 @@ def put_task(strategy, indexes):
433433 strategy_tags [original_index ] = tag
434434 return strategy_tags
435435
436- def get (self , keys : list [str ], shapes = None , dtypes = None , custom_backend_meta = None ) -> list [Any ]:
436+ def get (
437+ self ,
438+ keys : list [str ],
439+ shapes : Optional [list [Any ]] = None ,
440+ dtypes : Optional [list [Any ]] = None ,
441+ custom_backend_meta : Optional [list [str ]] = None ,
442+ ) -> list [Any ]:
437443 """Retrieves multiple values from remote storage with expected metadata.
438444
439445 Requires shape and dtype hints to reconstruct NPU tensors correctly.
@@ -472,7 +478,7 @@ def get_task(strategy, indexes):
472478 results [original_index ] = value
473479 return results
474480
475- def clear (self , keys : list [str ], custom_backend_meta = None ):
481+ def clear (self , keys : list [str ], custom_backend_meta : Optional [ list [ str ]] = None ) -> None :
476482 """Deletes multiple keys from remote storage.
477483
478484 Args:
@@ -513,8 +519,8 @@ def _route_to_strategies(
513519 The order must correspond to the original keys.
514520 selector: A function that determines whether a strategy supports an item.
515521 Signature: `(strategy: StorageStrategy, item: Any) -> bool`.
516- failback : If True, items that don't match any strategy will be ignored (not included in output).
517- If False, a ValueError will be raised for any unmatched item.
522+ ignore_unmatched : If True, items that don't match any strategy will be ignored (not included in output).
523+ If False, a ValueError will be raised for any unmatched item.
518524
519525 Returns:
520526 A dictionary mapping each active strategy to a list of indexes in `items`
0 commit comments