# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass
# 
# class UnboundObject(OneCodexException):
#     """To use against the One Codex server, all classes must be derived from an Api() instance."""
# 
#     pass


import click
import inspect
import os
import requests
from onecodex.exceptions import OneCodexException, UnboundObject
    from onecodex.models import OneCodexBase  # in here to prevent circular import
        from requests.adapters import HTTPAdapter
        from requests.packages.urllib3.util.retry import Retry
        return {"$ref": search_value._resource._uri}
    return search_value


def check_bind(self_or_cls):
    if not hasattr(self_or_cls, "_resource"):
        name = "class" if inspect.isclass(self_or_cls) else "instance"
        raise UnboundObject("This {} is not associated with an API binding.".format(name))


def generate_potion_sort_clause(sort_items, sort_schema):
    if sort_items is None:
        return {}

    if not isinstance(sort_items, list):
        sort_items = [sort_items]

    sort_clause = {}
    for item in sort_items:
        if item.lstrip("^") not in sort_schema:
            raise AttributeError("Attribute {} can not be sorted on".format(item.lstrip("^")))
        if item.startswith("^"):
            sort_clause[item[1:]] = False
        else:
            sort_clause[item] = True
    return sort_clause


def generate_potion_keyword_where(keyword_filters, where_schema, base_class):
    where = {}

# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass
# 
# class UnboundObject(OneCodexException):
#     """To use against the One Codex server, all classes must be derived from an Api() instance."""
# 
#     pass


# Path: onecodex/models/helpers.py
import click
import inspect
import os
import requests
from onecodex.exceptions import OneCodexException, UnboundObject
    from onecodex.models import OneCodexBase  # in here to prevent circular import
        from requests.adapters import HTTPAdapter
        from requests.packages.urllib3.util.retry import Retry

        return {"$ref": search_value._resource._uri}
    return search_value


def check_bind(self_or_cls):
    if not hasattr(self_or_cls, "_resource"):
        name = "class" if inspect.isclass(self_or_cls) else "instance"
        raise UnboundObject("This {} is not associated with an API binding.".format(name))


def generate_potion_sort_clause(sort_items, sort_schema):
    if sort_items is None:
        return {}

    if not isinstance(sort_items, list):
        sort_items = [sort_items]

    sort_clause = {}
    for item in sort_items:
        if item.lstrip("^") not in sort_schema:
            raise AttributeError("Attribute {} can not be sorted on".format(item.lstrip("^")))
        if item.startswith("^"):
            sort_clause[item[1:]] = False
        else:
            sort_clause[item] = True
    return sort_clause


def generate_potion_keyword_where(keyword_filters, where_schema, base_class):
    where = {}

    for keyword in keyword_filters: