From 135617140fe8edddc5bf9b3d9af8bb824d53690a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:50:03 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- strawberry/schema/execute.py | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/strawberry/schema/execute.py b/strawberry/schema/execute.py index af1345b112..bd8770b0cb 100644 --- a/strawberry/schema/execute.py +++ b/strawberry/schema/execute.py @@ -158,36 +158,34 @@ async def execute( ) -> ExecutionResult | PreExecutionError: try: async with extensions_runner.operation(): - # Note: In graphql-core the schema would be validated here but in - # Strawberry we are validating it at initialisation time instead - - if errors := await _parse_and_validate_async( - execution_context, extensions_runner - ): - return await _handle_execution_result( - execution_context, errors, extensions_runner, process_errors - ) - - assert execution_context.graphql_document - async with extensions_runner.executing(): - if not execution_context.result: - result = await await_maybe( - original_execute( - schema, - execution_context.graphql_document, - root_value=execution_context.root_value, - middleware=middleware_manager, - variable_values=execution_context.variables, - operation_name=execution_context.operation_name, - context_value=execution_context.context, - execution_context_class=execution_context_class, - ) - ) + # Note: In graphql-core the schema would be validated here but in + # Strawberry we are validating it at initialisation time instead - else: - result = execution_context.result + if errors := await _parse_and_validate_async( + execution_context, extensions_runner + ): + return await _handle_execution_result( + execution_context, errors, extensions_runner, process_errors + ) + assert execution_context.graphql_document + async with extensions_runner.executing(): + if not execution_context.result: + result = await await_maybe( + original_execute( + schema, + execution_context.graphql_document, + root_value=execution_context.root_value, + middleware=middleware_manager, + variable_values=execution_context.variables, + operation_name=execution_context.operation_name, + context_value=execution_context.context, + execution_context_class=execution_context_class, + ) + ) + else: + result = execution_context.result except (MissingQueryError, InvalidOperationTypeError) as e: raise e @@ -203,6 +201,7 @@ async def execute( execution_context, result, extensions_runner, process_errors ) + def execute_sync( schema: GraphQLSchema, *,