code: def compute_catch22(
      dataset: Optional[str], data_path: str, output_path: str
  ):
      """
      Computes the catch22 features for each time series in a dataset.
  
      Computations are either run for a single dataset or all datasets in the
      registry.
      """
      target = Path(data_path)
      target.mkdir(parents=True, exist_ok=True)
  
      if dataset is None:
          dataset_names = [
              (k, v(target)) for k, v in DATASET_REGISTRY.items()
          ]
      else:
          dataset_names = [(dataset, DATASET_REGISTRY[dataset](target))]
  
      directory = Path(output_path)
      directory.mkdir(parents=True, exist_ok=True)
  
      for dataset_name, config in tqdm(
          dataset_names, disable=len(dataset_names) == 1
      ):
          file = directory / f"{dataset_name}.parquet"
          if file.exists():
              continue
  
          ts_features = process_map(
              _get_features,
              config.data.train(
                  val=False
              ).gluonts(),  # Get features on train set
              max_workers=os.cpu_count(),
              desc=dataset_name,
              chunksize=1,
          )
          df = pd.DataFrame(ts_features)
          df.to_parquet(file)
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/cli/datasets/compute_catch22.py
imports: import os
  from pathlib import Path
  from typing import Any, Dict, Optional
  import catch22
  import click
  import pandas
  from tqdm.auto import tqdm
  from tqdm.contrib.concurrent import process_map
  from tsbench.config import DATASET_REGISTRY
  from tsbench.constants import DEFAULT_DATA_CATCH22_PATH, DEFAULT_DATA_PATH
  from ._main import datasets
label_desc: Use image node_id 1 for calling a global function with example usage: compute_catch22(dataset, data_path, output_path) without return types