class_docstr: A context manager to monkeypatch classes.
code: def __init__(self, mapping: Mapping[str, Type]) -> None:
      self._mapping = mapping
      self._originals = {}
      self._modules = {}
      for class_string in mapping:
          module_name, class_name = class_string.rsplit(".", 1)
          module = __import__(module_name, fromlist=[class_name])
          self._modules[class_string] = module
          self._originals[class_string] = getattr(module, class_name)
  
file_path: pytorch-lightning/src/lightning/fabric/plugins/precision/utils.py
imports: from typing import Any, Mapping, Type, Union
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 to create a new _ClassReplacementContextManager object  with example: obj = _ClassReplacementContextManager(mapping)