Skip to content

Commit 23fd669

Browse files
committed
Modified docstrings
Signed-off-by: dpj135 <958208521@qq.com>
1 parent abbf0fb commit 23fd669

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

transfer_queue/storage/clients/yuanrong_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import struct
1919
from abc import ABC, abstractmethod
2020
from concurrent.futures import ThreadPoolExecutor
21-
from typing import Any, Callable, Optional, TypeAlias, Union
21+
from typing import Any, Callable, Optional, TypeAlias
2222

2323
import torch
2424
from torch import Tensor
@@ -94,7 +94,7 @@ def __init__(self, config: dict):
9494
logger.info("YuanrongStorageClient: Create DsTensorClient to connect with yuanrong-datasystem backend!")
9595

9696
@staticmethod
97-
def init(config: dict) -> Union["StorageStrategy", None]:
97+
def init(config: dict) -> Optional["StorageStrategy"]:
9898
"""Initialize only if NPU and torch_npu are available."""
9999
torch_npu_imported: bool = True
100100
try:
@@ -468,10 +468,12 @@ def _route_to_strategies(
468468
) -> dict[StorageStrategy, list[int]]:
469469
"""Groups item indices by the first strategy that supports them.
470470
471-
Used to route keys/values/custom_meta to storage backends by grouped indexes.
471+
Used to route data to storage strategies by grouped indexes.
472472
473473
Args:
474-
items: A list of items (e.g., values for put, or custom_meta strings for get/clear).
474+
items: A list used to distinguish which storage strategy the data is routed to.
475+
e.g., route <keys, values> for put based on types of values,
476+
or route <keys, Optional[shapes], Optional[dtypes]> for get/clear based on strategy_tag.
475477
The order must correspond to the original keys.
476478
selector: A function that determines whether a strategy supports an item.
477479
Signature: `(strategy: StorageStrategy, item: Any) -> bool`.

0 commit comments

Comments
 (0)