// New initializes a JavaScript interpreted runtime environment and sets defaults
// with the config struct.
177115
func New(config Config) (*Console, error) {
	// Handle unset config values gracefully
	if config.Prompter == nil {
		config.Prompter = Stdin
	}
	if config.Prompt == "" {
		config.Prompt = DefaultPrompt
	}
	if config.Printer == nil {
		config.Printer = colorable.NewColorableStdout()
	}
	// Initialize the console and return
	console := &Console{
		client:   config.Client,
		jsre:     jsre.New(config.DocRoot, config.Printer),
		prompt:   config.Prompt,
		prompter: config.Prompter,
		printer:  config.Printer,
		histPath: filepath.Join(config.DataDir, HistoryFile),
	}
	if err := os.MkdirAll(config.DataDir, 0700); err != nil {
		return nil, err
	}
	if err := console.init(config.Preload); err != nil {
		return nil, err
	}
	return console, nil
}
1175107
func (l *Logger) New(ctx *gear.Context) (interface{}, error) {
	log := Log{}
	l.init(log, ctx)
	return log, nil
}
936048
func New(exec utilexec.Interface) Interface {
	runner := &runner{
		exec: exec,
	}
	return runner
}
177722
func New(config *Config) log.Logger {
	var l log.Logger
	if config.Format.s == "logfmt" {
		l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
	} else {
		l = log.NewJSONLogger(log.NewSyncWriter(os.Stderr))
	}

	l = level.NewFilter(l, config.Level.o)
	l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller)
	return l
}
340129
func New(global interface{}, localPath string, flag interface{}) (_ interface{}, err error) {
	// Local config
	if localPath != "" {
		if _, err = toml.DecodeFile(localPath, global); err != nil {
			err = errors.Wrapf(err, "asticonfig: toml decoding %s failed", localPath)
			return
		}
	}

	// Merge configs
	if err = mergo.Merge(flag, global); err != nil {
		err = errors.Wrap(err, "asticonfig: merging configs failed")
		return
	}
	return flag, nil
}
897677
func (f FileSystemJSONLoaderFactory) New(source string) JSONLoader {
	return &jsonReferenceLoader{
		fs:     f.fs,
		source: source,
	}
}
916407
func New(c context.Context) *DatabaseSettings {
	return &DatabaseSettings{
		Server:   "",
		Username: "",
		Password: "",
		Database: "",
	}
}
987906
func New(options ...Option) (*INI, error) {
	ini := &INI{}
	for _, option := range options {
		if err := option(ini); err != nil {
			return nil, err
		}
	}

	if len(ini.comment) == 0 {
		ini.comment = []byte(DefaultComment)
	}
	if ini.sliceSep == 0 {
		ini.sliceSep = DefaultSliceSeparator
	}
	if ini.mapkeySep == 0 {
		ini.mapkeySep = DefaultMapKeySeparator
	}

	return ini, nil
}
697706
func New(cfg map[config.Set]Files) config.Interface {
	return &memoryImpl{sets: cfg}
}
573953
func New(cfg ...Config) *Service {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}
	r := &Service{pool: &redis.Pool{}, Config: &c}
	return r
}
433954
func New(config *runtime.Unknown, _ framework.FrameworkHandle) (framework.Plugin, error) {
	if config == nil {
		klog.Error("MultipointExample configuration cannot be empty")
		return nil, fmt.Errorf("MultipointExample configuration cannot be empty")
	}
	mp := MultipointExample{
		mpState: make(map[int]string),
	}
	return &mp, nil
}
675353
func (d DefaultJSONLoaderFactory) New(source string) JSONLoader {
	return &jsonReferenceLoader{
		fs:     osFS,
		source: source,
	}
}
1366377
func New(path string) (*Framework, error) {
	conf, err := config.NewConfig(path)
	if err != nil {
		return nil, err
	}

	return NewWithConfig(conf)
}
664719
func New() *DefaultLoader {
	loader := MultiLoader(
		&TagLoader{},
		&EnvironmentLoader{},
		&FlagLoader{},
	)

	d := &DefaultLoader{}
	d.Loader = loader
	d.Validator = MultiValidator(&RequiredValidator{})
	return d
}
1022625
func (s *ElasticRuntimeBuilder) New(tileSpec tileregistry.TileSpec) (elasticRuntimeCloser tileregistry.TileCloser, err error) {
	var (
		installationSettings io.Reader
		tmpfile              *TempFile
		sshKey               = ""
	)
	if tmpfile, err = NewTempFile(opsmanager.OpsMgrInstallationSettingsFilename); err == nil {

		if installationSettings, err = GetInstallationSettings(tileSpec); err == nil {
			io.Copy(tmpfile.FileRef, installationSettings)
			config := cfbackup.NewConfigurationParser(tmpfile.FileRef.Name())

			if iaas, hasKey := config.GetIaaS(); hasKey {
				sshKey = iaas.SSHPrivateKey
			}
			elasticRuntime := NewElasticRuntime(tmpfile.FileRef.Name(), tileSpec.ArchiveDirectory, sshKey, tileSpec.CryptKey, tileSpec.NFS)
			elasticRuntimeCloser = struct {
				tileregistry.Tile
				tileregistry.Closer
			}{
				elasticRuntime,
				tmpfile,
			}
		}
	}
	return
}
113572
func New(cfg *spotinst.Config) *Client {
	if cfg == nil {
		cfg = spotinst.DefaultConfig()
	}
	return &Client{cfg}
}
1229887
func New(i interface{}) *Nulls {
	if _, ok := i.(nullable); !ok {
		return nil
	}
	return &Nulls{Value: i}
}