<commit_before>package graphql

import (
	"context"
	"fmt"
	"reflect"
)

// Type represents a GraphQL type, and should be either an Object, a Scalar,
// or a List
type Type interface {
	String() string

	// isType() is a no-op used to tag the known values of Type, to prevent
	// arbitrary interface{} from implementing Type
	isType()
}

// Scalar is a leaf value
type Scalar struct {
	Type string
}

func (s *Scalar) isType() {}

func (s *Scalar) String() string {
	return s.Type
}

// Object is a value with several fields
type Object struct {
	Name   string
	Key    *Field
	Fields map[string]*Field
}

func (o *Object) isType() {}

func (o *Object) String() string {
	return o.Name
}

// List is a collection of other values
type List struct {
	Type Type
}

func (s *List) isType() {}

func (s *List) String() string {
	return fmt.Sprintf("[%s]", s.Type)
}

// Verify *Scalar, *Object, and *List implement Type
var _ Type = &Scalar{}
var _ Type = &Object{}
var _ Type = &List{}

// Field knows how to compute field values of an Object
//
// Fields are responsible for computing their value themselves.
type Field struct {
	Name  string
	Index int

	// Resolve calculates the value of the field
	Resolve func(ctx context.Context, source, args interface{}, selectionSet *SelectionSet) (interface{}, error)

	// Type is the type of the field
	Type Type

	// ArgParser parses the args of the field<commit_msg>graphql: define an explicit type for Resolver funcs<commit_after>package graphql

import (
	"context"
	"fmt"
	"reflect"
)

// Type represents a GraphQL type, and should be either an Object, a Scalar,
// or a List
type Type interface {
	String() string

	// isType() is a no-op used to tag the known values of Type, to prevent
	// arbitrary interface{} from implementing Type
	isType()
}

// Scalar is a leaf value
type Scalar struct {
	Type string
}

func (s *Scalar) isType() {}

func (s *Scalar) String() string {
	return s.Type
}

// Object is a value with several fields
type Object struct {
	Name   string
	Key    *Field
	Fields map[string]*Field
}

func (o *Object) isType() {}

func (o *Object) String() string {
	return o.Name
}

// List is a collection of other values
type List struct {
	Type Type
}

func (s *List) isType() {}

func (s *List) String() string {
	return fmt.Sprintf("[%s]", s.Type)
}

// Verify *Scalar, *Object, and *List implement Type
var _ Type = &Scalar{}
var _ Type = &Object{}
var _ Type = &List{}

// A Resolver calculates the value of a field of an object
type Resolver func(ctx context.Context, source, args interface{}, selectionSet *SelectionSet) (interface{}, error)

// Field knows how to compute field values of an Object
//
// Fields are responsible for computing their value themselves.
type Field struct {
	Name  string
	Index int

	Resolve Resolver
	Type    Type

	// ArgParser parses the args of the field
{'fraction_non_alphanumeric': 0.10528156698146204, 'fraction_numerical': 0.0, 'mean_word_length': 3.5396825396825395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '571981', 'n_tokens_mistral': 884, 'n_tokens_neox': 878, 'n_words': 392}