// LoadFile loads from an archive file.
540134
func LoadFile(name string) (*chart.Chart, error) {
	if fi, err := os.Stat(name); err != nil {
		return nil, err
	} else if fi.IsDir() {
		return nil, errors.New("cannot load a directory")
	}

	raw, err := os.Open(name)
	if err != nil {
		return nil, err
	}
	defer raw.Close()

	return LoadArchive(raw)
}
963629
func LoadFile(path string) (*Config, error) {
	log.Debugf("loading configuration file from %s", path)
	if path == "" {
		return nil, cferr.Wrap(cferr.PolicyError, cferr.InvalidPolicy, errors.New("invalid path"))
	}

	body, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, cferr.Wrap(cferr.PolicyError, cferr.InvalidPolicy, errors.New("could not read configuration file"))
	}

	return LoadConfig(body)
}
138993
func (r *Docker) LoadImage(path string) error {
	glog.Infof("Loading image: %s", path)
	return r.Runner.Run(fmt.Sprintf("docker load -i %s", path))
}
228075
func (m *Meta) loadValuesFile(filename string) (map[string]cty.Value, tfdiags.Diagnostics) {
	var diags tfdiags.Diagnostics
	filename = m.normalizePath(filename)

	loader, err := m.initConfigLoader()
	if err != nil {
		diags = diags.Append(err)
		return nil, diags
	}

	vals, hclDiags := loader.Parser().LoadValuesFile(filename)
	diags = diags.Append(hclDiags)
	return vals, diags
}
1088862
func LoadFiles(filenames []string, db *sql.DB, driver string) error {
	for _, filename := range filenames {
		if err := LoadFile(filename, db, driver); err != nil {
			return err
		}
	}
	return nil
}
485454
func LoadFromFileOrHTTP(path string) ([]byte, error) {
	return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path)
}
44103
func LoadFromFile(filename string) (config Config, err error) {
	var f *os.File
	if f, err = os.Open(filename); err != nil { // nolint: gosec
		err = fmt.Errorf("failed to load IAM config from file %q: %+v", filename, err)
		return
	}

	defer errorutil.Ignore(f.Close)
	dec := json.NewDecoder(f)
	if err = dec.Decode(&config); err != nil {
		err = fmt.Errorf("invalid IAM JSON: %+v", err)
		return
	}
	if _, err = url.Parse(config.LoginEndpoint); err != nil {
		err = fmt.Errorf("invalid LoginEndpoint URL: %+v", err)
	}
	return
}
1056769
func LoadFromFile(fname string) (tr *Trie, err error) {
	tr = NewTrie()
	entries, err := loadTrieFile(fname)
	if err != nil {
		return
	}
	log.Printf("Got %v entries\n", len(entries))
	startTime := time.Now()
	for _, mi := range entries {
		b := tr.Add(mi.Value)
		b.Count = mi.Count
	}
	log.Printf("adding words to index took: %v\n", time.Since(startTime))

	return
}
929397
func (p *Project) LoadFunction(name string) (*function.Function, error) {
	return p.LoadFunctionByPath(name, filepath.Join(p.Path, functionsDir, name))
}
1056903
func loadIndex(data []byte) (*IndexFile, error) {
	i := &IndexFile{}
	if err := yaml.Unmarshal(data, i); err != nil {
		return i, err
	}
	i.SortEntries()
	if i.APIVersion == "" {
		// When we leave Beta, we should remove legacy support and just
		// return this error:
		//return i, ErrNoAPIVersion
		return loadUnversionedIndex(data)
	}
	return i, nil
}
448456
func (l hcl2Loader) loadFile(filename string) (configurable, []string, error) {
	var f *hcl2.File
	var diags hcl2.Diagnostics
	if strings.HasSuffix(filename, ".json") {
		f, diags = l.Parser.ParseJSONFile(filename)
	} else {
		f, diags = l.Parser.ParseHCLFile(filename)
	}
	if diags.HasErrors() {
		// Return diagnostics as an error; callers may type-assert this to
		// recover the original diagnostics, if it doesn't end up wrapped
		// in another error.
		return nil, nil, diags
	}

	return &hcl2Configurable{
		SourceFilename: filename,
		Body:           f.Body,
	}, nil, nil
}
193886
func (h *Hooks) LoadFromFile(path string, asTemplate bool) error {
	if path == "" {
		return nil
	}

	// parse hook file for hooks
	file, e := ioutil.ReadFile(path)

	if e != nil {
		return e
	}

	if asTemplate {
		funcMap := template.FuncMap{"getenv": getenv}

		tmpl, err := template.New("hooks").Funcs(funcMap).Parse(string(file))
		if err != nil {
			return err
		}

		var buf bytes.Buffer

		err = tmpl.Execute(&buf, nil)
		if err != nil {
			return err
		}

		file = buf.Bytes()
	}

	e = yaml.Unmarshal(file, h)
	return e
}
280825
func AddFile(a Archive, file string) error {
	fd, err := os.Open(file)
	if err != nil {
		return err
	}
	defer fd.Close()
	fi, err := fd.Stat()
	if err != nil {
		return err
	}
	w, err := a.Header(fi)
	if err != nil {
		return err
	}
	if _, err := io.Copy(w, fd); err != nil {
		return err
	}
	return nil
}
515618
func (k *Keyfile) Load() (err error) {
	if len(k.fname) > 0 {
		var f *os.File
		f, err = os.Open(k.fname)
		if err == nil {
			err = k.read(f)
			f.Close()
		}
	}
	return
}
1122399
func LoadFile(fileName string) (table *DbfTable, err error) {
	s, err := readFile(fileName)
	if err != nil {
		return nil, err
	}
	// Create and pupulate DbaseTable struct
	dt := new(DbfTable)
	dt.loading = true
	// set DbfTable dataStore slice that will store the complete file in memory
	dt.dataStore = s

	// read dbase table header information
	dt.fileSignature = s[0]
	dt.updateYear = s[1]
	dt.updateMonth = s[2]
	dt.updateDay = s[3]
	dt.numberOfRecords = uint32(s[4]) | (uint32(s[5]) << 8) | (uint32(s[6]) << 16) | (uint32(s[7]) << 24)
	dt.headerSize = uint16(s[8]) | (uint16(s[9]) << 8)
	dt.recordLength = uint16(s[10]) | (uint16(s[11]) << 8)

	// create fieldMap to taranslate field name to index
	dt.fieldMap = make(map[string]int)

	// Number of fields in dbase table
	dt.numberOfFields = int((dt.headerSize - 1 - 32) / 32)

	// populate dbf fields
	for i := 0; i < int(dt.numberOfFields); i++ {
		offset := (i * 32) + 32

		fieldName := strings.Trim(string(s[offset:offset+10]), string([]byte{0}))
		dt.fieldMap[fieldName] = i

		var err error
		switch s[offset+11] {
		case 'C':
			err = dt.AddTextField(fieldName, s[offset+16])
		case 'N':
			err = dt.AddNumberField(fieldName, s[offset+16], s[offset+17])
		case 'L':
			err = dt.AddBoolField(fieldName)
		case 'D':
			err = dt.AddDateField(fieldName)
		}

		if err != nil {
			return nil, err
		}
	}

	// memorize deleted rows
	sz := int(dt.numberOfRecords)
	for i := 0; i < sz; i++ {
		if dt.IsDeleted(i) {
			dt.delRows = append(dt.delRows, i)
		}
	}

	dt.frozenStruct = true
	return dt, nil
}
1031078
func LoadFile(c context.Context, project, ref string) (file *File, vers string, err error) {
	// If ref is "", this will be a standard project config set.
	cfgSet := config.RefSet(project, ref)

	file = &File{}
	var meta config.Meta
	if err = cfgclient.Get(c, cfgclient.AsService, cfgSet, "dm/quest_templates.cfg", textproto.Message(file), &meta); err != nil {
		return
	}
	vers = meta.ContentHash
	err = file.Normalize()
	return
}
1241339
func LoadConfigFile() error {
	path, err := findConfigPath()
	if err != nil {
		return errors.WithStack(err)
	}
	Connections = map[string]*Connection{}
	log(logging.Debug, "Loading config file from %s", path)
	f, err := os.Open(path)
	if err != nil {
		return errors.WithStack(err)
	}
	return LoadFrom(f)
}