The order of prirorities are ac_dict, backend specific dict class
        option, ac_ordered.

        :param options: Keyword options may contain 'ac_ordered'.
        :return: Factory (class or function) to make an container.
351914
def _container_factory(self, **options):
        
        ac_dict = options.get("ac_dict", False)
        _dicts = [x for x in (options.get(o) for o in self.dict_options())
                  if x]

        if self.dict_options() and ac_dict and callable(ac_dict):
            return ac_dict  # Higher priority than ac_ordered.
        if _dicts and callable(_dicts[0]):
            return _dicts[0]
        if self.ordered() and options.get("ac_ordered", False):
            return anyconfig.compat.OrderedDict

        return dict
720680
def sort(self, attribut, order=False):
        
        value_default = formats.ASSOCIATION[attribut][3]

        if type(value_default) is str:  # case insensitive sort
            get = lambda d : (d[attribut] or value_default).casefold()
        elif type(value_default) is dict: #can't sort dicts
            def get(d):
                u = d[attribut] or value_default
                return [str(u[i]) for i in sorted(u.keys())]
        else:
            get = lambda d : d[attribut] or value_default

        list.sort(self, key=get, reverse=order)
227350
def options(self, **kwds):
        
        opts = dict(self.opts)
        for k in kwds:
            try:
                # Ensure that the key exists because we want to change
                # existing options, not add new ones.
                _ = opts[k]
            except KeyError:
                raise ValueError("invalid option {!r}".format(k))
            opts[k] = kwds[k]
        return type(self)(self.cls, opts, self.kwargs)
1184268
def order(self):
        
        from ..resources.orders import Order
        url = self._get_link('order')
        if url:
            resp = self.client.orders.perform_api_call(self.client.orders.REST_READ, url)
            return Order(resp, self.client)
381983
def dict(self):
        
        SKIP_KEYS = ('_source_table', '_dest_table', 'd_vid', 't_vid', 'st_id',
                     'dataset', 'hash', 'process_records')
        return OrderedDict([(k, getattr(self, k)) for k in self.properties if k not in SKIP_KEYS])
1147234
def prior_tuples_ordered_by_id(self):
        
        return sorted(list(self.prior_tuples), key=lambda prior_tuple: prior_tuple.prior.id)
357702
def creation_ordered(class_to_decorate):
    

    next_index = functools.partial(next, itertools.count())

    __init__orig = class_to_decorate.__init__

    @functools.wraps(__init__orig, assigned=['__doc__'])
    def __init__(self, *args, **kwargs):
        object.__setattr__(self, '_index', next_index())
        __init__orig(self, *args, **kwargs)

    setattr(class_to_decorate, '__init__', __init__)

    # noinspection PyProtectedMember
    def __lt__(self, other):
        return self._index < other._index  # pragma: no mutate

    setattr(class_to_decorate, '__lt__', __lt__)

    class_to_decorate = functools.total_ordering(class_to_decorate)

    return class_to_decorate
38537
def get_order(self):
        
        # first get the filtered attributes in order as they must appear
        # in the order_by first
        if not self.has_order:
            return None
        filter_order_clauses = OrderedDict([(filter_attr[0], None)
                                            for filter_attr in self._filters
                                            if isinstance(filter_attr, tuple)])

        # any order_by attribute that appears in the filters is ignored
        order_by_dict = self._order_by.copy()
        for filter_oc in filter_order_clauses.keys():
            direction = order_by_dict.pop(filter_oc, None)
            filter_order_clauses[filter_oc] = direction

        filter_order_clauses.update(
            order_by_dict)  # append any remaining order_by clause

        if filter_order_clauses:
            return ','.join(['{} {}'.format(attribute,
                                            direction if direction else '')
                            .strip()
                             for attribute, direction in
                             filter_order_clauses.items()])
        else:
            return None
919445
def GetOrderKey(self):
    
    context_attributes = ['_type']
    context_attributes.extend(ExceptionWithContext.CONTEXT_PARTS)
    context_attributes.extend(self._GetExtraOrderAttributes())

    tokens = []
    for context_attribute in context_attributes:
      tokens.append(getattr(self, context_attribute, None))
    return tokens
306680
def order_results_by(*fields):
    
    def decorator(f):
        @functools.wraps(f)
        def wrapper(*args, **kw):
            result = f(*args, **kw)
            return result.order_by(*fields)
        return wrapper
    return decorator
143785
def order(self, last):
        ''''''
        desc = last.desc
        field = last.name
        nested = last.nested
        nested_args = []
        while nested:
            meta = nested.model._meta
            nested_args.extend((self.backend.basekey(meta), nested.name))
            last = nested
            nested = nested.nested
        method = 'ALPHA' if last.field.internal_type == 'text' else ''
        if field == last.model._meta.pkname():
            field = ''
        return {'field': field,
                'method': method,
                'desc': desc,
                'nested': nested_args}
235897
def _get_order_by(self, request):
        
        attr = request.params.get('sort', request.params.get('order_by'))
        if attr is None or not hasattr(self.mapped_class, attr):
            return None
        if request.params.get('dir', '').upper() == 'DESC':
            return desc(getattr(self.mapped_class, attr))
        else:
            return asc(getattr(self.mapped_class, attr))
1286280
def sorted(cls, items, orders):
    ''''''
    return sorted(items, cmp=cls.multipleOrderComparison(orders))
797289
def add_order(opts={})
      required_opts = %w{ pair type ordertype volume }
      leftover = required_opts - opts.keys.map(&:to_s)
      if leftover.length > 0
        raise ArgumentError.new("Required options, not given. Input must include #{leftover}")
      end
      post_private 'AddOrder', opts
    end
965222
def get_config_dict(self):
        
        return OrderedDict((prop, getattr(self, prop)) for prop in self._instance.CONFIG_PARAMS)
152134
def order(*args)
      options = args.extract_options!
      if options.empty? && args.count == 1
        __new_relation__(all.sort_by { |item| item.send(args.first) })
      else
        __new_relation__(Sort.order_mixed_args(all, args, options))
      end
    end
1362702
def order(self):
        
        d = {}
        for (i, x) in enumerate(self):
            if x.is_gap:
                continue
            xid = x.component_id
            d[xid] = (i, x)

            xid = xid.rsplit(".", 1)[0]  # Remove Genbank version
            if xid not in d:
                d[xid] = (i, x)

        return d