<commit_before>package machine

import (
	log "github.com/coreos/fleet/third_party/github.com/golang/glog"

)

// Machine provides the means for a caller to access a relatively
// up-to-date MachineState object.
type Machine struct {
	staticState  MachineState
	dynamicState *MachineState
}

// New creates a new Machine object. The provided state object will override
// those that might be dynamically generated by the Machine on the fly.
func New(static MachineState) *Machine {
	log.V(1).Infof("Created Machine with static state %s", static)
	m := &Machine{staticState: static}
	return m
}

func (m *Machine) String() string {
	return m.State().ID
}

// State returns a MachineState object representing the Machine's
// static state overlaid on its dynamic state at the time of execution.
func (m *Machine) State() (state MachineState) {
	if m.dynamicState == nil {
		state = MachineState(m.staticState)
	} else {
		state = stackState(m.staticState, *m.dynamicState)
	}

	return
}

// RefreshState generates a new MachineState object based on the
// current state of the underlying host, storing it internally for
// future reference before returning it.
func (m *Machine) RefreshState() *MachineState {
	state := CurrentState()
	m.dynamicState = &state
	return &state
}

// HasMetadata determine if the Metadata of a given MachineState
// matches the indicated values.
func HasMetadata(state *MachineState, metadata map[string][]string) bool {
	for key, values := range metadata {
		local, ok := state.Metadata[key]
		if !ok {
			log.V(1).Infof("No local values found for Metadata(%s)", key)
			return false
		}

		log.V(1).Infof("Asserting local Metadata(%s) meets requirements", key)

		var localMatch bool
		for _, val := range values {
			if local == val {
				log.V(1).Infof("Local Metadata(%s) meets requirement", key)
				localMatch = true
			}
		}

		if !localMatch {
			log.V(1).Infof("Local Metadata(%s) does not match requirement", key)
			return false
		}
	}

	return true
}
<commit_msg>refactor(machine): Drop return value from Machine.RefreshState<commit_after>package machine

import (
	log "github.com/coreos/fleet/third_party/github.com/golang/glog"

)

// Machine provides the means for a caller to access a relatively
// up-to-date MachineState object.
type Machine struct {
	staticState  MachineState
	dynamicState *MachineState
}

// New creates a new Machine object. The provided state object will override
// those that might be dynamically generated by the Machine on the fly.
func New(static MachineState) *Machine {
	log.V(1).Infof("Created Machine with static state %s", static)
	m := &Machine{staticState: static}
	return m
}

func (m *Machine) String() string {
	return m.State().ID
}

// State returns a MachineState object representing the Machine's
// static state overlaid on its dynamic state at the time of execution.
func (m *Machine) State() (state MachineState) {
	if m.dynamicState == nil {
		state = MachineState(m.staticState)
	} else {
		state = stackState(m.staticState, *m.dynamicState)
	}

	return
}

// RefreshState generates a new MachineState object based on the
// current state of the underlying host, storing it internally for
// future reference.
func (m *Machine) RefreshState() {
	state := CurrentState()
	m.dynamicState = &state
}

// HasMetadata determine if the Metadata of a given MachineState
// matches the indicated values.
func HasMetadata(state *MachineState, metadata map[string][]string) bool {
	for key, values := range metadata {
		local, ok := state.Metadata[key]
		if !ok {
			log.V(1).Infof("No local values found for Metadata(%s)", key)
			return false
		}

		log.V(1).Infof("Asserting local Metadata(%s) meets requirements", key)

		var localMatch bool
		for _, val := range values {
			if local == val {
				log.V(1).Infof("Local Metadata(%s) meets requirement", key)
				localMatch = true
			}
		}

		if !localMatch {
			log.V(1).Infof("Local Metadata(%s) does not match requirement", key)
			return false
		}
	}

	return true
}

{'fraction_non_alphanumeric': 0.10528942115768464, 'fraction_numerical': 0.00249500998003992, 'mean_word_length': 3.9616336633663365, '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': '3579555', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1185, 'n_words': 435}