Repository: Project-MONAI/MONAI
File: monai/bundle/reference_resolver.py (Python)

Code before:

        """
        return self._resolve_one_item(id=id, **kwargs)

    @classmethod
    def normalize_id(cls, id: str | int) -> str:
        """
        Normalize the id string to consistently use `cls.sep`.

        Args:
            id: id string to be normalized.
        """
        return str(id).replace("#", cls.sep)  # backward compatibility `#` is the old separator

    @classmethod
    def normalize_meta_id(cls, config: Any) -> Any:
        """
        Update deprecated id use `DEPRECATED_ID_MAPPING`.

        Args:
            config: input config to be updated.
        """
        if isinstance(config, dict):
            for _id, _new_id in DEPRECATED_ID_MAPPING.items():
                if _id in config.keys():
                    warnings.warn(f"Detect deprecated id: {_id} in config, replacing with {_new_id}.")
                    config[_new_id] = config.pop(_id)
        return config

    @classmethod
    def split_id(cls, id: str | int, last: bool = False) -> list[str]:
        """
        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).
        """
        if not last:
            return cls.normalize_id(id).split(cls.sep)
        res = cls.normalize_id(id).rsplit(cls.sep, 1)
        return ["".join(res[:-1]), res[-1]]

    @classmethod
    def iter_subconfigs(cls, id: str, config: Any) -> Iterator[tuple[str, str, Any]]:
        """
        Iterate over the sub-configs of the input config, the output `sub_id` uses `cls.sep` to denote substructure.

        Args:
            id: id string of the current input config.
            config: input config to be iterated.

Review comment (suggestion):
```suggestion
                    warnings.warn(f"Detected deprecated name '{_id}' in configuration file, replacing with '{_new_id}'.")
```

Code after:

        """
        return self._resolve_one_item(id=id, **kwargs)

    @classmethod
    def normalize_id(cls, id: str | int) -> str:
        """
        Normalize the id string to consistently use `cls.sep`.

        Args:
            id: id string to be normalized.
        """
        return str(id).replace("#", cls.sep)  # backward compatibility `#` is the old separator

    def normalize_meta_id(self, config: Any) -> Any:
        """
        Update deprecated identifiers in `config` using `DEPRECATED_ID_MAPPING`.
        This will replace names that are marked as deprecated with their replacement.

        Args:
            config: input config to be updated.
        """
        if isinstance(config, dict):
            for _id, _new_id in DEPRECATED_ID_MAPPING.items():
                if _id in config.keys():
                    warnings.warn(
                        f"Detected deprecated name '{_id}' in configuration file, replacing with '{_new_id}'."
                    )
                    config[_new_id] = config.pop(_id)
        return config

    @classmethod
    def split_id(cls, id: str | int, last: bool = False) -> list[str]:
        """
        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).
        """
        if not last:
            return cls.normalize_id(id).split(cls.sep)
        res = cls.normalize_id(id).rsplit(cls.sep, 1)
        return ["".join(res[:-1]), res[-1]]

    @classmethod
    def iter_subconfigs(cls, id: str, config: Any) -> Iterator[tuple[str, str, Any]]:
        """
        Iterate over the sub-configs of the input config, the output `sub_id` uses `cls.sep` to denote substructure.

        Args: