github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/python/aistore/sdk/multiobj/object_template.py (about) 1 # 2 # Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. 3 # 4 5 from typing import Dict, Iterator 6 7 from aistore.sdk import utils 8 from aistore.sdk.multiobj.object_collection import ObjectCollection 9 10 11 class ObjectTemplate(ObjectCollection): 12 """ 13 A collection of object names specified by a template in the bash brace expansion format 14 15 Args: 16 template (str): A string template that defines the names of objects to include in the collection 17 18 """ 19 20 def __init__(self, template: str): 21 self._template = template 22 23 def __iter__(self) -> Iterator[str]: 24 return utils.expand_braces(self._template) 25 26 def get_value(self) -> Dict[str, str]: 27 return {"template": self._template}