class_docstr: A context manager used to implement TestCase.assertWarns* methods.
code: def __exit__(self, exc_type, exc_value, tb):
      # pylint: disable=invalid-name, attribute-defined-outside-init
      self.warnings_manager.__exit__(exc_type, exc_value, tb)
      if exc_type is not None:
          # let unexpected exceptions pass through
          return
      try:
          exc_name = self.expected.__name__
      except AttributeError:
          exc_name = str(self.expected)
      first_matching = None
      for m in self.warnings:
          w = m.message
          if not isinstance(w, self.expected):
              continue
          if first_matching is None:
              first_matching = w
          if (
              self.expected_regex is not None
              and not self.expected_regex.search(str(w))
          ):
              continue
          # store warning for later retrieval
          self.warning = w
          self.filename = m.filename
          self.lineno = m.lineno
          return
      # Now we simply try to choose a helpful failure message
      if first_matching is not None:
          self._raiseFailure(
              '"{}" does not match "{}"'.format(
                  self.expected_regex.pattern, str(first_matching)
              )
          )
      if self.obj_name:
          self._raiseFailure(
              "{} not triggered by {}".format(exc_name, self.obj_name)
          )
      else:
          self._raiseFailure("{} not triggered".format(exc_name))
  
imports: from __future__ import print_function, division, absolute_import
  import random
  import copy
  import warnings
  import tempfile
  import shutil
  import re
  import sys
  import importlib
  import functools
  import numpy
  import six.moves
  import imgaug
  import imgaug.random
  import imgaug.parameters
  from imgaug.augmentables.kps import KeypointsOnImage
label_desc: Use image node_id 2 for calling the _AssertWarnsContext obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, tb) without return types