code: def compute_config_names_response(
      dataset: str,
      max_number: int,
      dataset_scripts_allow_list: list[str],
      hf_token: Optional[str] = None,
  ) -> DatasetConfigNamesResponse:
      """
      Get the response of dataset-config-names for one specific dataset on huggingface.co.
      Dataset can be private or gated if you pass an acceptable token.
  
      It is assumed that the dataset exists and can be accessed using the token.
  
      Args:
          dataset (`str`):
              A namespace (user or an organization) and a repo name separated
              by a `/`.
          dataset_scripts_allow_list (`list[str]`):
              List of datasets for which we support dataset scripts.
              Unix shell-style wildcards also work in the dataset name for namespaced datasets,
              for example `some_namespace/*` to refer to all the datasets in the `some_namespace` namespace.
              The keyword `{{ALL_DATASETS_WITH_NO_NAMESPACE}}` refers to all the datasets without namespace.
          hf_token (`str`, *optional*):
              An authentication token (See https://huggingface.co/settings/token)
      Returns:
          `DatasetConfigNamesResponse`: An object with the list of config names.
      Raises the following errors:
          - [`libcommon.exceptions.EmptyDatasetError`]
            The dataset is empty.
          - [`libcommon.exceptions.DatasetModuleNotInstalledError`]
            The dataset tries to import a module that is not installed.
          - [`libcommon.exceptions.ConfigNamesError`]
            If the list of configs could not be obtained using the datasets library.
          - [`libcommon.exceptions.DatasetWithScriptNotSupportedError`]
              If the dataset has a dataset script and is not in the allow list.
      """
      logging.info(f"get config names for dataset={dataset}")
      # get the list of splits in streaming mode
      try:
          config_name_items: list[ConfigNameItem] = [
              {"dataset": dataset, "config": str(config)}
              for config in sorted(
                  get_dataset_config_names(
                      path=dataset,
                      token=hf_token,
                      trust_remote_code=resolve_trust_remote_code(
                          dataset=dataset,
                          allow_list=dataset_scripts_allow_list,
                      ),
                  )
              )
          ]
      except _EmptyDatasetError as err:
          raise EmptyDatasetError(
              "The dataset is empty.", cause=err
          ) from err
      except ImportError as err:
          raise DatasetModuleNotInstalledError(
              "The dataset tries to import a module that is not installed.",
              cause=err,
          ) from err
      except Exception as err:
          if isinstance(err, ValueError) and "trust_remote_code" in str(
              err
          ):
              raise DatasetWithScriptNotSupportedError(
                  "The dataset viewer doesn't support this dataset because it runs "
                  "arbitrary python code. Please open a discussion in the discussion tab "
                  "if you think this is an error and tag @lhoestq and @severo."
              ) from err
          raise ConfigNamesError(
              "Cannot get the config names for the dataset.", cause=err
          ) from err
  
      number_of_configs = len(config_name_items)
      if number_of_configs > max_number:
          raise DatasetWithTooManyConfigsError(
              f"The maximum number of configs allowed is {max_number}, dataset has {number_of_configs} configs."
          )
  
      return DatasetConfigNamesResponse(config_names=config_name_items)
  
file_path: datasets-server/services/worker/src/worker/job_runners/dataset/config_names.py
imports: import logging
  from typing import Optional
  from datasets import get_dataset_config_names
  from datasets.data_files import EmptyDatasetError
  from libcommon.exceptions import ConfigNamesError, DatasetModuleNotInstalledError, DatasetWithScriptNotSupportedError, DatasetWithTooManyConfigsError, EmptyDatasetError
  from worker.dtos import CompleteJobResult, ConfigNameItem, DatasetConfigNamesResponse
  from worker.job_runners.dataset.dataset_job_runner import DatasetJobRunnerWithDatasetsCache
  from worker.utils import resolve_trust_remote_code
label_desc: Use image node_id 1 for calling a global function with example usage: compute_config_names_response(dataset, max_number, dataset_scripts_allow_list, hf_token) and returns: DatasetConfigNamesResponse