<commit_before>package encoding

import (
	"encoding/json"
	"io"

	"github.com/mesos/mesos-go/encoding/proto"

	pb "github.com/gogo/protobuf/proto"
)

const (
	// ProtobufMediaType is the Protobuf serialization format media type.
	ProtobufMediaType = "application/x-protobuf"
	// JSONMediaType is the JSON serialiation format media type.
	JSONMediaType = "application/json; charset=utf-8"
)

var (
	// ProtobufCodec is the Mesos scheduler API Protobufs codec.
	ProtobufCodec = Codec{
		MediaTypes: [2]string{ProtobufMediaType, ProtobufMediaType},
		NewEncoder: NewProtobufEncoder,
		NewDecoder: NewProtobufDecoder,
	}
	// JSONCodec is the Mesos scheduler API JSON codec.
	JSONCodec = Codec{
		MediaTypes: [2]string{JSONMediaType, JSONMediaType},
		NewEncoder: NewJSONEncoder,
		NewDecoder: NewJSONDecoder,
	}
)

type (
	// A Codec composes encoding and decoding of a serialization format.
	Codec struct {
		// MediaTypes holds the media types of the codec encoding and decoding
		// formats, respectively.
		MediaTypes [2]string
		// NewEncoder returns a new encoder for the defined media type.
		NewEncoder func(io.Writer) Encoder
		// NewDecoder returns a new decoder for the defined media type.
		NewDecoder func(io.Reader) Decoder
	}
	// Marshaler composes the supported marshaling formats.
	Marshaler interface {
		pb.Marshaler
		json.Marshaler
	}
	// Unmarshaler composes the supporter unmarshaling formats.
	Unmarshaler interface {
		pb.Unmarshaler
		json.Unmarshaler
	}<commit_msg>encoding: Add Name field to Codec<commit_after>package encoding

import (
	"encoding/json"
	"io"

	"github.com/mesos/mesos-go/encoding/proto"

	pb "github.com/gogo/protobuf/proto"
)

const (
	// ProtobufMediaType is the Protobuf serialization format media type.
	ProtobufMediaType = "application/x-protobuf"
	// JSONMediaType is the JSON serialiation format media type.
	JSONMediaType = "application/json; charset=utf-8"
)

var (
	// ProtobufCodec is the Mesos scheduler API Protobufs codec.
	ProtobufCodec = Codec{
		Name:       "protobuf",
		MediaTypes: [2]string{ProtobufMediaType, ProtobufMediaType},
		NewEncoder: NewProtobufEncoder,
		NewDecoder: NewProtobufDecoder,
	}
	// JSONCodec is the Mesos scheduler API JSON codec.
	JSONCodec = Codec{
		Name:       "json",
		MediaTypes: [2]string{JSONMediaType, JSONMediaType},
		NewEncoder: NewJSONEncoder,
		NewDecoder: NewJSONDecoder,
	}
)

// A Codec composes encoding and decoding of a serialization format.
type Codec struct {
	// Name holds the codec name.
	Name string
	// MediaTypes holds the media types of the codec encoding and decoding
	// formats, respectively.
	MediaTypes [2]string
	// NewEncoder returns a new encoder for the defined media type.
	NewEncoder func(io.Writer) Encoder
	// NewDecoder returns a new decoder for the defined media type.
	NewDecoder func(io.Reader) Decoder
}

// String implements the fmt.Stringer interface.
func (c *Codec) String() string { return c.Name }

type (
	// Marshaler composes the supported marshaling formats.
	Marshaler interface {
		pb.Marshaler
		json.Marshaler
	}
	// Unmarshaler composes the supporter unmarshaling formats.
	Unmarshaler interface {
		pb.Unmarshaler
		json.Unmarshaler
	}
{'fraction_non_alphanumeric': 0.08286252354048965, 'fraction_numerical': 0.0025109855618330196, 'mean_word_length': 4.140322580645162, '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': '3552605', 'n_tokens_mistral': 1043, 'n_tokens_neox': 977, 'n_words': 307}