<commit_before>package juju

import (
	"fmt"
	"os"
)

// Conn represents a connection to a juju environment.
type Conn struct {
	env  Environ // the instantiated environment.
	kind string  // the environment provider type.
}

// New returns a new Conn using the named environment.
// If name is empty, the default environment will be used.
func (envs *Environs) New(name string) (*Conn, os.Error) {
	if name == "" {
		name = envs.Default
		if name == "" {
			return nil, fmt.Errorf("no default environment found")
		}
	}
	e, ok := envs.environs[name]
	if !ok {
		return nil, fmt.Errorf("unknown environment %q", name)
	}
	if e.err != nil {
		return nil, e.err
	}
	penv, err := providers[e.kind].NewEnviron(name, e.config)
	if err != nil {
		return nil, fmt.Errorf("cannot initialize environment %q: %v", name, err)
	}
	return &Conn{
		env:  penv,
		kind: e.kind,
	}, nil
}

// Environ returns the environment used by the Conn.
// It can be used to subvert juju methods, so care is
// required in using it.
func (c *Conn) Environ() Environ {
	return c.env
}

// Bootstrap bootstraps a juju environment for the first time.
func (c *Conn) Bootstrap() os.Error {
	if err := c.env.Bootstrap(); err != nil {<commit_msg>remove unnecessary kind field from Conn.<commit_after>package juju

import (
	"fmt"
	"os"
)

// Conn represents a connection to a juju environment.
type Conn struct {
	env Environ // the instantiated environment.
}

// New returns a new Conn using the named environment.
// If name is empty, the default environment will be used.
func (envs *Environs) New(name string) (*Conn, os.Error) {
	if name == "" {
		name = envs.Default
		if name == "" {
			return nil, fmt.Errorf("no default environment found")
		}
	}
	e, ok := envs.environs[name]
	if !ok {
		return nil, fmt.Errorf("unknown environment %q", name)
	}
	if e.err != nil {
		return nil, e.err
	}
	penv, err := providers[e.kind].NewEnviron(name, e.config)
	if err != nil {
		return nil, fmt.Errorf("cannot initialize environment %q: %v", name, err)
	}
	return &Conn{
		env: penv,
	}, nil
}

// Environ returns the environment used by the Conn.
// It can be used to subvert juju methods, so care is
// required in using it.
func (c *Conn) Environ() Environ {
	return c.env
}

// Bootstrap bootstraps a juju environment for the first time.
func (c *Conn) Bootstrap() os.Error {
	if err := c.env.Bootstrap(); err != nil {
{'fraction_non_alphanumeric': 0.12777545035609553, 'fraction_numerical': 0.0, 'mean_word_length': 3.341818181818182, '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': '4063462', 'n_tokens_mistral': 835, 'n_tokens_neox': 798, 'n_words': 305}