<commit_before>package soap

import (
	"encoding/base64"
	"encoding/hex"
	"errors"
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"time"
	"unicode/utf8"
)

var (
	// localLoc acts like time.Local for this package, but is faked out by the
	// unit tests to ensure that things stay constant (especially when running
	// this test in a place where local time is UTC which might mask bugs).
	localLoc = time.Local
)

func MarshalUi1(v uint8) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi1(s string) (uint8, error) {
	v, err := strconv.ParseUint(s, 10, 8)
	return uint8(v), err
}

func MarshalUi2(v uint16) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi2(s string) (uint16, error) {
	v, err := strconv.ParseUint(s, 10, 16)
	return uint16(v), err
}

func MarshalUi4(v uint32) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi4(s string) (uint32, error) {
	v, err := strconv.ParseUint(s, 10, 32)
	return uint32(v), err
}

func MarshalI1(v int8) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI1(s string) (int8, error) {
	v, err := strconv.ParseInt(s, 10, 8)
	return int8(v), err
}

func MarshalI2(v int16) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI2(s string) (int16, error) {
	v, err := strconv.ParseInt(s, 10, 16)
	return int16(v), err
}

func MarshalI4(v int32) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI4(s string) (int32, error) {
	v, err := strconv.ParseInt(s, 10, 32)
	return int32(v), err
}

func MarshalInt(v int64) (string, error) {
	return strconv.FormatInt(v, 10), nil
}

func UnmarshalInt(s string) (int64, error) {
	return strconv.ParseInt(s, 10, 64)
}

// MarshalFixed14_4 marshals float64 to SOAP "fixed.14.4" type.
func MarshalFixed14_4(v float64) (string, error) {
	if v >= 1e14 || v <= -1e14 {
		return "", fmt.Errorf("soap fixed14.4: value %v out of bounds", v)
	}
	return strconv.FormatFloat(v, 'f', 4, 64), nil
}

// UnmarshalFixed14_4 unmarshals float64 from SOAP "fixed.14.4" type.
func UnmarshalFixed14_4(s string) (float64, error) {
	v, err := strconv.ParseFloat(s, 64)
	if err != nil {
		return 0, err<commit_msg>Add (untested) r4 and r8 type marshalling implementations.<commit_after>package soap

import (
	"encoding/base64"
	"encoding/hex"
	"errors"
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"time"
	"unicode/utf8"
)

var (
	// localLoc acts like time.Local for this package, but is faked out by the
	// unit tests to ensure that things stay constant (especially when running
	// this test in a place where local time is UTC which might mask bugs).
	localLoc = time.Local
)

func MarshalUi1(v uint8) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi1(s string) (uint8, error) {
	v, err := strconv.ParseUint(s, 10, 8)
	return uint8(v), err
}

func MarshalUi2(v uint16) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi2(s string) (uint16, error) {
	v, err := strconv.ParseUint(s, 10, 16)
	return uint16(v), err
}

func MarshalUi4(v uint32) (string, error) {
	return strconv.FormatUint(uint64(v), 10), nil
}

func UnmarshalUi4(s string) (uint32, error) {
	v, err := strconv.ParseUint(s, 10, 32)
	return uint32(v), err
}

func MarshalI1(v int8) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI1(s string) (int8, error) {
	v, err := strconv.ParseInt(s, 10, 8)
	return int8(v), err
}

func MarshalI2(v int16) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI2(s string) (int16, error) {
	v, err := strconv.ParseInt(s, 10, 16)
	return int16(v), err
}

func MarshalI4(v int32) (string, error) {
	return strconv.FormatInt(int64(v), 10), nil
}

func UnmarshalI4(s string) (int32, error) {
	v, err := strconv.ParseInt(s, 10, 32)
	return int32(v), err
}

func MarshalInt(v int64) (string, error) {
	return strconv.FormatInt(v, 10), nil
}

func UnmarshalInt(s string) (int64, error) {
	return strconv.ParseInt(s, 10, 64)
}

func MarshalR4(v float32) (string, error) {
	return strconv.FormatFloat(float64(v), 'G', -1, 32), nil
}

func UnmarshalR4(s string) (float32, error) {
	v, err := strconv.ParseFloat(s, 32)
	return float32(v), err
}

func MarshalR8(v float64) (string, error) {
	return strconv.FormatFloat(v, 'G', -1, 64), nil
}

func UnmarshalR8(s string) (float64, error) {
	v, err := strconv.ParseFloat(s, 64)
	return float64(v), err
}

// MarshalFixed14_4 marshals float64 to SOAP "fixed.14.4" type.
func MarshalFixed14_4(v float64) (string, error) {
	if v >= 1e14 || v <= -1e14 {
		return "", fmt.Errorf("soap fixed14.4: value %v out of bounds", v)
	}
	return strconv.FormatFloat(v, 'f', 4, 64), nil
}

// UnmarshalFixed14_4 unmarshals float64 from SOAP "fixed.14.4" type.
func UnmarshalFixed14_4(s string) (float64, error) {
	v, err := strconv.ParseFloat(s, 64)
	if err != nil {
		return 0, err
{'fraction_non_alphanumeric': 0.1455900120821587, 'fraction_numerical': 0.06322996375352397, 'mean_word_length': 4.476295479603087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4959092', 'n_tokens_mistral': 2159, 'n_tokens_neox': 1948, 'n_words': 566}