code: def ignore_query_warning() -> t.Generator[None, None, None]:
      if hasattr(sa_exc, "LegacyAPIWarning"):
          with warnings.catch_warnings():
              exc = sa_exc.LegacyAPIWarning
              warnings.simplefilter("ignore", exc)
              yield
      else:
          yield
  
file_path: flask-sqlalchemy/tests/test_legacy_query.py
imports: from __future__ import annotations
  import typing
  import warnings
  import pytest
  import sqlalchemy
  import sqlalchemy.exc
  from flask import Flask
  from werkzeug.exceptions import NotFound
  from flask_sqlalchemy import SQLAlchemy
  from flask_sqlalchemy.query import Query
label_desc: Use image node_id 1 for calling a global function with example usage: ignore_query_warning() without return types