def should_include_node(ctx, directives):
    # type: (ExecutionContext, Optional[List[Directive]]) -> bool
    """Determines if a field should be included based on the @include and
    @skip directives, where @skip has higher precidence than @include."""
    # TODO: Refactor based on latest code
    if directives:
        skip_ast = None

        for directive in directives:
            if directive.name.value == GraphQLSkipDirective.name:
                skip_ast = directive
                break

        if skip_ast:
            args = get_argument_values(
                GraphQLSkipDirective.args, skip_ast.arguments, ctx.variable_values
            )
            if args.get("if") is True:
                return False

        include_ast = None

        for directive in directives:
            if directive.name.value == GraphQLIncludeDirective.name:
                include_ast = directive
                break

        if include_ast:
            args = get_argument_values(
                GraphQLIncludeDirective.args, include_ast.arguments, ctx.variable_values
            )

            if args.get("if") is False:
                return False

    return True
def should_include_node ( ctx , directives ) : if directives : skip_ast = None for directive in directives : if directive . name . value == GraphQLSkipDirective . name : skip_ast = directive break if skip_ast : args = get_argument_values ( GraphQLSkipDirective . args , skip_ast . arguments , ctx . variable_values ) if args . get ( "if" ) is True : return False include_ast = None for directive in directives : if directive . name . value == GraphQLIncludeDirective . name : include_ast = directive break if include_ast : args = get_argument_values ( GraphQLIncludeDirective . args , include_ast . arguments , ctx . variable_values ) if args . get ( "if" ) is False : return False return True
Determines if a field should be included based on the @include and
    @skip directives, where @skip has higher precidence than @include.