// getAssigner returns a callback that can assign the given starlark value to
// a go value of the given type, or an error if such assignment is not allowed
// due to incompatible types.
352364
func getAssigner(typ reflect.Type, sv starlark.Value) (func(reflect.Value) error, error) {
	if err := refuseProto2(typ); err != nil {
		return nil, err
	}

	switch val := sv.(type) {
	case starlark.NoneType:
		return nil, fmt.Errorf("can't assign nil to %s", typDesc(typ))

	case starlark.Bool:
		if typ.Kind() != reflect.Bool {
			return nil, fmt.Errorf("can't assign boolean to %s", typDesc(typ))
		}
		return func(gv reflect.Value) error {
			gv.SetBool(bool(val))
			return nil
		}, nil

	case starlark.Float:
		if typ.Kind() != reflect.Float64 && typ.Kind() != reflect.Float32 {
			return nil, fmt.Errorf("can't assign float to %s", typDesc(typ))
		}
		return func(gv reflect.Value) error {
			gv.SetFloat(float64(val))
			return nil
		}, nil

	case starlark.Int:
		// Assigning integer to a float field? Cast to float first.
		if typ.Kind() == reflect.Float64 || typ.Kind() == reflect.Float32 {
			return getAssigner(typ, val.Float())
		}
		// Otherwise check that assigning to an int, and the value is in range.
		intRange, ok := intRanges[typ.Kind()]
		if !ok {
			return nil, fmt.Errorf("can't assign integer to %s", typDesc(typ))
		}
		if intRange.signed {
			asInt64, ok := val.Int64()
			if !ok || asInt64 > intRange.maxSigned || asInt64 < intRange.minSigned {
				return nil, fmt.Errorf("the integer %s doesn't fit into %s", val, typ.Kind())
			}
			return func(gv reflect.Value) error {
				gv.SetInt(asInt64)
				return nil
			}, nil
		} else {
			asUint64, ok := val.Uint64()
			if !ok || asUint64 > intRange.maxUnsigned || asUint64 < 0 {
				return nil, fmt.Errorf("the integer %s doesn't fit into %s", val, typ.Kind())
			}
			return func(gv reflect.Value) error {
				gv.SetUint(asUint64)
				return nil
			}, nil
		}

	case starlark.String:
		if typ.Kind() != reflect.String {
			return nil, fmt.Errorf("can't assign string to %s", typDesc(typ))
		}
		return func(gv reflect.Value) error {
			gv.SetString(string(val))
			return nil
		}, nil

	case *starlark.List, starlark.Tuple:
		if typ.Kind() != reflect.Slice {
			return nil, fmt.Errorf("can't assign list to %s", typDesc(typ))
		}
		return func(gv reflect.Value) error {
			slice := reflect.MakeSlice(gv.Type(), 0, 0) // ~ slice := []T{}

			iter := starlark.Iterate(val)
			defer iter.Done()

			var staritm starlark.Value
			var idx int

			for iter.Next(&staritm) {
				goitm := reflect.New(gv.Type().Elem()).Elem() // ~ goitm := T{}
				if err := assign(goitm, staritm); err != nil {
					return fmt.Errorf("list item #%d - %s", idx, err)
				}
				slice = reflect.Append(slice, goitm)
				idx++
			}

			gv.Set(slice)
			return nil
		}, nil

	case *Message:
		// 'typ' is expected to be *Struct{}
		if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {
			return nil, fmt.Errorf("can't assign proto struct to %s", typDesc(typ))
		}
		rightTyp := val.MessageType().Type() // also should be *Struct{}
		if typ != rightTyp {
			return nil, fmt.Errorf("can't assign %s to %s", typDesc(rightTyp), typDesc(typ))
		}
		return func(gv reflect.Value) error {
			rightMsg, err := val.ToProto()
			if err != nil {
				return err
			}
			gv.Set(reflect.ValueOf(rightMsg))
			return nil
		}, nil

	case *starlark.Dict:
		// 'typ' is expected to be a map.
		if typ.Kind() != reflect.Map {
			return nil, fmt.Errorf("can't assign a dict to %s", typDesc(typ))
		}
		return func(gv reflect.Value) error {
			mapKeyTyp := typ.Key()
			mapValTyp := typ.Elem()

			m := reflect.MakeMapWithSize(typ, val.Len()) // ~ m := make(map[k]v, len(val))
			for _, kv := range val.Items() {
				k := reflect.New(mapKeyTyp).Elem()
				if err := assign(k, kv[0]); err != nil {
					return fmt.Errorf("bad key %s - %s", kv[0], err)
				}
				v := reflect.New(mapValTyp).Elem()
				if err := assign(v, kv[1]); err != nil {
					return fmt.Errorf("bad value at key %s - %s", kv[0], err)
				}
				m.SetMapIndex(k, v)
			}

			gv.Set(m)
			return nil
		}, nil
	}

	return nil, fmt.Errorf("don't know how to handle starlark value of type %q", sv.Type())
}
1149781
func (c *FlickrClient) getSignature(token_secret string) string {
	key := fmt.Sprintf("%s&%s", url.QueryEscape(c.ApiSecret), url.QueryEscape(token_secret))
	base_string := c.getSigningBaseString()

	mac := hmac.New(sha1.New, []byte(key))
	mac.Write([]byte(base_string))

	ret := base64.StdEncoding.EncodeToString(mac.Sum(nil))

	return ret
}
1249037
func (mgr *IdentityManager) GetSigningIdentity(id string) (msp.SigningIdentity, error) {
	user, err := mgr.GetUser(id)
	if err != nil {
		return nil, err
	}
	return user, nil
}
381629
func ConvertAssignDefault(src Value, dest interface{}, defaultValue interface{}) error {
	if src.IsNull() {
		// This is not the most efficient way of doing things, but it's certainly cleaner
		v, err := BuildValue(defaultValue)
		if err != nil {
			return err
		}
		return ConvertAssign(v, dest)
	}
	return ConvertAssign(src, dest)
}
749171
func (a *Client) GetNodesIdentifier(params *GetNodesIdentifierParams, authInfo runtime.ClientAuthInfoWriter) (*GetNodesIdentifierOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetNodesIdentifierParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetNodesIdentifier",
		Method:             "GET",
		PathPattern:        "/nodes/{identifier}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetNodesIdentifierReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetNodesIdentifierOK), nil
}
127237
func (a *Client) GetCatalogsIdentifier(params *GetCatalogsIdentifierParams, authInfo runtime.ClientAuthInfoWriter) (*GetCatalogsIdentifierOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetCatalogsIdentifierParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetCatalogsIdentifier",
		Method:             "GET",
		PathPattern:        "/catalogs/{identifier}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetCatalogsIdentifierReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetCatalogsIdentifierOK), nil
}
454468
func (m *MockClient) GetRegistrar() dosa.Registrar {
	ret := m.ctrl.Call(m, "GetRegistrar")
	ret0, _ := ret[0].(dosa.Registrar)
	return ret0
}
1222513
func (a *AdapterMock) GetMockErr() error {
	var returnError error
	if a.errorValue != "" {
		returnError = errors.New(a.errorValue)
	}
	return returnError
}
1319849
func getSignature(t reflect.Type) string {
	// handle simple types first
	switch t.Kind() {
	case reflect.Uint8:
		return "y"
	case reflect.Bool:
		return "b"
	case reflect.Int16:
		return "n"
	case reflect.Uint16:
		return "q"
	case reflect.Int, reflect.Int32:
		if t == unixFDType {
			return "h"
		}
		return "i"
	case reflect.Uint, reflect.Uint32:
		if t == unixFDIndexType {
			return "h"
		}
		return "u"
	case reflect.Int64:
		return "x"
	case reflect.Uint64:
		return "t"
	case reflect.Float64:
		return "d"
	case reflect.Ptr:
		return getSignature(t.Elem())
	case reflect.String:
		if t == objectPathType {
			return "o"
		}
		return "s"
	case reflect.Struct:
		if t == variantType {
			return "v"
		} else if t == signatureType {
			return "g"
		}
		var s string
		for i := 0; i < t.NumField(); i++ {
			field := t.Field(i)
			if field.PkgPath == "" && field.Tag.Get("dbus") != "-" {
				s += getSignature(t.Field(i).Type)
			}
		}
		return "(" + s + ")"
	case reflect.Array, reflect.Slice:
		return "a" + getSignature(t.Elem())
	case reflect.Map:
		if !isKeyType(t.Key()) {
			panic(InvalidTypeError{t})
		}
		return "a{" + getSignature(t.Key()) + getSignature(t.Elem()) + "}"
	case reflect.Interface:
		return "v"
	}
	panic(InvalidTypeError{t})
}
1192298
func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}
	var assignees []*User
	resp, err := s.client.Do(ctx, req, &assignees)
	if err != nil {
		return nil, resp, err
	}

	return assignees, resp, nil
}
1102420
func NewSigner(conf Config) (*Signer, error) {
	sId, err := serializeIdentity(conf.IdentityPath, conf.MSPID)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	key, err := loadPrivateKey(conf.KeyPath)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	return &Signer{
		Creator: sId,
		key:     key,
	}, nil
}
1019914
func (repo *Repository) GetAssigneeByID(userID int64) (*User, error) {
	return GetAssigneeByID(repo, userID)
}
415136
func requireAssignable(dst, src reflect.Value) error {
	if dst.Kind() != reflect.Ptr && dst.Kind() != reflect.Interface {
		return fmt.Errorf("abi: cannot unmarshal %v into %v", src.Type(), dst.Type())
	}
	return nil
}
1134866
func NewSignerFromConfig(cfg ocspConfig.Config) (ocsp.Signer, error) {
	return ocsp.NewSignerFromFile(cfg.CACertFile, cfg.ResponderCertFile,
		cfg.KeyFile, cfg.Interval)
}
1244869
func RequestSigner(id, key string) Handler {
	return Handler{
		Name: "RequestSigner",
		Fn: func(r *Request) {
			r.Error = httpsignatures.DefaultSha256Signer.SignRequest(id, key, r.HTTPRequest)
		},
	}
}
882122
func (_class AuthClass) GetSubjectIdentifier(sessionID SessionRef, subjectName string) (_retval string, _err error) {
	_method := "auth.get_subject_identifier"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_subjectNameArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "subject_name"), subjectName)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _subjectNameArg)
	if _err != nil {
		return
	}
	_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
	return
}
881991
func (s storageclient) GetSignedURLs(context.Context, *coordinator.URLSigningRequest) (*coordinator.URLSigningResponse, error) {
	return nil, errors.New("NOT IMPLEMENTED")
}