from typing import Any, Callable

from graphql.type import (
    GraphQLArgument,
    GraphQLField,
    GraphQLInputType,
    GraphQLOutputType,
    GraphQLList,
    GraphQLNonNull,
    GraphQLResolveInfo,
)


def plural_identifying_root_field(
    arg_name: str,
    input_type: GraphQLInputType,
    output_type: GraphQLOutputType,
    resolve_single_input: Callable[[GraphQLResolveInfo, str], Any],
    description: str = None,
) -> GraphQLField:
    if isinstance(input_type, GraphQLNonNull):
        input_type = input_type.of_type
    input_args = {
        arg_name: GraphQLArgument(
            GraphQLNonNull(GraphQLList(GraphQLNonNull(input_type)))
        )
    }

    def resolve(_obj, info, **args):
        inputs = args[arg_name]
        return [resolve_single_input(info, input_) for input_ in inputs]

    return GraphQLField(
        GraphQLList(output_type),
        description=description,
        args=input_args,
        resolve=resolve,
    )

from typing import Any, Callable

from graphql.type import (
    GraphQLArgument,
    GraphQLField,
    GraphQLInputType,
    GraphQLOutputType,
    GraphQLList,
    GraphQLNonNull,
    GraphQLResolveInfo,
    is_non_null_type,
)


def plural_identifying_root_field(
    arg_name: str,
    input_type: GraphQLInputType,
    output_type: GraphQLOutputType,
    resolve_single_input: Callable[[GraphQLResolveInfo, str], Any],
    description: str = None,
) -> GraphQLField:
    if is_non_null_type(input_type):
        input_type = input_type.of_type
    input_args = {
        arg_name: GraphQLArgument(
            GraphQLNonNull(GraphQLList(GraphQLNonNull(input_type)))
        )
    }

    def resolve(_obj, info, **args):
        inputs = args[arg_name]
        return [resolve_single_input(info, input_) for input_ in inputs]

    return GraphQLField(
        GraphQLList(output_type),
        description=description,
        args=input_args,
        resolve=resolve,
    )

Use graphql's predicate function instead of 'isinstance'
Use graphql's predicate function instead of 'isinstance'

Replicates graphql/graphql-relay-js@5b428507ef246be7ca3afb3589c410874a57f9bc

  from typing import Any, Callable
  
  from graphql.type import (
      GraphQLArgument,
      GraphQLField,
      GraphQLInputType,
      GraphQLOutputType,
      GraphQLList,
      GraphQLNonNull,
      GraphQLResolveInfo,
+     is_non_null_type,
  )
  
  
  def plural_identifying_root_field(
      arg_name: str,
      input_type: GraphQLInputType,
      output_type: GraphQLOutputType,
      resolve_single_input: Callable[[GraphQLResolveInfo, str], Any],
      description: str = None,
  ) -> GraphQLField:
-     if isinstance(input_type, GraphQLNonNull):
+     if is_non_null_type(input_type):
          input_type = input_type.of_type
      input_args = {
          arg_name: GraphQLArgument(
              GraphQLNonNull(GraphQLList(GraphQLNonNull(input_type)))
          )
      }
  
      def resolve(_obj, info, **args):
          inputs = args[arg_name]
          return [resolve_single_input(info, input_) for input_ in inputs]
  
      return GraphQLField(
          GraphQLList(output_type),
          description=description,
          args=input_args,
          resolve=resolve,
      )
  
Use graphql's predicate function instead of 'isinstance'
## Code Before:
from typing import Any, Callable

from graphql.type import (
    GraphQLArgument,
    GraphQLField,
    GraphQLInputType,
    GraphQLOutputType,
    GraphQLList,
    GraphQLNonNull,
    GraphQLResolveInfo,
)


def plural_identifying_root_field(
    arg_name: str,
    input_type: GraphQLInputType,
    output_type: GraphQLOutputType,
    resolve_single_input: Callable[[GraphQLResolveInfo, str], Any],
    description: str = None,
) -> GraphQLField:
    if isinstance(input_type, GraphQLNonNull):
        input_type = input_type.of_type
    input_args = {
        arg_name: GraphQLArgument(
            GraphQLNonNull(GraphQLList(GraphQLNonNull(input_type)))
        )
    }

    def resolve(_obj, info, **args):
        inputs = args[arg_name]
        return [resolve_single_input(info, input_) for input_ in inputs]

    return GraphQLField(
        GraphQLList(output_type),
        description=description,
        args=input_args,
        resolve=resolve,
    )

## Instruction:
Use graphql's predicate function instead of 'isinstance'
## Code After:
from typing import Any, Callable

from graphql.type import (
    GraphQLArgument,
    GraphQLField,
    GraphQLInputType,
    GraphQLOutputType,
    GraphQLList,
    GraphQLNonNull,
    GraphQLResolveInfo,
    is_non_null_type,
)


def plural_identifying_root_field(
    arg_name: str,
    input_type: GraphQLInputType,
    output_type: GraphQLOutputType,
    resolve_single_input: Callable[[GraphQLResolveInfo, str], Any],
    description: str = None,
) -> GraphQLField:
    if is_non_null_type(input_type):
        input_type = input_type.of_type
    input_args = {
        arg_name: GraphQLArgument(
            GraphQLNonNull(GraphQLList(GraphQLNonNull(input_type)))
        )
    }

    def resolve(_obj, info, **args):
        inputs = args[arg_name]
        return [resolve_single_input(info, input_) for input_ in inputs]

    return GraphQLField(
        GraphQLList(output_type),
        description=description,
        args=input_args,
        resolve=resolve,
    )
