// FromWire deserializes MapType from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
496149
func (v *MapType) FromWire(w wire.Value) error {
	x, err := _Map_String_Bonk_Read(w.GetMap())
	*v = (MapType)(x)
	return err
}
683723
func (e deviceGatewayEdge) From() graph.Node {
	return simple.Node(eui64Int64(e.devEUI))
}
857107
func FromString(s string) Type {
	switch s {
	case TUUID.String():
		return TUUID
	case String.String():
		return String
	case Int32.String():
		return Int32
	case Int64.String():
		return Int64
	case Double.String():
		return Double
	case Blob.String():
		return Blob
	case Timestamp.String():
		return Timestamp
	case Bool.String():
		return Bool
	default:
		return Invalid
	}
}
1238376
func fromNetworkHostPort(netHostPort network.HostPort) hostPort {
	return hostPort{
		Value:       netHostPort.Value,
		AddressType: string(netHostPort.Type),
		Scope:       string(netHostPort.Scope),
		Port:        netHostPort.Port,
		SpaceName:   string(netHostPort.SpaceName),
	}
}
267743
func FromJson(jsonBlob []byte, actionmap map[string]Action) (qDSL QueryDSL, err error) {
	err = json.Unmarshal(jsonBlob, &qDSL)
	if err != nil {
		return
	}
	qDSL.Proc(actionmap)
	return
}
370218
func (hm headerMapper) FromHTTPHeaders(from http.Header, to transport.Headers) transport.Headers {
	prefixLen := len(hm.Prefix)
	for k := range from {
		if strings.HasPrefix(k, hm.Prefix) {
			key := k[prefixLen:]
			to = to.With(key, from.Get(k))
		}
		// Note: undefined behavior for multiple occurrences of the same header
	}
	return to
}
1093256
func (m *MetadataValue) FromMap(md map[string]interface{}) error {
	typI, ok := md["type"]
	if !ok {
		return errors.New("Could not make MetadataValue from map, it did not contain a 'type' key")
	}
	typ, ok := typI.(string)
	if !ok {
		return errors.New("Could not make MetadataValue from map, the type key was not a string as expected")
	}
	val, ok := md["value"]
	if !ok {
		return errors.New("Could not make MetadataValue from map, it did not contain a 'value' key")
	}
	m.Type = MetadataValueType(typ)
	m.Value = val
	if err := m.tryCastFields(); err != nil {
		return errors.Errorf("Could not make MetadataValue from map: %s", err.Error())
	}
	return nil
}
415982
func (self *Scheme) fromScope(s conversion.Scope) (inVersion, outVersion string, scheme *Scheme) {
	scheme = self
	inVersion = s.Meta().SrcVersion
	outVersion = s.Meta().DestVersion
	return inVersion, outVersion, scheme
}
340180
func FromJSON(oautherJSON []byte) (oauther *OAuther, err error) {
	oauther = &OAuther{}
	json.Unmarshal(oautherJSON, oauther)
	return
}
1241485
func FromJSON(p string) (Args, error) {
	args := NewArgs()

	if p == "" {
		return args, nil
	}

	raw := []byte(p)
	err := json.Unmarshal(raw, &args)
	if err == nil {
		return args, nil
	}

	// Fallback to parsing arguments in the legacy slice format
	deprecated := map[string][]string{}
	if legacyErr := json.Unmarshal(raw, &deprecated); legacyErr != nil {
		return args, err
	}

	args.fields = deprecatedArgs(deprecated)
	return args, nil
}
483170
func FromBytes(tracer opentracing.Tracer, request []byte) (opentracing.SpanContext, *transport.Request, error) {
	if len(request) <= 1 {
		return nil, nil, errors.New("cannot deserialize empty request")
	}

	// check valid thrift serialization byte
	if request[0] != 0 {
		return nil, nil,
			fmt.Errorf(
				"unsupported YARPC serialization version '%v' found during deserialization",
				request[0])
	}

	reader := bytes.NewReader(request[1:])
	wireValue, err := protocol.Binary.Decode(reader, wire.TStruct)
	if err != nil {
		return nil, nil, err
	}

	var rpc internal.RPC
	if err = rpc.FromWire(wireValue); err != nil {
		return nil, nil, err
	}

	req := transport.Request{
		Caller:    rpc.CallerName,
		Service:   rpc.ServiceName,
		Encoding:  transport.Encoding(rpc.Encoding),
		Procedure: rpc.Procedure,
		Headers:   transport.HeadersFromMap(rpc.Headers),
		Body:      bytes.NewBuffer(rpc.Body),
	}

	if rpc.ShardKey != nil {
		req.ShardKey = *rpc.ShardKey
	}
	if rpc.RoutingKey != nil {
		req.RoutingKey = *rpc.RoutingKey
	}
	if rpc.RoutingDelegate != nil {
		req.RoutingDelegate = *rpc.RoutingDelegate
	}

	spanContext, err := spanContextFromBytes(tracer, rpc.SpanContext)
	if err != nil {
		return nil, nil, err
	}

	return spanContext, &req, nil
}
472842
func FromContextError(err error) *Status {
	switch err {
	case nil:
		return New(codes.OK, "")
	case context.DeadlineExceeded:
		return New(codes.DeadlineExceeded, err.Error())
	case context.Canceled:
		return New(codes.Canceled, err.Error())
	default:
		return New(codes.Unknown, err.Error())
	}
}
365027
func (a *Attempt_ID) FromProperty(p datastore.Property) error {
	if p.Type() != datastore.PTString {
		return fmt.Errorf("wrong type for property: %s", p.Type())
	}
	return a.SetDMEncoded(p.Value().(string))
}
962351
func FromWFS(wfsURL, featureType string) (*FeatureCollection, error) {
	var (
		result   *FeatureCollection
		err      error
		request  *http.Request
		response *http.Response
		b        []byte
		ok       bool
	)

	v := url.Values{}
	v.Set("service", "wfs")
	v.Set("count", "9999")
	v.Set("outputFormat", "application/json")
	v.Set("version", "2.0.0")
	v.Set("request", "GetFeature")
	v.Set("typeName", featureType)

	qurl := wfsURL + "?" + v.Encode()

	if request, err = http.NewRequest("GET", qurl, nil); err != nil {
		return result, err
	}
	transport := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

	httpClient := http.Client{Transport: transport}
	if response, err = httpClient.Do(request); err != nil {
		return result, err
	}

	defer response.Body.Close()
	b, _ = ioutil.ReadAll(response.Body)

	// Check for HTTP errors
	if response.StatusCode < 200 || response.StatusCode > 299 {
		return result, fmt.Errorf("Received %v: \"%v\" when performing a GetFeature request on %v\n%v", response.StatusCode, response.Status, qurl, string(b))
	}

	gjIfc, _ := Parse(b)
	if result, ok = gjIfc.(*FeatureCollection); ok {
		return result, nil
	}
	return result, fmt.Errorf("Did not receive valid GeoJSON on request %v", qurl)
}
1112518
func (w *WireGenerator) FromWire(g Generator, spec compile.TypeSpec, value string) (string, error) {
	switch s := spec.(type) {
	case *compile.BoolSpec:
		return fmt.Sprintf("%s.GetBool(), error(nil)", value), nil
	case *compile.I8Spec:
		return fmt.Sprintf("%s.GetI8(), error(nil)", value), nil
	case *compile.I16Spec:
		return fmt.Sprintf("%s.GetI16(), error(nil)", value), nil
	case *compile.I32Spec:
		return fmt.Sprintf("%s.GetI32(), error(nil)", value), nil
	case *compile.I64Spec:
		return fmt.Sprintf("%s.GetI64(), error(nil)", value), nil
	case *compile.DoubleSpec:
		return fmt.Sprintf("%s.GetDouble(), error(nil)", value), nil
	case *compile.StringSpec:
		return fmt.Sprintf("%s.GetString(), error(nil)", value), nil
	case *compile.BinarySpec:
		return fmt.Sprintf("%s.GetBinary(), error(nil)", value), nil
	case *compile.MapSpec:
		reader, err := w.mapG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s.GetMap())", reader, value), nil
	case *compile.ListSpec:
		reader, err := w.listG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s.GetList())", reader, value), nil
	case *compile.SetSpec:
		reader, err := w.setG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s.GetSet())", reader, value), nil
	case *compile.TypedefSpec:
		reader, err := w.typedefG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s)", reader, value), nil
	case *compile.EnumSpec:
		reader, err := w.enumG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s)", reader, value), nil
	case *compile.StructSpec:
		reader, err := w.structG.Reader(g, s)
		if err != nil {
			return "", err
		}
		return fmt.Sprintf("%s(%s)", reader, value), nil
	default:
		panic(fmt.Sprintf("Unknown TypeSpec (%T) %v", spec, spec))
	}
}
1308234
func (r *EdgesRequest) fromHTTP(req *http.Request) {
	r.ToRef = httputil.MustGetBlobRef(req, "blobref")
}
176903
func (r *ClaimsRequest) fromHTTP(req *http.Request) {
	r.Permanode = httputil.MustGetBlobRef(req, "permanode")
	r.AttrFilter = req.FormValue("attrFilter")
}