MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / split_id

Method split_id

monai/bundle/reference_resolver.py:233–244  ·  view source on GitHub ↗

Split the id string into a list of strings by `cls.sep`. Args: id: id string to be split. last: whether to split the rightmost part of the id. default is False (split all parts).

(cls, id: str | int, last: bool = False)

Source from the content-addressed store, hash-verified

231
232 @classmethod
233 def split_id(cls, id: str | int, last: bool = False) -> list[str]:
234 """
235 Split the id string into a list of strings by `cls.sep`.
236
237 Args:
238 id: id string to be split.
239 last: whether to split the rightmost part of the id. default is False (split all parts).
240 """
241 if not last:
242 return cls.normalize_id(id).split(cls.sep)
243 res = cls.normalize_id(id).rsplit(cls.sep, 1)
244 return ["".join(res[:-1]), res[-1]]
245
246 @classmethod
247 def iter_subconfigs(cls, id: str, config: Any) -> Iterator[tuple[str, str, Any]]:

Callers 3

__getitem__Method · 0.80
__setitem__Method · 0.80
setMethod · 0.80

Calls 2

splitMethod · 0.80
normalize_idMethod · 0.80

Tested by

no test coverage detected