<commit_before>package main

import (
	"context"
	"fmt"
	"io"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"github.com/pkg/errors"
	"gopkg.in/lxc/go-lxc.v2"
	"gopkg.in/robfig/cron.v2"

	"github.com/flosch/pongo2"
	"github.com/lxc/lxd/lxd/cluster"
	"github.com/lxc/lxd/lxd/db"
	"github.com/lxc/lxd/lxd/device"
	"github.com/lxc/lxd/lxd/device/config"
	"github.com/lxc/lxd/lxd/state"
	"github.com/lxc/lxd/lxd/sys"
	"github.com/lxc/lxd/lxd/task"
	"github.com/lxc/lxd/shared"
	"github.com/lxc/lxd/shared/api"
	"github.com/lxc/lxd/shared/idmap"
	"github.com/lxc/lxd/shared/ioprogress"
	log "github.com/lxc/lxd/shared/log15"
	"github.com/lxc/lxd/shared/logger"
	"github.com/lxc/lxd/shared/osarch"
	"github.com/lxc/lxd/shared/units"
)

func init() {
	// Expose containerLoadNodeAll to the device package converting the response to a slice of InstanceIdentifiers.
	// This is because container types are defined in the main package and are not importable.
	device.InstanceLoadNodeAll = func(s *state.State) ([]device.InstanceIdentifier, error) {
		containers, err := containerLoadNodeAll(s)
		if err != nil {
			return nil, err
		}

		identifiers := []device.InstanceIdentifier{}
		for _, v := range containers {
			identifiers = append(identifiers, device.InstanceIdentifier(v))
		}

		return identifiers, nil
	}
}

// Helper functions<commit_msg>container: Adds access to containerLoadByProjectAndName function from device package<commit_after>package main

import (
	"context"
	"fmt"
	"io"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"github.com/pkg/errors"
	"gopkg.in/lxc/go-lxc.v2"
	"gopkg.in/robfig/cron.v2"

	"github.com/flosch/pongo2"
	"github.com/lxc/lxd/lxd/cluster"
	"github.com/lxc/lxd/lxd/db"
	"github.com/lxc/lxd/lxd/device"
	"github.com/lxc/lxd/lxd/device/config"
	"github.com/lxc/lxd/lxd/state"
	"github.com/lxc/lxd/lxd/sys"
	"github.com/lxc/lxd/lxd/task"
	"github.com/lxc/lxd/shared"
	"github.com/lxc/lxd/shared/api"
	"github.com/lxc/lxd/shared/idmap"
	"github.com/lxc/lxd/shared/ioprogress"
	log "github.com/lxc/lxd/shared/log15"
	"github.com/lxc/lxd/shared/logger"
	"github.com/lxc/lxd/shared/osarch"
	"github.com/lxc/lxd/shared/units"
)

func init() {
	// Expose containerLoadNodeAll to the device package converting the response to a slice of InstanceIdentifiers.
	// This is because container types are defined in the main package and are not importable.
	device.InstanceLoadNodeAll = func(s *state.State) ([]device.InstanceIdentifier, error) {
		containers, err := containerLoadNodeAll(s)
		if err != nil {
			return nil, err
		}

		identifiers := []device.InstanceIdentifier{}
		for _, v := range containers {
			identifiers = append(identifiers, device.InstanceIdentifier(v))
		}

		return identifiers, nil
	}

	// Expose containerLoadByProjectAndName to the device package converting the response to an InstanceIdentifier.
	// This is because container types are defined in the main package and are not importable.
	device.InstanceLoadByProjectAndName = func(s *state.State, project, name string) (device.InstanceIdentifier, error) {
		container, err := containerLoadByProjectAndName(s, project, name)
		if err != nil {
			return nil, err
		}

		return device.InstanceIdentifier(container), nil
	}
}

// Helper functions
{'fraction_non_alphanumeric': 0.13871951219512196, 'fraction_numerical': 0.003048780487804878, 'mean_word_length': 4.110591900311526, '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': '5127286', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1269, 'n_words': 238}