class_docstr: Extension of jsonargparse's ArgumentParser for pytorch-lightning.
class_docstr_tok: ["Extension","of","jsonargparse","'s","ArgumentParser","for","pytorch-lightning","."]
docstr: Adds arguments from a lightning class to a nested key of the parser.
  
  Args:
      lightning_class: A callable or any subclass of {Trainer, LightningModule, LightningDataModule, Callback}.
      nested_key: Name of the nested namespace to store arguments.
      subclass_mode: Whether allow any subclass of the given class.
code: def add_lightning_class_args(
      self,
      lightning_class: Union[
          Callable[
              ...,
              Union[
                  Trainer,
                  LightningModule,
                  LightningDataModule,
                  Callback,
              ],
          ],
          Type[Trainer],
          Type[LightningModule],
          Type[LightningDataModule],
          Type[Callback],
      ],
      nested_key: str,
      subclass_mode: bool = False,
  ) -> List[str]:
      """Adds arguments from a lightning class to a nested key of the parser.
  
      Args:
          lightning_class: A callable or any subclass of {Trainer, LightningModule, LightningDataModule, Callback}.
          nested_key: Name of the nested namespace to store arguments.
          subclass_mode: Whether allow any subclass of the given class.
  
      """
      if callable(lightning_class) and not inspect.isclass(
          lightning_class
      ):
          lightning_class = class_from_function(lightning_class)
  
      if inspect.isclass(lightning_class) and issubclass(
          cast(type, lightning_class),
          (Trainer, LightningModule, LightningDataModule, Callback),
      ):
          if issubclass(cast(type, lightning_class), Callback):
              self.callback_keys.append(nested_key)
          if subclass_mode:
              return self.add_subclass_arguments(
                  lightning_class, nested_key, required=True
              )
          return self.add_class_arguments(
              lightning_class,
              nested_key,
              fail_untyped=False,
              instantiate=not issubclass(
                  cast(type, lightning_class), Trainer
              ),
          )
      raise TypeError(
          f"Cannot add arguments from: {lightning_class}. You should provide either a callable or a subclass of: "
          "Trainer, LightningModule, LightningDataModule, or Callback."
      )
  
imports: import inspect
  import os
  import warnings
  from argparse import Namespace
  from types import MethodType
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, cast
  import torch
  from jsonargparse import ActionConfigFile, ArgumentParser, class_from_function, set_config_read_mode
  from pytorch_lightning import LightningDataModule, LightningModule, Trainer
  from pytorch_lightning.callbacks import Callback
  from pytorch_lightning.utilities.cloud_io import get_filesystem
  from pytorch_lightning.utilities.model_helpers import is_overridden
  from pytorch_lightning.utilities.seed import seed_everything
  from torch.optim import Optimizer
label_desc: Use image node_id 2 for calling the LightningArgumentParser obj's underlying member method code with example usage: obj.add_lightning_class_args(lightning_class, nested_key, subclass_mode) and returns: self, self