parameters: (app: "Application[Any]")
docstring: Context manager that sets the given :class:`.Application` active in an
      `AppSession`.
  
      This should only be called by the `Application` itself.
      The application will automatically be active while its running. If you want
      the application to be active in other threads/coroutines, where that's not
      the case, use `contextvars.copy_context()`, or use `Application.context` to
      run it in the appropriate context.
docstring_summary: Context manager that sets the given :class:`.Application` active in an
      `AppSession`.
docstring_tokens: Context manager that sets the given : class : . Application active in an AppSession .
function: def set_app(app: "Application[Any]") -> Generator[None, None, None]:
      """
      Context manager that sets the given :class:`.Application` active in an
      `AppSession`.
  
      This should only be called by the `Application` itself.
      The application will automatically be active while its running. If you want
      the application to be active in other threads/coroutines, where that's not
      the case, use `contextvars.copy_context()`, or use `Application.context` to
      run it in the appropriate context.
      """
      session = _current_app_session.get()
  
      previous_app = session.app
      session.app = app
      try:
          yield
      finally:
          session.app = previous_app
function_tokens: def set_app ( app : "Application[Any]" ) -> Generator [ None , None , None ] : session = _current_app_session . get ( ) previous_app = session . app session . app = app try : yield finally : session . app = previous_app