// WorkspaceTransform transforms ...
420719
func WorkspaceTransform(c *yaml.Config, base, path string) error {
	if c.Workspace == nil {
		c.Workspace = &yaml.Workspace{}
	}

	if c.Workspace.Base == "" {
		c.Workspace.Base = base
	}
	if c.Workspace.Path == "" {
		c.Workspace.Path = path
	}
	if !filepath.IsAbs(c.Workspace.Path) {
		c.Workspace.Path = filepath.Join(
			c.Workspace.Base,
			c.Workspace.Path,
		)
	}

	for _, p := range c.Pipeline {
		p.WorkingDir = c.Workspace.Path
	}
	return nil
}
225626
func WorkspaceFor(source string) (*Workspace, error) {
	gopaths := envOr("GOPATH", build.Default.GOPATH)
	// We use absolute paths so that in particular on Windows the case gets normalized
	sourcePath, err := filepath.Abs(source)
	if err != nil {
		sourcePath = source
	}
	if os.Getenv("GO111MODULE") != "on" { // GOPATH mode
		for _, gp := range filepath.SplitList(gopaths) {
			gopath, err := filepath.Abs(gp)
			if err != nil {
				gopath = gp
			}
			if filepath.HasPrefix(sourcePath, gopath) {
				return &Workspace{
					gopath:       gopaths,
					isModuleMode: false,
					Path:         gopath,
				}, nil
			}
		}
	}
	if os.Getenv("GO111MODULE") != "off" { // Module mode
		root, _ := findModuleRoot(sourcePath, "", false)
		if root != "" {
			return &Workspace{
				gopath:       gopaths,
				isModuleMode: true,
				Path:         root,
			}, nil
		}
	}
	return nil, fmt.Errorf(`Go source file "%s" not in Go workspace, adjust GOPATH %s or use modules`, source, gopaths)
}
222703
func (s *ModifyWorkspacePropertiesInput) SetWorkspaceProperties(v *WorkspaceProperties) *ModifyWorkspacePropertiesInput {
	s.WorkspaceProperties = v
	return s
}
818752
func (s *DescribeTransformJobOutput) SetTransformJobName(v string) *DescribeTransformJobOutput {
	s.TransformJobName = &v
	return s
}
271899
func NewToTransformation(d execute.Dataset, cache execute.TableBuilderCache, spec *ToProcedureSpec, deps ToDependencies) (*ToTransformation, error) {
	var fn *execute.RowMapFn
	var err error

	if spec.Spec.FieldFn != nil {
		if fn, err = execute.NewRowMapFn(spec.Spec.FieldFn); err != nil {
			return nil, err
		}
	}

	return &ToTransformation{
		d:     d,
		fn:    fn,
		cache: cache,
		spec:  spec,
		deps:  deps,
	}, nil
}
712871
func (l *Line) Transform(projector Projector) *Line {
	projector(&l.a)
	projector(&l.b)

	return l
}
982730
func (s *StopTransformJobInput) SetTransformJobName(v string) *StopTransformJobInput {
	s.TransformJobName = &v
	return s
}
1371771
func (wc *watchChan) transform(e *event) (res *watch.Event) {
	curObj, oldObj, err := wc.prepareObjs(e)
	if err != nil {
		klog.Errorf("failed to prepare current and previous objects: %v", err)
		wc.sendError(err)
		return nil
	}

	switch {
	case e.isDeleted:
		if !wc.filter(oldObj) {
			return nil
		}
		res = &watch.Event{
			Type:   watch.Deleted,
			Object: oldObj,
		}
	case e.isCreated:
		if !wc.filter(curObj) {
			return nil
		}
		res = &watch.Event{
			Type:   watch.Added,
			Object: curObj,
		}
	default:
		if wc.acceptAll() {
			res = &watch.Event{
				Type:   watch.Modified,
				Object: curObj,
			}
			return res
		}
		curObjPasses := wc.filter(curObj)
		oldObjPasses := wc.filter(oldObj)
		switch {
		case curObjPasses && oldObjPasses:
			res = &watch.Event{
				Type:   watch.Modified,
				Object: curObj,
			}
		case curObjPasses && !oldObjPasses:
			res = &watch.Event{
				Type:   watch.Added,
				Object: curObj,
			}
		case !curObjPasses && oldObjPasses:
			res = &watch.Event{
				Type:   watch.Deleted,
				Object: oldObj,
			}
		}
	}
	return res
}
1030846
func (s *DescribeTransformJobOutput) SetTransformJobArn(v string) *DescribeTransformJobOutput {
	s.TransformJobArn = &v
	return s
}
329835
func (b *Remote) workspaces() ([]string, error) {
	options := tfe.WorkspaceListOptions{}
	switch {
	case b.workspace != "":
		options.Search = tfe.String(b.workspace)
	case b.prefix != "":
		options.Search = tfe.String(b.prefix)
	}

	// Create a slice to contain all the names.
	var names []string

	for {
		wl, err := b.client.Workspaces.List(context.Background(), b.organization, options)
		if err != nil {
			return nil, err
		}

		for _, w := range wl.Items {
			if b.workspace != "" && w.Name == b.workspace {
				names = append(names, backend.DefaultStateName)
				continue
			}
			if b.prefix != "" && strings.HasPrefix(w.Name, b.prefix) {
				names = append(names, strings.TrimPrefix(w.Name, b.prefix))
			}
		}

		// Exit the loop when we've seen all pages.
		if wl.CurrentPage >= wl.TotalPages {
			break
		}

		// Update the page number to get the next page.
		options.PageNumber = wl.NextPage
	}

	// Sort the result so we have consistent output.
	sort.StringSlice(names).Sort()

	return names, nil
}
1063576
func (s *CreateWorkspacesInput) SetWorkspaces(v []*WorkspaceRequest) *CreateWorkspacesInput {
	s.Workspaces = v
	return s
}
1044523
func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
	// TODO: get rid of reorderBuffer. See CL 23460044.
	rb := reorderBuffer{}
	rb.init(f, src)
	for {
		// Load segment into reorder buffer.
		rb.setFlusher(dst[nDst:], flushTransform)
		end := decomposeSegment(&rb, nSrc, atEOF)
		if end < 0 {
			return nDst, nSrc, errs[-end]
		}
		nDst = len(dst) - len(rb.out)
		nSrc = end

		// Next quickSpan.
		end = rb.nsrc
		eof := atEOF
		if n := nSrc + len(dst) - nDst; n < end {
			err = transform.ErrShortDst
			end = n
			eof = false
		}
		end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof)
		n := copy(dst[nDst:], rb.src.bytes[nSrc:end])
		nSrc += n
		nDst += n
		if ok {
			if n < rb.nsrc && !atEOF {
				err = transform.ErrShortSrc
			}
			return nDst, nSrc, err
		}
	}
}
610055
func (r *Runner) Transform(data []string) (string, error) {
	var e error

	// create tmpfile
	r.tmpFile, _ = ioutil.TempFile(os.TempDir(), "peconize")
	defer os.Remove(r.tmpFile.Name())

	// swap stdout
	r.pipeReader, r.pipeWriter, e = os.Pipe()
	os.Stdout = r.pipeWriter

	if e = r.runPeco(data); e != nil {
		return "", e
	}

	// create blocking channel
	blocker := make(chan struct{}, 1)

	go r.captureOutput(blocker)

	r.pipeWriter.Close()
	<-blocker

	return r.captureBuffer, nil
}
1270717
func (s *EmptyTransformer) Transform(inp Expression) Expression {
	inp.Accept(s.RealSelf)
	return s.Result
}
591178
func (r *RenameFamilies) Transform(mfs []*dto.MetricFamily) []*dto.MetricFamily {
	renamed := mfs[:0]
	for _, mf := range mfs {
		if to, ok := r.FromTo[mf.GetName()]; ok {
			mf.Name = &to
		}
		renamed = append(renamed, mf)

	}
	sort.Sort(familySorter(renamed))
	return renamed
}
90131
func InverseTransformExample(pathKey *diskv.PathKey) (key string) {
	txt := pathKey.FileName[len(pathKey.FileName)-4:]
	if txt != ".txt" {
		panic("Invalid file found in storage folder!")
	}
	return strings.Join(pathKey.Path, "/") + pathKey.FileName[:len(pathKey.FileName)-4]
}
1224640
func (b *Backend) DeleteWorkspace(name string) error {
	if name == backend.DefaultStateName {
		return fmt.Errorf("cowardly refusing to delete the %q state", name)
	}

	c, err := b.client(name)
	if err != nil {
		return err
	}

	return c.Delete()
}