code: def __init__(
      self,
      classes_obj: Optional[Classes] = None,
      valid_ids: Optional["_dtypes.UnionType"] = None,
  ):
      if valid_ids is None:
          valid_ids = _dtypes.UnionType()
      elif isinstance(valid_ids, list):
          valid_ids = _dtypes.UnionType(
              [_dtypes.ConstType(item) for item in valid_ids]
          )
      elif isinstance(valid_ids, _dtypes.UnionType):
          valid_ids = valid_ids
      else:
          raise TypeError("valid_ids must be None, list, or UnionType")
  
      if classes_obj is None:
          classes_obj = Classes(
              [
                  {
                      "id": _id.params["val"],
                      "name": str(_id.params["val"]),
                  }
                  for _id in valid_ids.params["allowed_types"]
              ]
          )
      elif not isinstance(classes_obj, Classes):
          raise TypeError(
              "valid_ids must be None, or instance of Classes"
          )
      else:
          valid_ids = _dtypes.UnionType(
              [
                  _dtypes.ConstType(class_obj["id"])
                  for class_obj in classes_obj._class_set
              ]
          )
  
      self.wb_classes_obj_ref = classes_obj
      self.params.update({"valid_ids": valid_ids})
  
file_path: wandb/wandb/sdk/data_types/helper_types/classes.py
imports: import os
  from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Type, Union
  from ..None import _dtypes
  from ..base_types.media import Media
label_desc: Use image node_id 1 to create a new _ClassesIdType object from inherited base classes: _dtypes with example: obj = _ClassesIdType(classes_obj, valid_ids)