// New settings new a indigo.Generator.
337243
func New(enc Encoder, options ...func(*sonyflake.Settings)) *Generator {
	if enc == nil {
		enc = base58.MustNewEncoder(base58.StdSource())
	}
	s := sonyflake.Settings{}
	for i := range options {
		options[i](&s)
	}
	return &Generator{
		sf:  sonyflake.NewSonyflake(s),
		enc: enc,
	}
}
1304823
func (d *Context) New(nargs int) {
	C.duk_new(d.duk_context, C.duk_idx_t(nargs))
}
653618
func createSettings(db Database, collection, key string, values map[string]interface{}) (*Settings, error) {
	s := newSettings(db, collection, key)
	s.core = copyMap(values, nil)
	ops := []txn.Op{createSettingsOp(collection, key, values)}
	err := s.db.RunTransaction(ops)
	if err == txn.ErrAborted {
		return nil, errSettingsExist
	}
	if err != nil {
		return nil, fmt.Errorf("cannot create settings: %v", err)
	}
	return s, nil
}
682542
func NewConfig() Config {
	cfg := make(Config)
	cfg[Globals] = make(map[GlobalOption]string)
	return cfg
}
776952
func New() *Generator {
	g := new(Generator)
	g.Buffer = new(bytes.Buffer)
	g.Request = new(plugin.CodeGeneratorRequest)
	g.Response = new(plugin.CodeGeneratorResponse)
	g.Suffix = ".pb.go"
	g.writtenImports = make(map[string]bool)
	uniquePackageName = make(map[*descriptor.FileDescriptorProto]string)
	pkgNamesInUse = make(map[string][]*FileDescriptor)
	return g
}
1018561
func New(s Settings) *Client {
	if s.ReadWriteTimeout == time.Duration(0) {
		s.ReadWriteTimeout = DefaultReadWriteTimeout
	}
	return &Client{
		settings: s,
	}
}
1355506
func newGenerators(regexps []*syntax.Regexp, args *GeneratorArgs) ([]*internalGenerator, error) {
	generators := make([]*internalGenerator, len(regexps), len(regexps))
	var err error

	// create a generator for each alternate pattern
	for i, subR := range regexps {
		generators[i], err = newGenerator(subR, args)
		if err != nil {
			return nil, err
		}
	}

	return generators, nil
}
810182
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
	return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
697706
func New(cfg map[config.Set]Files) config.Interface {
	return &memoryImpl{sets: cfg}
}
311228
func New(u *url.URL, settings []vim.BaseOptionValue) (string, http.Handler) {
	for i := range settings {
		setting := settings[i].GetOptionValue()
		if setting.Key == "config.vpxd.sso.sts.uri" {
			endpoint, _ := url.Parse(setting.Value.(string))
			endpoint.Host = u.Host
			setting.Value = endpoint.String()
			settings[i] = setting
			return endpoint.Path, new(handler)
		}
	}
	return "", nil
}
1035715
func New(cfg ...Config) *html.Engine {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}
	// pass the Pug/Jade configs to the html's configuration

	s := html.New(html.Config(c))
	s.Middleware = jade.Parse
	return s
}
999591
func New(version string, config records.Config) *Resolver {
	generatorOptions := []records.Option{
		records.WithConfig(config),
	}
	recordGenerator := records.NewRecordGenerator(generatorOptions...)
	r := &Resolver{
		version: version,
		config:  config,
		ready:   make(chan struct{}),
		rs:      recordGenerator,
		// rand.Sources aren't safe for concurrent use, except the global one.
		// See: https://github.com/golang/go/issues/3611
		rng:              rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}),
		masters:          append([]string{""}, config.Masters...),
		generatorOptions: generatorOptions,
	}

	timeout := 5 * time.Second
	if config.Timeout != 0 {
		timeout = time.Duration(config.Timeout) * time.Second
	}

	r.zoneFwds = make(map[string]exchanger.Forwarder)
	if config.ExternalOn {
		for zone, resolvers := range config.ZoneResolvers {
			r.zoneFwds[zone] = exchanger.NewForwarder(resolvers, exchangers(timeout, "udp", "tcp"))
		}
		r.defaultFwd = exchanger.NewForwarder(
			config.Resolvers, exchangers(timeout, "udp", "tcp"))
	} else {
		r.defaultFwd = exchanger.NewForwarder(
			make([]string, 0), exchangers(timeout, "udp", "tcp"))
	}

	return r
}
1130619
func (g *Generation) Config() map[string]settings.ItemChanges {
	changes := make(map[string]settings.ItemChanges, len(g.doc.Config))
	for appName, appCfg := range g.doc.Config {
		appChanges := make(settings.ItemChanges, len(appCfg))
		for i, ch := range appCfg {
			appChanges[i] = ch.coreChange()
		}
		sort.Sort(appChanges)
		changes[appName] = appChanges
	}
	return changes
}
197839
func NewConfig() *Config {
	return &Config{
		ID:           stringid.GenerateNonCryptoID(),
		StreamConfig: stream.NewConfig(),
		Started:      make(chan struct{}),
	}
}
431237
func New(parsedConfig *Config, manager *plugins.Manager) *Plugin {

	plugin := &Plugin{
		manager:  manager,
		config:   *parsedConfig,
		bundleCh: make(chan bundle.Status),
		discoCh:  make(chan bundle.Status),
		stop:     make(chan chan struct{}),
		reconfig: make(chan interface{}),
	}

	return plugin
}
650773
func New(client docker.Client, config *api.Config) *DockerRunner {
	d := docker.New(client, config.PullAuthentication)
	return &DockerRunner{d}
}
30208
func New(cfg ...Config) *Editor {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}
	c.WorkingDir = validateWorkingDir(c.WorkingDir) // add "/" if not exists

	return &Editor{
		enabled: true,
		config:  &c,
	}
}