| 
2 | 2 | 
 
  | 
3 | 3 | from __future__ import annotations  # Python < 3.10  | 
4 | 4 | 
 
  | 
 | 5 | +import sys  | 
5 | 6 | from enum import Enum  | 
6 | 7 | from typing import (  | 
7 | 8 |     TYPE_CHECKING,  | 
@@ -554,30 +555,54 @@ def to_kwargs(self) -> GraphQLFieldKwargs:  | 
554 | 555 |     def __copy__(self) -> GraphQLField:  # pragma: no cover  | 
555 | 556 |         return self.__class__(**self.to_kwargs())  | 
556 | 557 | 
 
  | 
 | 558 | +if sys.version_info.minor == 9 or sys.version_info.minor == 10:  | 
 | 559 | +    class GraphQLResolveInfo(NamedTuple):  | 
 | 560 | +        """Collection of information passed to the resolvers.  | 
557 | 561 | 
  | 
558 |  | -class GraphQLResolveInfo(NamedTuple):  | 
559 |  | -    """Collection of information passed to the resolvers.  | 
 | 562 | +        This is always passed as the first argument to the resolvers.  | 
560 | 563 | 
  | 
561 |  | -    This is always passed as the first argument to the resolvers.  | 
562 |  | -
  | 
563 |  | -    Note that contrary to the JavaScript implementation, the context (commonly used to  | 
564 |  | -    represent an authenticated user, or request-specific caches) is included here and  | 
565 |  | -    not passed as an additional argument.  | 
566 |  | -    """  | 
 | 564 | +        Note that contrary to the JavaScript implementation, the context (commonly used to  | 
 | 565 | +        represent an authenticated user, or request-specific caches) is included here and  | 
 | 566 | +        not passed as an additional argument.  | 
 | 567 | +        """  | 
567 | 568 | 
 
  | 
568 |  | -    field_name: str  | 
569 |  | -    field_nodes: List[FieldNode]  | 
570 |  | -    return_type: GraphQLOutputType  | 
571 |  | -    parent_type: GraphQLObjectType  | 
572 |  | -    path: Path  | 
573 |  | -    schema: GraphQLSchema  | 
574 |  | -    fragments: Dict[str, FragmentDefinitionNode]  | 
575 |  | -    root_value: Any  | 
576 |  | -    operation: OperationDefinitionNode  | 
577 |  | -    variable_values: Dict[str, Any]  | 
578 |  | -    context: Any  | 
579 |  | -    is_awaitable: Callable[[Any], bool]  | 
 | 569 | +        field_name: str  | 
 | 570 | +        field_nodes: List[FieldNode]  | 
 | 571 | +        return_type: GraphQLOutputType  | 
 | 572 | +        parent_type: GraphQLObjectType  | 
 | 573 | +        path: Path  | 
 | 574 | +        schema: GraphQLSchema  | 
 | 575 | +        fragments: Dict[str, FragmentDefinitionNode]  | 
 | 576 | +        root_value: Any  | 
 | 577 | +        operation: OperationDefinitionNode  | 
 | 578 | +        variable_values: Dict[str, Any]  | 
 | 579 | +        context: Any   | 
 | 580 | +        is_awaitable: Callable[[Any], bool]  | 
 | 581 | +else:  | 
 | 582 | +    TContext = TypeVar("TContext")  | 
 | 583 | + | 
 | 584 | +    class GraphQLResolveInfo(NamedTuple, Generic[TContext]):  | 
 | 585 | +        """Collection of information passed to the resolvers.  | 
 | 586 | +
  | 
 | 587 | +        This is always passed as the first argument to the resolvers.  | 
 | 588 | +
  | 
 | 589 | +        Note that contrary to the JavaScript implementation, the context (commonly used to  | 
 | 590 | +        represent an authenticated user, or request-specific caches) is included here and  | 
 | 591 | +        not passed as an additional argument.  | 
 | 592 | +        """  | 
580 | 593 | 
 
  | 
 | 594 | +        field_name: str  | 
 | 595 | +        field_nodes: List[FieldNode]  | 
 | 596 | +        return_type: GraphQLOutputType  | 
 | 597 | +        parent_type: GraphQLObjectType  | 
 | 598 | +        path: Path  | 
 | 599 | +        schema: GraphQLSchema  | 
 | 600 | +        fragments: Dict[str, FragmentDefinitionNode]  | 
 | 601 | +        root_value: Any  | 
 | 602 | +        operation: OperationDefinitionNode  | 
 | 603 | +        variable_values: Dict[str, Any]  | 
 | 604 | +        context: TContext  | 
 | 605 | +        is_awaitable: Callable[[Any], bool]  | 
581 | 606 | 
 
  | 
582 | 607 | # Note: Contrary to the Javascript implementation of GraphQLFieldResolver,  | 
583 | 608 | # the context is passed as part of the GraphQLResolveInfo and any arguments  | 
 | 
0 commit comments