code: def load_configs_from_directory(
      root: Path, overwrite: bool = True, force_data: bool = False
  ) -> None:
      """
      Load all the examples from a given directory.
      """
      contents: dict[str, str] = {}
      queue = [root]
      while queue:
          path_name = queue.pop()
          if path_name.is_dir():
              queue.extend(path_name.glob("*"))
          elif path_name.suffix.lower() in YAML_EXTENSIONS:
              with open(path_name) as fp:
                  contents[str(path_name.relative_to(root))] = fp.read()
  
      # removing "type" from the metadata allows us to import any exported model
      # from the unzipped directory directly
      metadata = yaml.load(
          contents.get(METADATA_FILE_NAME, "{}"), Loader=yaml.Loader
      )
      if "type" in metadata:
          del metadata["type"]
      contents[METADATA_FILE_NAME] = yaml.dump(metadata)
  
      command = ImportExamplesCommand(
          contents,
          overwrite=overwrite,
          force_data=force_data,
      )
      try:
          command.run()
      except CommandInvalidError as ex:
          _logger.error(
              "An error occurred: %s", ex.normalized_messages()
          )
  
file_path: superset/superset/examples/utils.py
imports: import logging
  import re
  from importlib.resources import files
  from pathlib import Path
  from typing import Any
  import yaml
  from superset.commands.exceptions import CommandInvalidError
  from superset.commands.importers.v1.examples import ImportExamplesCommand
  from superset.commands.importers.v1.utils import METADATA_FILE_NAME
label_desc: Use image node_id 3 for calling a global function with example usage: load_configs_from_directory(root, overwrite, force_data) without return types