// ShouldCreateMissedLookup implements the Node interface for
// specialFileNode.
172113
func (sfn *specialFileNode) ShouldCreateMissedLookup(
	ctx context.Context, name string) (
	bool, context.Context, data.EntryType, os.FileInfo, string) {
	if !perTlfWrappedNodeNames[name] {
		return sfn.Node.ShouldCreateMissedLookup(ctx, name)
	}

	switch name {
	case StatusFileName:
		sfn := &statusFileNode{
			Node:   nil,
			fb:     sfn.GetFolderBranch(),
			config: sfn.config,
			log:    sfn.log,
		}
		f := sfn.GetFile(ctx)
		return true, ctx, data.FakeFile, f.(*wrappedReadFile).GetInfo(), ""
	default:
		panic(fmt.Sprintf("Name %s was in map, but not in switch", name))
	}

}
1296516
func (l *WorkItemLink) CheckValidForCreation() error {
	if uuid.Equal(l.LinkTypeID, uuid.Nil) {
		return errors.NewBadParameterError("link_type_id", l.LinkTypeID)
	}
	return nil
}
559244
func (pi *pinentryInstance) shouldStoreSecret(info pinentrySecretStoreInfo) bool {
	if len(info) == 0 {
		return false
	}

	// We just want to know when the user did check the "Save in
	// Keychain" checkbox, so remove whatever pinentry put into
	// the keychain, and infer the state of the checkbox from the
	// error (since there will be no error if an entry was found
	// and deleted).
	//
	// This is a bit of a hack -- this may cause a dialog to pop
	// up saying that the client wants to access the user's
	// keychain. But this will do for now until we write our own
	// pinentry.
	query := keychain.NewItem()
	query.SetSecClass(keychain.SecClassGenericPassword)
	query.SetService(pinentryServiceName)
	query.SetAccount(string(info))
	query.SetMatchLimit(keychain.MatchLimitOne)

	// We need to query and delete by item reference because the
	// OSX keychain API only allows us to delete unowned items
	// this way.
	query.SetReturnRef(true)
	ref, err := keychain.QueryItemRef(query)
	if err != nil {
		// Default to false if there was an error.
		return false
	}
	if ref == 0 {
		// If not found, return false.
		return false
	}

	defer keychain.Release(ref)

	err = keychain.DeleteItemRef(ref)
	if err != nil {
		// Default to false if there was an error deleting.
		return false
	}

	// Entry was found and deleted.
	return true
}
593464
func (opt *Options) fillMissing() {
	if opt.PackageName == "" {
		opt.PackageName = "main"
	}
	if opt.VariableName == "" {
		opt.VariableName = "assets"
	}
	if opt.Filename == "" {
		opt.Filename = fmt.Sprintf("%s_vfsdata.go", strings.ToLower(opt.VariableName))
	}
	if opt.VariableComment == "" {
		opt.VariableComment = fmt.Sprintf("%s statically implements the virtual filesystem provided to vfsgen.", opt.VariableName)
	}
}
665926
func (_m *MissingPvtDataTracker) GetMissingPvtDataInfoForMostRecentBlocks(maxBlocks int) (ledger.MissingPvtDataInfo, error) {
	ret := _m.Called(maxBlocks)

	var r0 ledger.MissingPvtDataInfo
	if rf, ok := ret.Get(0).(func(int) ledger.MissingPvtDataInfo); ok {
		r0 = rf(maxBlocks)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(ledger.MissingPvtDataInfo)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(int) error); ok {
		r1 = rf(maxBlocks)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1008198
func (p *GoTemplatePrinter) AllowMissingKeys(allow bool) {
	if allow {
		p.template.Option("missingkey=default")
	} else {
		p.template.Option("missingkey=error")
	}
}
1138150
func RunOptionalJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.ClusterConfiguration, ignorePreflightErrors sets.String) error {
	checks := []Checker{}

	// Check if IVPS kube-proxy mode is supported
	if cfg.ComponentConfigs.KubeProxy != nil && cfg.ComponentConfigs.KubeProxy.Mode == ipvsutil.IPVSProxyMode {
		checks = append(checks, IPVSProxierCheck{exec: execer})
	}

	return RunChecks(checks, os.Stderr, ignorePreflightErrors)
}
1085544
func checkNodeAffinity(og *operationGenerator, volumeToMount VolumeToMount) error {
	if !utilfeature.DefaultFeatureGate.Enabled(features.PersistentLocalVolumes) {
		return nil
	}

	pv := volumeToMount.VolumeSpec.PersistentVolume
	if pv != nil {
		nodeLabels, err := og.volumePluginMgr.Host.GetNodeLabels()
		if err != nil {
			return err
		}
		err = util.CheckNodeAffinity(pv, nodeLabels)
		if err != nil {
			return err
		}
	}
	return nil
}
1231234
func shouldCancel(build *buildv1.Build) bool {
	return !buildutil.IsBuildComplete(build) && build.Status.Cancelled
}
393847
func EnsureJobNode(g osgraph.MutableUniqueGraph, job *batchv1.Job) *JobNode {
	jobNodeName := JobNodeName(job)
	jobNode := osgraph.EnsureUnique(g,
		jobNodeName,
		func(node osgraph.Node) graph.Node {
			return &JobNode{node, job, true}
		},
	).(*JobNode)

	jobSpecNode := EnsureJobSpecNode(g, &job.Spec, job.Namespace, jobNodeName)
	g.AddEdge(jobNode, jobSpecNode, osgraph.ContainsEdgeKind)

	return jobNode
}
1204378
func getMissingFunctionSource(filename string, asm map[int][]assemblyInstruction, start, end int) (graph.Nodes, string) {
	var fnodes graph.Nodes
	for i := start; i <= end; i++ {
		insts := asm[i]
		if len(insts) == 0 {
			continue
		}
		var group assemblyInstruction
		for _, insn := range insts {
			group.flat += insn.flat
			group.cum += insn.cum
			group.flatDiv += insn.flatDiv
			group.cumDiv += insn.cumDiv
		}
		flat := group.flatValue()
		cum := group.cumValue()
		fnodes = append(fnodes, &graph.Node{
			Info: graph.NodeInfo{
				Name:   "???",
				Lineno: i,
			},
			Flat: flat,
			Cum:  cum,
		})
	}
	return fnodes, filename
}
258802
func NewMissingParameterf(cause error, context interface{}, format string, args ...interface{}) Error {
	if format == "" {
		format = fmt.Sprintf("Missing Parameter: %s", context)
	}
	return makeErrorf(MissingParameterError, cause, format, args...)
}
834705
func FindHPASpecsMissingScaleRefs(graph osgraph.Graph, namer osgraph.Namer) []osgraph.Marker {
	markers := []osgraph.Marker{}

	for _, uncastNode := range graph.NodesByKind(kubenodes.HorizontalPodAutoscalerNodeKind) {
		node := uncastNode.(*kubenodes.HorizontalPodAutoscalerNode)

		scaledObjects := graph.SuccessorNodesByEdgeKind(
			uncastNode,
			kubegraph.ScalingEdgeKind,
		)

		if len(scaledObjects) < 1 {
			markers = append(markers, createMissingScaleRefMarker(node, nil, namer))
			continue
		}

		for _, scaleRef := range scaledObjects {
			if existenceChecker, ok := scaleRef.(osgraph.ExistenceChecker); ok && !existenceChecker.Found() {
				// if this node is synthetic, we can't be sure that the HPA is scaling something that actually exists
				markers = append(markers, createMissingScaleRefMarker(node, scaleRef, namer))
			}
		}
	}

	return markers
}
273765
func (rdn *repoDirNode) ShouldCreateMissedLookup(
	ctx context.Context, name string) (
	bool, context.Context, data.EntryType, os.FileInfo, string) {
	switch {
	case strings.HasPrefix(name, AutogitBranchPrefix):
		branchName := strings.TrimPrefix(name, AutogitBranchPrefix)
		if len(branchName) == 0 {
			return rdn.Node.ShouldCreateMissedLookup(ctx, name)
		}
		// It's difficult to tell if a given name is a legitimate
		// prefix for a branch name or not, so just accept everything.
		// If it's not legit, trying to read the data will error out.
		return true, ctx, data.FakeDir, nil, ""
	case strings.HasPrefix(name, AutogitCommitPrefix):
		commit := strings.TrimPrefix(name, AutogitCommitPrefix)
		if len(commit) == 0 {
			return rdn.Node.ShouldCreateMissedLookup(ctx, name)
		}

		rcn := &repoCommitNode{
			Node:      nil,
			am:        rdn.am,
			gitRootFS: rdn.gitRootFS,
			repo:      rdn.repo,
			hash:      plumbing.NewHash(commit),
		}
		f := rcn.GetFile(ctx)
		if f == nil {
			rdn.am.log.CDebugf(ctx, "Error getting commit file")
			return rdn.Node.ShouldCreateMissedLookup(ctx, name)
		}
		return true, ctx, data.FakeFile, f.(*diffFile).GetInfo(), ""
	default:
		return rdn.Node.ShouldCreateMissedLookup(ctx, name)
	}

}
1106023
func shouldIncludeNode(eCtx *executionContext, directives []*ast.Directive) bool {
	var (
		skipAST, includeAST *ast.Directive
		argValues           map[string]interface{}
	)
	for _, directive := range directives {
		if directive == nil || directive.Name == nil {
			continue
		}
		switch directive.Name.Value {
		case SkipDirective.Name:
			skipAST = directive
		case IncludeDirective.Name:
			includeAST = directive
		}
	}
	// precedence: skipAST > includeAST
	if skipAST != nil {
		argValues = getArgumentValues(SkipDirective.Args, skipAST.Arguments, eCtx.VariableValues)
		if skipIf, ok := argValues["if"].(bool); ok && skipIf {
			return false // excluded selectionSet's fields
		}
	}
	if includeAST != nil {
		argValues = getArgumentValues(IncludeDirective.Args, includeAST.Arguments, eCtx.VariableValues)
		if includeIf, ok := argValues["if"].(bool); ok && !includeIf {
			return false // excluded selectionSet's fields
		}
	}
	return true
}
802817
func ShouldCreate(ctx context.Context, g *libkb.GlobalContext) (res ShouldCreateResult, err error) {
	mctx := libkb.NewMetaContext(ctx, g)
	defer mctx.TraceTimed("Stellar.ShouldCreate", func() error { return err })()
	defer func() {
		mctx.Debug("Stellar.ShouldCreate: (res:%+v, err:%v)", res, err != nil)
	}()
	arg := libkb.NewAPIArg("stellar/shouldcreate")
	arg.RetryCount = 3
	arg.SessionType = libkb.APISessionTypeREQUIRED
	var apiRes shouldCreateRes
	err = mctx.G().API.GetDecode(mctx, arg, &apiRes)
	return apiRes.ShouldCreateResult, err
}
307575
func (f DefaultDownloader) ShouldCacheMinikubeISO(isoURL string) bool {
	// store the minikube-iso inside the .minikube dir

	urlObj, err := url.Parse(isoURL)
	if err != nil {
		return false
	}
	if urlObj.Scheme == fileScheme {
		return false
	}
	if f.IsMinikubeISOCached(isoURL) {
		return false
	}
	return true
}