// GetDataForFile returns data gor given file
552329
func (c *Client) GetDataForFile(path string) []*decoder.FileDataEntry {
	return c.db.GetDataForFile(path)
}
1337268
func (f File) LoadFile(file string) (err error) {
	in, err := os.Open(file)
	if err != nil {
		return
	}
	defer in.Close()
	return f.Load(in)
}
950912
func (s *StreamArchive) StreamFile(relPath string, fi os.FileInfo, data []byte) error {
	if fi.IsDir() {
		fh, err := tar.FileInfoHeader(fi, "")
		if err != nil {
			return err
		}
		fh.Name = relPath + "/"
		if err = s.Writer.WriteHeader(fh); err != nil {
			return err
		}
	} else {
		target := ""
		if fi.Mode()&os.ModeSymlink != 0 {
			target = string(data)
		}

		fh, err := tar.FileInfoHeader(fi, target)
		if err != nil {
			return err
		}
		fh.Name = filepath.Join(relPath, fi.Name())
		if err = s.Writer.WriteHeader(fh); err != nil {
			return err
		}

		if _, err = s.Writer.Write(data); err != nil {
			return err
		}
	}
	return nil
}
1366898
func packageForFile(pkgs map[string]*ast.Package, filename string) (string, *ast.Package, error) {
	for path, pkg := range pkgs {
		for pkgFile := range pkg.Files {
			if pkgFile == filename {
				return path, pkg, nil
			}
		}
	}
	return "", nil, fmt.Errorf("failed to find %q in packages %q", filename, pkgs)
}
808081
func ReadDataFile(path string) []byte {
	p, err := filepath.Abs(path)
	CheckError(err)

	data, ferr := ioutil.ReadFile(p)
	CheckError(ferr)

	return data
}
873008
func waitForFile(p string, to time.Duration) []error {
	done := time.After(to)
	for {
		select {
		case <-done:
			return []error{
				fmt.Errorf("timed out waiting for %s", p),
			}
		case <-time.After(1):
			if ok, _ := fileExists(p); ok {
				return nil
			}
		}
	}
}
575053
func getData(v interface{}, data *C.pn_data_t) {
	if data != nil && C.pn_data_size(data) > 0 {
		C.pn_data_rewind(data)
		C.pn_data_next(data)
		unmarshal(v, data)
	}
	return
}
1167888
func FindMessageForFile(f *pb.FileDescriptorProto, name string) int {
	for i, x := range f.GetMessageType() {
		if x.GetName() == name {
			return i
		}
	}
	return -1
}
473114
func dataFromSliceOrFile(data []byte, file string) ([]byte, error) {
	if len(data) > 0 {
		return data, nil
	}
	if len(file) > 0 {
		fileData, err := ioutil.ReadFile(file)
		if err != nil {
			return []byte{}, err
		}
		return fileData, nil
	}
	return nil, nil
}
214278
func (r Marketplace_Partner) GetFile(name *string) (resp datatypes.Marketplace_Partner_File, err error) {
	params := []interface{}{
		name,
	}
	err = r.Session.DoRequest("SoftLayer_Marketplace_Partner", "getFile", params, &r.Options, &resp)
	return
}
224941
func (r Account_MasterServiceAgreement) GetFile() (resp datatypes.Container_Utility_File_Entity, err error) {
	err = r.Session.DoRequest("SoftLayer_Account_MasterServiceAgreement", "getFile", nil, &r.Options, &resp)
	return
}
370673
func (s *Script) ReadFromFile(file string) error {
	s.lock.Lock()
	defer s.lock.Unlock()
	b, err := ioutil.ReadFile(file)
	if err != nil {
		return err
	}
	s.body = strings.TrimSpace(string(b))
	return s.createSHA()
}
758030
func (s *blockDiskStore) getData(ctx context.Context, id kbfsblock.ID) (
	[]byte, kbfscrypto.BlockCryptKeyServerHalf, error) {
	cleanup, err := s.exclusify(ctx, id)
	if err != nil {
		return nil, kbfscrypto.BlockCryptKeyServerHalf{}, err
	}
	defer cleanup()

	return s.getDataExclusive(id)
}
612684
func SourceFileFor(path string) (*SourceFile, error) {
	absPath, err := filepath.Abs(path)
	if err != nil {
		absPath = path
	}
	p, err := PackageFor(absPath)
	if err != nil {
		return nil, err
	}
	return p.OpenSourceFile(filepath.Base(absPath))
}
163710
func (c *DbClient) GetDataForKey(key string) (*decoder.FileDataEntry, bool) {
	c.Lock()
	defer c.Unlock()

	for _, file := range c.db {
		value, ok := file[key]
		if ok {
			return &decoder.FileDataEntry{
				Key:   key,
				Value: value.data,
			}, true
		}
	}
	return nil, false
}
116371
func (b TestToBuildData) GetDataPerBuild(job, build, test, node string) *DataPerBuild {
	if _, ok := b[test]; !ok {
		b[test] = &DataPerTest{
			Job:  job,
			Data: map[string]DataPerNode{},
		}
	}
	if _, ok := b[test].Data[node]; !ok {
		b[test].Data[node] = DataPerNode{}
	}
	if _, ok := b[test].Data[node][build]; !ok {
		b[test].Data[node][build] = &DataPerBuild{}
	}
	return b[test].Data[node][build]
}
814121
func (c *Client) GetDatasetFiles(ctx context.Context, name string) ([]*DatasetFile, error) {
	files := make([]*DatasetFile, 0)
	path := fmt.Sprintf(datasetFilesPath, name)

	req, err := c.NewRequest("GET", path, nil, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &files); err != nil {
		return nil, err
	}

	return files, nil
}