class_docstr: Exteded Trainer for FLash tasks.
  
  >>> Trainer()  # doctest: +ELLIPSIS
  <...trainer.Trainer object at ...>
class_docstr_tok: ["Exteded","Trainer","for","FLash","tasks",".",">",">",">","Trainer","(",")","#","doctest",":","+ELLIPSIS","<","...","trainer.Trainer","object","at","...",">"]
docstr: This function keeps only 1 instance of each callback type, extending new_callbacks with old_callbacks.
docstr_tok: ["This","function","keeps","only","1","instance","of","each","callback","type",",","extending","new_callbacks","with","old_callbacks","."]
code: def _merge_callbacks(
      old_callbacks: List, new_callbacks: List
  ) -> List:
      """This function keeps only 1 instance of each callback type, extending new_callbacks with old_callbacks."""
      if len(new_callbacks) == 0:
          return old_callbacks
      new_callbacks_types = {type(c) for c in new_callbacks}
      old_callbacks_types = {type(c) for c in old_callbacks}
      override_types = new_callbacks_types.intersection(
          old_callbacks_types
      )
      new_callbacks.extend(
          c for c in old_callbacks if type(c) not in override_types
      )
      return new_callbacks
  
imports: import inspect
  import warnings
  from argparse import ArgumentParser, Namespace
  from functools import wraps
  from typing import Callable, List, Optional, Tuple, Union
  import torch
  from pytorch_lightning import LightningDataModule, LightningModule
  from pytorch_lightning import Trainer
  from pytorch_lightning.accelerators.tpu import TPUAccelerator
  from pytorch_lightning.callbacks import BaseFinetuning
  from pytorch_lightning.utilities.argparse import add_argparse_args, get_init_arguments_and_types, parse_env_variables
  from torch.utils.data import DataLoader
  import flash
  from flash.core.data.io.output import Output
  from flash.core.data.io.output_transform import OutputTransform
  from flash.core.data.io.transform_predictions import TransformPredictions
  from flash.core.model import Task
  from flash.core.registry import FlashRegistry
label_desc: Use image node_id 6 for calling the Trainer obj's underlying member method code with example usage: obj._merge_callbacks(old_callbacks, new_callbacks) and returns: new_callbacks, old_callbacks