// LoadFromData creates a new BinaryInfo object using the specified data.
// This is used for debugging BinaryInfo, you should use LoadBinary instead.
972964
func (bi *BinaryInfo) LoadFromData(dwdata *dwarf.Data, debugFrameBytes, debugLineBytes, debugLocBytes []byte) {
	bi.closer = (*nilCloser)(nil)
	bi.sepDebugCloser = (*nilCloser)(nil)
	bi.dwarf = dwdata

	if debugFrameBytes != nil {
		bi.frameEntries = frame.Parse(debugFrameBytes, frame.DwarfEndian(debugFrameBytes), bi.staticBase)
	}

	bi.loclistInit(debugLocBytes)

	bi.loadDebugInfoMaps(debugLineBytes, nil, nil)
}
404495
func Load(data []byte) (*clientcmdapi.Config, error) {
	config := clientcmdapi.NewConfig()
	// if there's no data in a file, return the default object instead of failing (DecodeInto reject empty input)
	if len(data) == 0 {
		return config, nil
	}
	decoded, _, err := clientcmdlatest.Codec.Decode(data, &schema.GroupVersionKind{Version: clientcmdlatest.Version, Kind: "Config"}, config)
	if err != nil {
		return nil, err
	}
	return decoded.(*clientcmdapi.Config), nil
}
1156509
func (t *typeInfo) LoadFromObjectContent(o types.ObjectContent) (reflect.Value, error) {
	v := reflect.New(t.typ)
	assignValue(v, t.self, reflect.ValueOf(o.Obj))

	for _, p := range o.PropSet {
		rv, ok := t.props[p.Name]
		if !ok {
			continue
		}
		assignValue(v, rv, reflect.ValueOf(p.Val))
	}

	return v, nil
}
1291576
func ReadInfoFromBytes(filename string, bytes []byte) (interface{}, error) {
	initializeInfoCache()
	if infoCacheEnable {
		cachedInfo, ok := infoCache[filename]
		if ok {
			if verboseReader {
				log.Printf("Cache hit info for file %s", filename)
			}
			return cachedInfo, nil
		}
		if verboseReader {
			log.Printf("Reading info for file %s", filename)
		}
	}
	var info yaml.MapSlice
	err := yaml.Unmarshal(bytes, &info)
	if err != nil {
		return nil, err
	}
	if infoCacheEnable && len(filename) > 0 {
		infoCache[filename] = info
	}
	return info, nil
}
1244296
func (i *Index) loadMeta() error {
	var pb internal.IndexMeta

	// Read data from meta file.
	buf, err := ioutil.ReadFile(filepath.Join(i.path, ".meta"))
	if os.IsNotExist(err) {
		return nil
	} else if err != nil {
		return errors.Wrap(err, "reading")
	} else {
		if err := proto.Unmarshal(buf, &pb); err != nil {
			return errors.Wrap(err, "unmarshalling")
		}
	}

	// Copy metadata fields.
	i.keys = pb.Keys
	i.trackExistence = pb.TrackExistence

	return nil
}
878591
func Load(name string) (*File, error) {
	data, err := ioutil.ReadFile(name)
	if err != nil {
		return nil, err
	}
	return LoadData(data)
}
1214884
func (cc *clientConn) handleLoadData(ctx context.Context, loadDataInfo *executor.LoadDataInfo) error {
	// If the server handles the load data request, the client has to set the ClientLocalFiles capability.
	if cc.capability&mysql.ClientLocalFiles == 0 {
		return errNotAllowedCommand
	}
	if loadDataInfo == nil {
		return errors.New("load data info is empty")
	}

	err := cc.writeReq(loadDataInfo.Path)
	if err != nil {
		return err
	}

	var shouldBreak bool
	var prevData, curData []byte
	// TODO: Make the loadDataRowCnt settable.
	loadDataInfo.SetMaxRowsInBatch(defaultLoadDataBatchCnt)
	err = loadDataInfo.Ctx.NewTxn(ctx)
	if err != nil {
		return err
	}
	for {
		curData, err = cc.readPacket()
		if err != nil {
			if terror.ErrorNotEqual(err, io.EOF) {
				logutil.Logger(ctx).Error("read packet failed", zap.Error(err))
				break
			}
		}
		if len(curData) == 0 {
			shouldBreak = true
			if len(prevData) == 0 {
				break
			}
		}
		prevData, err = insertDataWithCommit(ctx, prevData, curData, loadDataInfo)
		if err != nil {
			break
		}
		if shouldBreak {
			break
		}
	}
	loadDataInfo.SetMessage()

	if err != nil {
		loadDataInfo.Ctx.StmtRollback()
	} else {
		err = loadDataInfo.Ctx.StmtCommit()
	}

	var txn kv.Transaction
	var err1 error
	txn, err1 = loadDataInfo.Ctx.Txn(true)
	if err1 == nil {
		if txn != nil && txn.Valid() {
			if err != nil {
				if err1 := txn.Rollback(); err1 != nil {
					logutil.Logger(ctx).Error("load data rollback failed", zap.Error(err1))
				}
				return err
			}
			return cc.ctx.CommitTxn(sessionctx.SetCommitCtx(ctx, loadDataInfo.Ctx))
		}
	}
	// Should never reach here.
	panic(err1)
}
30869
func LoadJSON(jsonContent []byte) (*Dataset, error) {
	var input []map[string]interface{}
	if err := json.Unmarshal(jsonContent, &input); err != nil {
		return nil, err
	}

	return internalLoadFromDict(input)
}
371103
func (enc *HTTPEncoder) EncodeData(data []byte) error {
	setContentType(enc.writer, ContentBinary)

	_, err := enc.writer.Write(data)
	if err != nil {
		http.Error(enc.writer, fmt.Sprintf("Unable to encode binary data: %s", err.Error()), http.StatusInternalServerError)
	}
	return err
}
1091139
func (model Model) LoadModelFromText(text string) {
	cfg, err := config.NewConfigFromText(text)
	if err != nil {
		panic(err)
	}

	loadSection(model, cfg, "r")
	loadSection(model, cfg, "p")
	loadSection(model, cfg, "e")
	loadSection(model, cfg, "m")

	loadSection(model, cfg, "g")
}
389696
func NewVecNFromData(initial []float32) *VecN {
	if initial == nil {
		return &VecN{}
	}
	var internal []float32
	if shouldPool {
		internal = grabFromPool(len(initial))
	} else {
		internal = make([]float32, len(initial))
	}
	copy(internal, initial)
	return &VecN{vec: internal}
}
1136806
func ReadBinaryFromFile(file string) []byte {
	key, err := ioutil.ReadFile(file)
	if err != nil {
		panic(fmt.Sprintf("Failed to load %q from folder: %v", file, err))
	}
	return key
}
1116581
func (e *Event) Data() ([]byte, error) {
	if e.Type != BinaryMessage {
		return nil, errors.New("Event.Text() called on non-BinaryMessage event")
	}
	return ioutil.ReadAll(e)
}
139874
func Data(filename string, source io.Reader) *BinaryData {
	return &BinaryData{
		Filename: filename,
		Source:   source,
	}
}
732820
func (formats *Formats) LoadReaderData(url string, f io.Reader) error {
	ext := getExt(url)
	if loader, ok := Files.formats[ext]; ok {
		return loader.Load(url, f)
	}
	return fmt.Errorf("no `FileLoader` associated with this extension: %q in url %q", ext, url)
}
1236165
func LoadFromReader(reader io.Reader, password []byte) (*KeyStore, error) {
	ks := &KeyStore{
		entries: make(map[string]interface{}),
	}
	err := ks.Parse(reader, password)
	if err != nil {
		return nil, err
	}
	return ks, err
}
429858
func LoadedMetadata(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "loadedmetadata", Listener: listener}
}