code: def recwarn() -> Generator["WarningsRecorder", None, None]:
      """Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
  
      See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information
      on warning categories.
      """
      wrec = WarningsRecorder(_ispytest=True)
      with wrec:
          warnings.simplefilter("default")
          yield wrec
  
imports: import re
  import warnings
  from pprint import pformat
  from types import TracebackType
  from typing import Any
  from typing import Callable
  from typing import Generator
  from typing import Iterator
  from typing import List
  from typing import Optional
  from typing import Pattern
  from typing import Tuple
  from typing import Type
  from typing import TypeVar
  from typing import Union
  from _pytest.compat import final
  from _pytest.compat import overload
  from _pytest.deprecated import check_ispytest
  from _pytest.deprecated import WARNS_NONE_ARG
  from _pytest.fixtures import fixture
  from _pytest.outcomes import fail
label_desc: Use image node_id 1 for calling a global function with example usage: recwarn() without return types