<commit_before>package goriak

import (
	riak "github.com/basho/riak-go-client"
)

// MapOperation takes a riak.MapOperation so that you can run custom commands on your Riak Maps
func (c Command) MapOperation(op riak.MapOperation, context []byte) Command {
	builder := riak.NewUpdateMapCommandBuilder().
		WithBucket(c.bucket).
		WithBucketType(c.bucketType).
		WithMapOperation(&op).
		WithContext(context)

	c.updateMapCommandBuilder = builder
	c.commandType = riakUpdateMapCommand

	return c
}

// NewMapOperation returns a new riak.MapOperation that you can for advanced Riak operations
func NewMapOperation() riak.MapOperation {
	return riak.MapOperation{}
}
<commit_msg>Only set WithContext if a context is provided to MapOperation()<commit_after>package goriak

import (
	riak "github.com/basho/riak-go-client"
)

// MapOperation takes a riak.MapOperation so that you can run custom commands on your Riak Maps
func (c Command) MapOperation(op riak.MapOperation, context []byte) Command {
	builder := riak.NewUpdateMapCommandBuilder().
		WithBucket(c.bucket).
		WithBucketType(c.bucketType).
		WithMapOperation(&op)

	if len(context) != 0 {
		builder.WithContext(context)
	}

	c.updateMapCommandBuilder = builder
	c.commandType = riakUpdateMapCommand

	return c
}

// NewMapOperation returns a new riak.MapOperation that you can for advanced Riak operations
func NewMapOperation() riak.MapOperation {
	return riak.MapOperation{}
}

{'fraction_non_alphanumeric': 0.08907446068197634, 'fraction_numerical': 0.0006958942240779402, 'mean_word_length': 5.01673640167364, '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': '181908', 'n_tokens_mistral': 460, 'n_tokens_neox': 437, 'n_words': 126}