// NewExposeDevToolsProtocolArgs initializes ExposeDevToolsProtocolArgs with the required arguments.
973228
func NewExposeDevToolsProtocolArgs(targetID ID) *ExposeDevToolsProtocolArgs {
	args := new(ExposeDevToolsProtocolArgs)
	args.TargetID = targetID
	return args
}
1317079
func NewTemplater(templatesPath, layoutsPath, ext string) (t *Templater, err error) {
	// Create templater
	t = &Templater{templates: make(map[string]*template.Template)}

	// Get layouts
	if err = filepath.Walk(layoutsPath, func(path string, info os.FileInfo, e error) (err error) {
		// Check input error
		if e != nil {
			err = errors.Wrapf(e, "astitemplate: walking layouts has an input error for path %s", path)
			return
		}

		// Only process files
		if info.IsDir() {
			return
		}

		// Check extension
		if ext != "" && filepath.Ext(path) != ext {
			return
		}

		// Append
		t.layouts = append(t.layouts, path)
		return
	}); err != nil {
		err = errors.Wrapf(err, "astitemplate: walking layouts in %s failed", layoutsPath)
		return
	}

	// Loop through templates
	if err = filepath.Walk(templatesPath, func(path string, info os.FileInfo, e error) (err error) {
		// Check input error
		if e != nil {
			err = errors.Wrapf(e, "astitemplate: walking templates has an input error for path %s", path)
			return
		}

		// Only process files
		if info.IsDir() {
			return
		}

		// Check extension
		if ext != "" && filepath.Ext(path) != ext {
			return
		}

		// Read file
		var b []byte
		if b, err = ioutil.ReadFile(path); err != nil {
			err = errors.Wrapf(err, "astitemplate: reading template content of %s failed", path)
			return
		}

		// Add template
		// We use ToSlash to homogenize Windows path
		if err = t.Add(filepath.ToSlash(strings.TrimPrefix(path, templatesPath)), string(b)); err != nil {
			err = errors.Wrap(err, "astitemplate: adding template failed")
			return
		}
		return
	}); err != nil {
		err = errors.Wrapf(err, "astitemplate: walking templates in %s failed", templatesPath)
		return
	}
	return
}
1253359
func AddAllExposedPodEdges(g osgraph.MutableUniqueGraph) {
	for _, node := range g.(graph.Graph).Nodes() {
		if serviceNode, ok := node.(*kubegraph.ServiceNode); ok {
			AddExposedPodEdges(g, serviceNode)
		}
	}
}
1341600
func NewOvsMap(goMap interface{}) (*OvsMap, error) {
	v := reflect.ValueOf(goMap)
	if v.Kind() != reflect.Map {
		return nil, errors.New("OvsMap supports only Go Map types")
	}

	genMap := make(map[interface{}]interface{})
	keys := v.MapKeys()
	for _, key := range keys {
		genMap[key.Interface()] = v.MapIndex(key).Interface()
	}
	return &OvsMap{genMap}, nil
}
726527
func NewExternalFacade(context facade.Context) (*Facade, error) {
	st := context.State()
	auth := context.Auth()

	m, err := st.Model()
	if err != nil {
		return nil, err
	}

	claimer, err := context.SingularClaimer()
	if err != nil {
		return nil, errors.Trace(err)
	}

	backend := getBackend(st, m.ModelTag())
	return NewFacade(backend, claimer, auth)
}
1009143
func NewProfileSnapshotArgs(snapshotID SnapshotID) *ProfileSnapshotArgs {
	args := new(ProfileSnapshotArgs)
	args.SnapshotID = snapshotID
	return args
}
565374
func NewPropArg(genResult *GenResult, shrinks int, value, origValue interface{}) *PropArg {
	return &PropArg{
		Label:   strings.Join(genResult.Labels, ", "),
		Arg:     value,
		OrigArg: origValue,
		Shrinks: shrinks,
	}
}
357583
func NewComponentExtraArgs(opts util.ExtraOptionSlice, version semver.Version, featureGates string) ([]ComponentExtraArgs, error) {
	var kubeadmExtraArgs []ComponentExtraArgs
	for _, extraOpt := range opts {
		if _, ok := componentToKubeadmConfigKey[extraOpt.Component]; !ok {
			return nil, fmt.Errorf("Unknown component %s.  Valid components and kubeadm config are %v", componentToKubeadmConfigKey, componentToKubeadmConfigKey)
		}
	}

	keys := []string{}
	for k := range componentToKubeadmConfigKey {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	for _, component := range keys {
		kubeadmComponentKey := componentToKubeadmConfigKey[component]
		if kubeadmComponentKey == "" {
			continue
		}
		extraConfig, err := ExtraConfigForComponent(component, opts, version)
		if err != nil {
			return nil, errors.Wrapf(err, "getting kubeadm extra args for %s", component)
		}
		if featureGates != "" {
			extraConfig["feature-gates"] = featureGates
		}
		if len(extraConfig) > 0 {
			kubeadmExtraArgs = append(kubeadmExtraArgs, ComponentExtraArgs{
				Component: kubeadmComponentKey,
				Options:   extraConfig,
			})
		}
	}

	return kubeadmExtraArgs, nil
}
349322
func newExprIterFromGroupExpr(expr *GroupExpr, p *Pattern) *ExprIter {
	if len(p.Children) != len(expr.Children) {
		return nil
	}

	iter := &ExprIter{Operand: p.Operand, matched: true}
	for i := range p.Children {
		childIter := newExprIterFromGroup(expr.Children[i], p.Children[i])
		if childIter == nil {
			return nil
		}
		iter.Children = append(iter.Children, childIter)
	}
	return iter
}
572521
func NewSetAttributesAsTextArgs(nodeID NodeID, text string) *SetAttributesAsTextArgs {
	args := new(SetAttributesAsTextArgs)
	args.NodeID = nodeID
	args.Text = text
	return args
}
456523
func (window *Window) VulkanGetInstanceExtensions() []string {
	var count C.uint
	C.SDL_Vulkan_GetInstanceExtensions(window.cptr(), &count, nil)
	if count == 0 {
		return nil
	}

	strptrs := make([]*C.char, uint(count))
	C.SDL_Vulkan_GetInstanceExtensions(window.cptr(), &count, &strptrs[0])
	extensions := make([]string, uint(count))
	for i := range strptrs {
		extensions[i] = C.GoString(strptrs[i])
	}
	return extensions
}
478433
func newValueExpr(value interface{}) ast.ValueExpr {
	if ve, ok := value.(*ValueExpr); ok {
		return ve
	}
	ve := &ValueExpr{}
	ve.SetValue(value)
	types.DefaultTypeForValue(value, &ve.Type)
	ve.projectionOffset = -1
	return ve
}
43795
func NewCameraUploadsPolicyChangedDetails(NewValue *CameraUploadsPolicy, PreviousValue *CameraUploadsPolicy) *CameraUploadsPolicyChangedDetails {
	s := new(CameraUploadsPolicyChangedDetails)
	s.NewValue = NewValue
	s.PreviousValue = PreviousValue
	return s
}
689294
func (a *CallFunctionOnArgs) SetGeneratePreview(generatePreview bool) *CallFunctionOnArgs {
	a.GeneratePreview = &generatePreview
	return a
}
302355
func NewDisposeBrowserContextArgs(browserContextID BrowserContextID) *DisposeBrowserContextArgs {
	args := new(DisposeBrowserContextArgs)
	args.BrowserContextID = browserContextID
	return args
}
987018
func NewExternalLXDProfileAPI(
	st *state.State,
	resources facade.Resources,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger loggo.Logger,
) *LXDProfileAPI {
	return NewLXDProfileAPI(
		LXDProfileState{st},
		resources,
		authorizer,
		accessUnit,
		logger,
	)
}
184117
func AddInputEdges(g osgraph.MutableUniqueGraph, node *buildgraph.BuildConfigNode) {
	if in := buildgraph.EnsureSourceRepositoryNode(g, node.BuildConfig.Spec.Source); in != nil {
		g.AddEdge(in, node, BuildInputEdgeKind)
	}
	inputImage := buildutil.GetInputReference(node.BuildConfig.Spec.Strategy)
	if input := imageRefNode(g, inputImage, node.BuildConfig); input != nil {
		g.AddEdge(input, node, BuildInputImageEdgeKind)
	}
}