<commit_before>package models

import "encoding/json"

type TransitionalLRPState int

const (
	TransitionalLRPStateInvalid TransitionalLRPState = iota
	TransitionalLRPStateDesired
	TransitionalLRPStateRunning
)

type TransitionalLongRunningProcess struct {
	Guid     string               `json:"guid"`
	Stack    string               `json:"stack"`
	Actions  []ExecutorAction     `json:"actions"`
	Log      LogConfig            `json:"log"`
	State    TransitionalLRPState `json:"state"`
	MemoryMB int                  `json:"memory_mb"`
	DiskMB   int                  `json:"disk_mb"`
	Ports    []PortMapping        `json:"ports"`
}

type PortMapping struct {
	ContainerPort int `json:"container_port"`
	HostPort      int `json:"host_port,omitempty"`
}

func NewTransitionalLongRunningProcessFromJSON(payload []byte) (TransitionalLongRunningProcess, error) {
	var task TransitionalLongRunningProcess

	err := json.Unmarshal(payload, &task)
	if err != nil {
		return TransitionalLongRunningProcess{}, err
	}

	return task, nil
}

func (self TransitionalLongRunningProcess) ToJSON() []byte {
	bytes, err := json.Marshal(self)
	if err != nil {
		panic(err)
	}

	return bytes
}

///
<commit_msg>int=>uint32 for ports<commit_after>package models

import "encoding/json"

type TransitionalLRPState int

const (
	TransitionalLRPStateInvalid TransitionalLRPState = iota
	TransitionalLRPStateDesired
	TransitionalLRPStateRunning
)

type TransitionalLongRunningProcess struct {
	Guid     string               `json:"guid"`
	Stack    string               `json:"stack"`
	Actions  []ExecutorAction     `json:"actions"`
	Log      LogConfig            `json:"log"`
	State    TransitionalLRPState `json:"state"`
	MemoryMB int                  `json:"memory_mb"`
	DiskMB   int                  `json:"disk_mb"`
	Ports    []PortMapping        `json:"ports"`
}

type PortMapping struct {
	ContainerPort uint32 `json:"container_port"`
	HostPort      uint32 `json:"host_port,omitempty"`
}

func NewTransitionalLongRunningProcessFromJSON(payload []byte) (TransitionalLongRunningProcess, error) {
	var task TransitionalLongRunningProcess

	err := json.Unmarshal(payload, &task)
	if err != nil {
		return TransitionalLongRunningProcess{}, err
	}

	return task, nil
}

func (self TransitionalLongRunningProcess) ToJSON() []byte {
	bytes, err := json.Marshal(self)
	if err != nil {
		panic(err)
	}

	return bytes
}

///

{'fraction_non_alphanumeric': 0.09690893901420217, 'fraction_numerical': 0.002506265664160401, 'mean_word_length': 3.650485436893204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7224158', 'n_tokens_mistral': 721, 'n_tokens_neox': 701, 'n_words': 168}