# Path: lepo/utils.py
# def maybe_resolve(object, resolve):
#     """
#     Call `resolve` on the `object`'s `$ref` value if it has one.
# 
#     :param object: An object.
#     :param resolve: A resolving function.
#     :return: An object, or some other object! :sparkles:
#     """
#     if isinstance(object, dict) and object.get('$ref'):
#         return resolve(object['$ref'])
#     return object


from collections.__init__ import OrderedDict
from django.utils.functional import cached_property
from lepo.utils import maybe_resolve
    @cached_property
    def parameters(self):
        """
        Combined path-level and operation-level parameters.

        Any $refs are resolved here.

        Note that this implementation differs from the spec in that we only use
        the _name_ of a parameter to consider its uniqueness, not the name and location.

        This is because we end up passing parameters to the handler by name anyway,
        so any duplicate names, even if they had different locations, would be horribly mangled.

        :rtype: list[Parameter]
        """
        return list(self.get_parameter_dict().values())

    def get_parameter_dict(self):
        parameters = OrderedDict()
        for parameter in self._get_regular_parameters():
            parameters[parameter.name] = parameter
        return parameters

    def _get_regular_parameters(self):
        for source in (
            self.path.mapping.get('parameters', ()),
            self.data.get('parameters', {}),
        ):
            source = maybe_resolve(source, self.api.resolve_reference)
            for parameter in source:

# Path: lepo/utils.py
# def maybe_resolve(object, resolve):
#     """
#     Call `resolve` on the `object`'s `$ref` value if it has one.
# 
#     :param object: An object.
#     :param resolve: A resolving function.
#     :return: An object, or some other object! :sparkles:
#     """
#     if isinstance(object, dict) and object.get('$ref'):
#         return resolve(object['$ref'])
#     return object


# Path: lepo/apidef/operation/base.py
from collections.__init__ import OrderedDict
from django.utils.functional import cached_property
from lepo.utils import maybe_resolve

    @cached_property
    def parameters(self):
        """
        Combined path-level and operation-level parameters.

        Any $refs are resolved here.

        Note that this implementation differs from the spec in that we only use
        the _name_ of a parameter to consider its uniqueness, not the name and location.

        This is because we end up passing parameters to the handler by name anyway,
        so any duplicate names, even if they had different locations, would be horribly mangled.

        :rtype: list[Parameter]
        """
        return list(self.get_parameter_dict().values())

    def get_parameter_dict(self):
        parameters = OrderedDict()
        for parameter in self._get_regular_parameters():
            parameters[parameter.name] = parameter
        return parameters

    def _get_regular_parameters(self):
        for source in (
            self.path.mapping.get('parameters', ()),
            self.data.get('parameters', {}),
        ):
            source = maybe_resolve(source, self.api.resolve_reference)
            for parameter in source:

                parameter_data = maybe_resolve(parameter, self.api.resolve_reference)