# Path: solvebio/client.py
# def _handle_api_error(response):
# def _handle_request_error(e):
#     def __init__(self, token=None, token_type='Token'):
#     def __call__(self, r):
#     def __repr__(self):
#     def __init__(self, host=None, token=None, token_type='Token',
#                  include_resources=True):
#     def set_host(self, host=None):
#     def set_token(self, token=None, token_type='Token'):
#     def set_user_agent(self, name=None, version=None):
#     def whoami(self):
#     def get(self, url, params, **kwargs):
#     def post(self, url, data, **kwargs):
#     def delete(self, url, data, **kwargs):
#     def request(self, method, url, **kwargs):
#     def _log_raw_request(self, method, url, **kwargs):
#     def __repr__(self):
# class SolveTokenAuth(AuthBase):
# class SolveClient(object):
# 
# Path: solvebio/resource/util.py
# def camelcase_to_underscore(name):
# def class_to_api_name(name, pluralize=True):


import six
import sys
from ..client import client
from .util import json
    from . import types


def convert_to_solve_object(resp, **kwargs):

    _client = kwargs.pop('client', None)

    if isinstance(resp, list):
        return [convert_to_solve_object(i, client=_client) for i in resp]
    elif isinstance(resp, dict) and not isinstance(resp, SolveObject):
        resp = resp.copy()
        klass_name = resp.get('class_name')
        if isinstance(klass_name, six.string_types):
            klass = types.get(klass_name, SolveObject)
        else:
            klass = SolveObject
        return klass.construct_from(resp, client=_client)
    else:
        return resp


class SolveObject(dict):
    """Base class for all SolveBio API resource objects"""
    ID_ATTR = 'id'

    # Allows pre-setting a SolveClient
    _client = None

    def __init__(self, id=None, **params):
        super(SolveObject, self).__init__()


# Path: solvebio/client.py
# def _handle_api_error(response):
# def _handle_request_error(e):
#     def __init__(self, token=None, token_type='Token'):
#     def __call__(self, r):
#     def __repr__(self):
#     def __init__(self, host=None, token=None, token_type='Token',
#                  include_resources=True):
#     def set_host(self, host=None):
#     def set_token(self, token=None, token_type='Token'):
#     def set_user_agent(self, name=None, version=None):
#     def whoami(self):
#     def get(self, url, params, **kwargs):
#     def post(self, url, data, **kwargs):
#     def delete(self, url, data, **kwargs):
#     def request(self, method, url, **kwargs):
#     def _log_raw_request(self, method, url, **kwargs):
#     def __repr__(self):
# class SolveTokenAuth(AuthBase):
# class SolveClient(object):
# 
# Path: solvebio/resource/util.py
# def camelcase_to_underscore(name):
# def class_to_api_name(name, pluralize=True):


# Path: solvebio/resource/solveobject.py
import six
import sys
from ..client import client
from .util import json
    from . import types



def convert_to_solve_object(resp, **kwargs):

    _client = kwargs.pop('client', None)

    if isinstance(resp, list):
        return [convert_to_solve_object(i, client=_client) for i in resp]
    elif isinstance(resp, dict) and not isinstance(resp, SolveObject):
        resp = resp.copy()
        klass_name = resp.get('class_name')
        if isinstance(klass_name, six.string_types):
            klass = types.get(klass_name, SolveObject)
        else:
            klass = SolveObject
        return klass.construct_from(resp, client=_client)
    else:
        return resp


class SolveObject(dict):
    """Base class for all SolveBio API resource objects"""
    ID_ATTR = 'id'

    # Allows pre-setting a SolveClient
    _client = None

    def __init__(self, id=None, **params):
        super(SolveObject, self).__init__()


        self._client = params.pop('client', self._client or client)