Path 1: 535 calls (0.96)

View.as_view..view def (23) MethodView.dispatch_request def (15) test_session_cookie_setting..bump def (12) test_blueprint_prefix_slas...

View.as_view..view def (23) MethodView.dispatch_request def (15) test_session_cookie_setting..bump def (12) test_blueprint_prefix_slas...

1def ensure_sync(self, func: t.Callable) -> t.Callable:
2        """Ensure that the function is synchronous for WSGI workers.
3        Plain ``def`` functions are returned as-is. ``async def``
4        functions are wrapped to run and wait for the response.
5
6        Override this method to change how the app runs async views.
7
8        .. versionadded:: 2.0
9        """
10        if iscoroutinefunction(func):
11            return self.async_to_sync(func)
12
13        return func
            

Path 2: 20 calls (0.04)

_async_app..index def (4) _async_app..bp_index def (2) AsyncView.dispatch_request def (2) test_async_before_after_request..bef...

AsyncToSync (20)

1def ensure_sync(self, func: t.Callable) -> t.Callable:
2        """Ensure that the function is synchronous for WSGI workers.
3        Plain ``def`` functions are returned as-is. ``async def``
4        functions are wrapped to run and wait for the response.
5
6        Override this method to change how the app runs async views.
7
8        .. versionadded:: 2.0
9        """
10        if iscoroutinefunction(func):
11            return self.async_to_sync(func)
12
13        return func