// FromJSON creates an OAuther from its JSON representation
340180
func FromJSON(oautherJSON []byte) (oauther *OAuther, err error) {
	oauther = &OAuther{}
	json.Unmarshal(oautherJSON, oauther)
	return
}
980044
func fromJSONPb(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
	var ctor starlark.Value
	var text starlark.String
	if err := starlark.UnpackArgs("from_jsonpb", args, kwargs, "ctor", &ctor, "text", &text); err != nil {
		return nil, err
	}

	c, ok := ctor.(*messageCtor)
	if !ok {
		return nil, fmt.Errorf("from_jsonpb: got %s, expecting a proto message constructor", ctor.Type())
	}
	typ := c.typ

	protoMsg := typ.NewProtoMessage().Interface().(proto.Message)
	u := jsonpb.Unmarshaler{AllowUnknownFields: true}
	if err := u.Unmarshal(strings.NewReader(text.GoString()), protoMsg); err != nil {
		return nil, fmt.Errorf("from_jsonpb: %s", err)
	}

	msg := NewMessage(typ)
	if err := msg.FromProto(protoMsg); err != nil {
		return nil, fmt.Errorf("from_jsonpb: %s", err)
	}
	return msg, nil
}
981904
func FromStruct(m Manifest) (*DeserializedManifest, error) {
	var deserialized DeserializedManifest
	deserialized.Manifest = m

	var err error
	deserialized.canonical, err = json.MarshalIndent(&m, "", "   ")
	return &deserialized, err
}
1046219
func (c *Container) FromDisk() error {
	jsonSource, err := os.Open(c.StatePath())
	if err != nil {
		return err
	}
	defer jsonSource.Close()

	dec := json.NewDecoder(jsonSource)
	return dec.Decode(c.state)
}
886615
func (m *SignedMessage) FromBytes(d []byte) error {
	return json.Unmarshal(d, m)
}
684601
func FromJSON(jsonBytes []byte) ([]byte, error) {
	var j EncodedCaddyfile
	var result string

	err := json.Unmarshal(jsonBytes, &j)
	if err != nil {
		return nil, err
	}

	for sbPos, sb := range j {
		if sbPos > 0 {
			result += "\n\n"
		}
		for i, key := range sb.Keys {
			if i > 0 {
				result += ", "
			}
			//result += standardizeScheme(key)
			result += key
		}
		result += jsonToText(sb.Body, 1)
	}

	return []byte(result), nil
}
219388
func (b *SelectBuilder) From(table string) *SelectBuilder {
	b.table = table
	return b
}
651470
func (m *MailYak) fromHeader() string {
	if m.fromName == "" {
		return fmt.Sprintf("From: %s\r\n", m.fromAddr)
	}

	return fmt.Sprintf("From: %s <%s>\r\n", m.fromName, m.fromAddr)
}
906913
func (ctx *Context) ToJSON(v interface{}) ([]byte, error) {
	b := bytes.NewBuffer(nil)
	enc := ffjson.NewEncoder(b)
	err := enc.Encode(v)
	return b.Bytes(), err
}
1329031
func (c *OAuthAccessCall) FromValues(v url.Values) error {
	var tmp OAuthAccessCall
	if raw := strings.TrimSpace(v.Get("client_id")); len(raw) > 0 {
		tmp.clientID = raw
	}
	if raw := strings.TrimSpace(v.Get("client_secret")); len(raw) > 0 {
		tmp.clientSecret = raw
	}
	if raw := strings.TrimSpace(v.Get("code")); len(raw) > 0 {
		tmp.code = raw
	}
	if raw := strings.TrimSpace(v.Get("redirect_uri")); len(raw) > 0 {
		tmp.redirectURI = raw
	}
	*c = tmp
	return nil
}
429206
func FromURL(u *url.URL, forward Dialer) (Dialer, error) {
	var auth *Auth
	if u.User != nil {
		auth = new(Auth)
		auth.User = u.User.Username()
		if p, ok := u.User.Password(); ok {
			auth.Password = p
		}
	}

	switch u.Scheme {
	case "socks5":
		return SOCKS5("tcp", u.Host, auth, forward)
	}

	// If the scheme doesn't match any of the built-in schemes, see if it
	// was registered by another package.
	if proxySchemes != nil {
		if f, ok := proxySchemes[u.Scheme]; ok {
			return f(u, forward)
		}
	}

	return nil, errors.New("proxy: unknown scheme: " + u.Scheme)
}
897679
func (t *Tle) FromJson(r io.Reader) error {
	return json.NewDecoder(r).Decode(&t)
}
646475
func (oauther *OAuther) ToJSON() (oautherJson []byte, err error) {
	return json.Marshal(oauther)
}
555960
func FromJSON(r io.Reader, mhType uint64, mhLen int) (*Node, error) {
	var m interface{}
	err := json.NewDecoder(r).Decode(&m)
	if err != nil {
		return nil, err
	}

	obj, err := convertToCborIshObj(m)
	if err != nil {
		return nil, err
	}

	return WrapObject(obj, mhType, mhLen)
}
891436
func (transition *EventTransition) From(states ...string) *EventTransition {
	transition.froms = states
	return transition
}
1328327
func (r *Request) fromChunk(chunk storage.Chunk) error {
	// for update chunk layout see Request definition

	chunkdata := chunk.Data()

	//deserialize the feed update portion
	if err := r.Update.binaryGet(chunkdata[:len(chunkdata)-signatureLength]); err != nil {
		return err
	}

	// Extract the signature
	var signature *Signature
	cursor := r.Update.binaryLength()
	sigdata := chunkdata[cursor : cursor+signatureLength]
	if len(sigdata) > 0 {
		signature = &Signature{}
		copy(signature[:], sigdata)
	}

	r.Signature = signature
	r.idAddr = chunk.Address()
	r.binaryData = chunkdata

	return nil

}
874823
func FromURL(URL string) (OTP, string, error) {
	u, err := url.Parse(URL)
	if err != nil {
		return nil, "", err
	}

	if u.Scheme != "otpauth" {
		return nil, "", ErrInvalidURL
	}

	switch {
	case u.Host == "totp":
		return totpFromURL(u)
	case u.Host == "hotp":
		return hotpFromURL(u)
	default:
		return nil, "", ErrInvalidURL
	}
}