class_docstr: Wrapper class for transformations to config dicts.
class_docstr_tok: ["Wrapper","class","for","transformations","to","config","dicts","."]
docstr: Applied this version transformation to a specified prefix of the config, returns the updated config. If
  prefix names a list, i.e. "input_features", applies the transformation to each list element (input
  feature).
  
  Args:
      config: A config dictionary.
      prefix: An optional keypath prefix i.e. "input_features". If no prefix specified, transformation is applied
              to config itself.
  
  Returns The updated config.
docstr_tok: ["Applied","this","version","transformation","to","a","specified","prefix","of","the","config",",","returns","the","updated","config",".","If","prefix","names","a","list",",","i.e",".","``","input_features","''",",","applies","the","transformation","to","each","list","element","(","input","feature",")",".","Args",":","config",":","A","config","dictionary",".","prefix",":","An","optional","keypath","prefix","i.e",".","``","input_features","''",".","If","no","prefix","specified",",","transformation","is","applied","to","config","itself",".","Returns","The","updated","config","."]
code: def transform_config_with_prefix(
      self, config: Dict, prefix: Optional[str] = None
  ) -> Dict:
      """Applied this version transformation to a specified prefix of the config, returns the updated config. If
      prefix names a list, i.e. "input_features", applies the transformation to each list element (input
      feature).
  
      Args:
          config: A config dictionary.
          prefix: An optional keypath prefix i.e. "input_features". If no prefix specified, transformation is applied
                  to config itself.
  
      Returns The updated config.
      """
      if prefix:
          components = prefix.split(".", 1)
          key = components[0]
          rest_of_prefix = components[1] if len(components) > 1 else ""
          if key in config:
              subsection = config[key]
              if isinstance(subsection, list):
                  config[key] = [
                      self.transform_config_with_prefix(
                          v, prefix=rest_of_prefix
                      )
                      if isinstance(v, dict)
                      else v
                      for v in subsection
                  ]
              elif isinstance(subsection, dict):
                  config[key] = self.transform_config_with_prefix(
                      subsection, prefix=rest_of_prefix
                  )
          return config
      else:
          # Base case: no prefix specified, pass entire dictionary to transform function.
          transformed_config = self.transform(config)
          if transformed_config is None:
              logger.error(
                  "Error: version transformation returned None. Check for missing return statement."
              )
          return transformed_config
  
file_path: ludwig/ludwig/utils/version_transformation.py
imports: import copy
  import logging
  from collections import defaultdict
  from functools import total_ordering
  from typing import Callable, Dict, List, Optional
  from packaging import version
label_desc: Use image node_id 3 for calling the VersionTransformation obj's underlying member method code with example usage: obj.transform_config_with_prefix(config, prefix) and returns: config, transformed_config