<commit_before>package encoding

import (
	"encoding/binary"
	"io"
)

// Write writes an item to the Writer.
func Write(w io.Writer, item interface{}) (int64, error) {
	if wt, ok := item.(io.WriterTo); ok {
		return wt.WriteTo(w)
	}

	err := binary.Write(w, binary.BigEndian, item)
	if err != nil {
		return 0, err
	}

	return int64(binary.Size(item)), nil
}

// WriteSome writes multiple items to the Writer.
func WriteSome(w io.Writer, items ...interface{}) (n int64, err error) {
	for _, item := range items {
		len, err := Write(w, item)
		n += len
		if err != nil {
			return n, err
		}
	}

	return
}

// Read reads an item from the Reader.
func Read(r io.Reader, item interface{}) (int64, error) {
	if rf, ok := item.(io.ReaderFrom); ok {
		return rf.ReadFrom(r)
	}

	err := binary.Read(r, binary.BigEndian, item)
	if err != nil {
		return 0, err
	}

	return int64(binary.Size(item)), nil
}

// ReadSome reads multiple items from the Reader.
func ReadSome(r io.Reader, items ...interface{}) (n int64, err error) {
	for item := range items {
		len, err := Read(r, item)
		n += len
		if err != nil {
			return n, err<commit_msg>Fix ReadSome<commit_after>package encoding

import (
	"encoding/binary"
	"io"
)

// Write writes an item to the Writer.
func Write(w io.Writer, item interface{}) (int64, error) {
	if wt, ok := item.(io.WriterTo); ok {
		return wt.WriteTo(w)
	}

	err := binary.Write(w, binary.BigEndian, item)
	if err != nil {
		return 0, err
	}

	return int64(binary.Size(item)), nil
}

// WriteSome writes multiple items to the Writer.
func WriteSome(w io.Writer, items ...interface{}) (n int64, err error) {
	for _, item := range items {
		len, err := Write(w, item)
		n += len
		if err != nil {
			return n, err
		}
	}

	return
}

// Read reads an item from the Reader.
func Read(r io.Reader, item interface{}) (int64, error) {
	if rf, ok := item.(io.ReaderFrom); ok {
		return rf.ReadFrom(r)
	}

	err := binary.Read(r, binary.BigEndian, item)
	if err != nil {
		return 0, err
	}

	return int64(binary.Size(item)), nil
}

// ReadSome reads multiple items from the Reader.
func ReadSome(r io.Reader, items ...interface{}) (n int64, err error) {
	for _, item := range items {
		len, err := Read(r, item)
		n += len
		if err != nil {
			return n, err
{'fraction_non_alphanumeric': 0.14872021182700795, 'fraction_numerical': 0.01235657546337158, 'mean_word_length': 3.174953959484346, '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': '4082947', 'n_tokens_mistral': 876, 'n_tokens_neox': 811, 'n_words': 276}