// UnmarshalMap is an alias for Unmarshal which unmarshals from
// a map of AttributeValues.
//
// The output value provided must be a non-nil pointer
9266
func UnmarshalMap(m map[string]*dynamodb.AttributeValue, out interface{}) error {
	return NewDecoder().Decode(&dynamodb.AttributeValue{M: m}, out)
}
351789
func (r *Redis) Unmarshal(key string, object interface{}) error {
	value, err := r.Get(key)
	if err == nil {
		err = json.Unmarshal([]byte(value), object)
	}
	return err
}
295104
func UnmarshalTags(tags []string) (map[string]string, error) {
	result := make(map[string]string)
	for _, tag := range tags {
		parts := strings.SplitN(tag, "=", 2)
		if len(parts) != 2 || len(parts[0]) == 0 {
			return nil, fmt.Errorf("Invalid tag: '%s'", tag)
		}
		result[parts[0]] = parts[1]
	}
	return result, nil
}
1176538
func (x *Basic) UnmarshalJSON(data []byte) (err error) {
	x2 := basic{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = Basic(x2)
		return x.checkResourceType()
	}
	return
}
518333
func (x *DocumentReference) UnmarshalJSON(data []byte) (err error) {
	x2 := documentReference{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = DocumentReference(x2)
		return x.checkResourceType()
	}
	return
}
1036766
func (m *Manager) UnmarshalOption(name string, v interface{}) error {
	value := m.Get(name)
	if value == nil {
		return errors.Format("option [%v] is not found", name)
	}

	vt := reflect.TypeOf(v)
	if vt.Kind() != reflect.Ptr {
		return errors.New("v must be a pointer")
	}

	vv := reflect.ValueOf(v).Elem()
	return unmarshalValue(vv, value)
}
215478
func Unmap(data []byte) error {
	if data == nil {
		return nil
	}
	return syscall.Munmap(data)
}
1370378
func (s *Serializer) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
9155
func (a *VariableArguments) UnmarshalJSON(data []byte) error {
	type Alias VariableArguments
	aux := struct{ *Alias }{Alias: (*Alias)(a)}

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

	// Decode the polymorphic VariableArguments.Values field into the approriate struct
	switch aux.Type {
	case "constant":
		values, ok := aux.Values.([]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableConstantArguments", aux.Values)
		}

		variableValues := make(VariableConstantValues, len(values))
		for i, v := range values {
			if _, ok := v.(string); !ok {
				return fmt.Errorf("expected variable constant value to be string but received %T", v)
			}
			variableValues[i] = v.(string)
		}

		a.Values = variableValues
	case "map":
		values, ok := aux.Values.(map[string]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableMapArguments", aux.Values)
		}

		variableValues := VariableMapValues{}
		for k, v := range values {
			if _, ok := v.(string); !ok {
				return fmt.Errorf("expected variable map value to be string but received %T", v)
			}
			variableValues[k] = v.(string)
		}

		a.Values = variableValues
	case "query":
		values, ok := aux.Values.(map[string]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableQueryArguments", aux.Values)
		}

		variableValues := VariableQueryValues{}

		query, prs := values["query"]
		if !prs {
			return fmt.Errorf("\"query\" key not present in VariableQueryArguments")
		}
		if _, ok := query.(string); !ok {
			return fmt.Errorf("expected \"query\" to be string but received %T", query)
		}

		language, prs := values["language"]
		if !prs {
			return fmt.Errorf("\"language\" key not present in VariableQueryArguments")
		}
		if _, ok := language.(string); !ok {
			return fmt.Errorf("expected \"language\" to be string but received %T", language)
		}

		variableValues.Query = query.(string)
		variableValues.Language = language.(string)
		a.Values = variableValues
	default:
		return fmt.Errorf("unknown VariableArguments type %s", aux.Type)
	}

	return nil
}
310208
func (*yamlMarshaller) Unmarshal(data []byte, v interface{}) error {
	return yaml.Unmarshal(data, v)
}
1177019
func (args Args) UnmarshalJSON(raw []byte) error {
	if len(raw) == 0 {
		return nil
	}
	return json.Unmarshal(raw, &args.fields)
}
218975
func (m *Mapping) UnmarshalJSON(data []byte) error {
	var rawmapping map[string]map[string]interface{}
	if err := json.Unmarshal(data, &rawmapping); err != nil {
		return err
	}
	if mapping, err := newMapping(rawmapping); err != nil {
		return err
	} else {
		m.Name = mapping.Name
		m.Entries = mapping.Entries
	}
	return nil
}
1227981
func (s *MapEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
	s.parts = map[string]string{}
	err := unmarshal(&s.parts)
	if err == nil {
		return nil
	}

	var slice []string
	err = unmarshal(&slice)
	if err != nil {
		return err
	}
	for _, v := range slice {
		parts := strings.SplitN(v, "=", 2)
		if len(parts) == 2 {
			key := parts[0]
			val := parts[1]
			s.parts[key] = val
		}
	}
	return nil
}
334117
func (a *Attribute) unmarshal(b []byte) error {
	if len(b) < nlaHeaderLen {
		return errInvalidAttribute
	}

	a.Length = nlenc.Uint16(b[0:2])
	a.Type = nlenc.Uint16(b[2:4])

	if int(a.Length) > len(b) {
		return errInvalidAttribute
	}

	switch {
	// No length, no data
	case a.Length == 0:
		a.Data = make([]byte, 0)
	// Not enough length for any data
	case int(a.Length) < nlaHeaderLen:
		return errInvalidAttribute
	// Data present
	case int(a.Length) >= nlaHeaderLen:
		a.Data = make([]byte, len(b[nlaHeaderLen:a.Length]))
		copy(a.Data, b[nlaHeaderLen:a.Length])
	}

	return nil
}
1147434
func (t *TagMap) UnmarshalJSON(data []byte) error {
	m := map[string]string{}
	if err := json.Unmarshal(data, &m); err != nil {
		return err
	}

	if len(m) == 0 {
		*t = nil
		return nil
	}

	tm := make(TagMap, len(m))
	for k, v := range m {
		if err := types.ValidateTag(k, v); err != nil {
			return err
		}
		tm[k] = v
	}

	*t = tm
	return nil
}
1265316
func (x *ImplementationGuide) UnmarshalJSON(data []byte) (err error) {
	x2 := implementationGuide{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = ImplementationGuide(x2)
		return x.checkResourceType()
	}
	return
}
76001
func Unmarshal(arg SassValue, v ...interface{}) error {
	var err error
	sv := arg.Val()
	var l int
	if libs.IsList(sv) {
		l = libs.Len(sv)
	}
	if arg.Val() == nil {
		return errors.New("I can't work with this. arg UnionSassValue must not be nil. - Unmarshaller")
	} else if len(v) == 0 {
		return errors.New("Cannot Unmarshal an empty value - Michael Scott")
	} else if len(v) > 1 {
		if len(v) < l { //check for optional arguements that are not passed and pad with nil
			return fmt.Errorf(
				"Arguments mismatch %d C arguments did not match %d",
				l, len(v))
		}
		for i := 0; i < l; i++ {
			val := libs.Index(sv, i)
			err = unmarshal(SassValue{value: val}, v[i])
			if err != nil {
				return err
			}
		}
		return err
	} else if libs.IsList(sv) &&
		getKind(v[0]) != reflect.Slice &&
		l == 1 { //arg is a slice of 1 but we want back a non slice
		val := libs.Index(sv, 0)
		return unmarshal(SassValue{value: val}, v[0])
	} else if libs.IsList(sv) &&
		getKind(v[0]) == reflect.Slice &&
		libs.IsList(libs.Index(sv, 0)) &&
		l == 1 { //arg is a list of single list and we only want back a list so we need to unwrap
		val := libs.Index(sv, 0)
		return unmarshal(SassValue{value: val}, v[0])
		//return unmarshal(C.sass_list_get_value(arg, C.size_t(0)), v[0])
	} else {
		return unmarshal(arg, v[0])
	}
}