Converts the given order specification to a CQL order expression.
969198
def make_order_string(cls, order_specification):
        
        registry = get_current_registry()
        visitor_cls = registry.getUtility(IOrderSpecificationVisitor,
                                          name=EXPRESSION_KINDS.CQL)
        visitor = visitor_cls()
        order_specification.accept(visitor)
        return str(visitor.expression)
112726
function getOrderByType({ name }, fields) {
  if (!orderByTypes[name]) {
    // save new enum
    orderByTypes[name] = new GraphQLEnumType({
      name: `orderBy${name}`,
      values: reduce(fields, (values, field) => {
        if (field.type instanceof GraphQLScalarType) {
          const upperCaseName = field.name.toUpperCase();
          values[`${upperCaseName}_ASC`] = {
            name: `${upperCaseName}_ASC`,
            value: {
              [field.name]: 1
            }
          };
          values[`${upperCaseName}_DESC`] = {
            name: `${upperCaseName}_DESC`,
            value: {
              [field.name]: -1
            }
          };
        }

        return values;
      }, {})
    });
  }
  return orderByTypes[name];
}
407685
def preorder_iter_with_position(expression):
    
    yield expression, ()
    if isinstance(expression, Operation):
        for i, operand in enumerate(op_iter(expression)):
            for child, pos in preorder_iter_with_position(operand):
                yield child, (i, ) + pos
504803
def order_by(self, order_by: Union[set, str]):
        """"""
        clone = self._clone()
        if isinstance(order_by, str):
            order_by = {order_by}

        clone._order_by = clone._order_by.union(order_by)

        return clone
1016436
def _make_order(field_path, direction):
        """"""
        return query_pb2.StructuredQuery.Order(
            field=query_pb2.StructuredQuery.FieldReference(field_path=field_path),
            direction=_enum_from_direction(direction),
        )
685521
public void buildOrderByClause(StringBuilder builder, String field, Object orderType, boolean useToken)
    {
        builder.append(SPACE_STRING);
        builder.append(SORT_CLAUSE);
        builder = ensureCase(builder, field, useToken);
        builder.append(SPACE_STRING);
        builder.append(orderType);
    }
551207
public OrderBy buildOrderBy(IAssetType assetType,
                                IAttributeDefinition defaultOrderBy) {
        OrderBy order = new OrderBy();

        if (orderBy.size() > 0) {

            for (String s : orderBy) {
                order.minorSort(assetType
                        .getAttributeDefinition(resolvePropertyName(s)),
                        OrderBy.Order.Ascending);
            }
        } else {
            if (defaultOrderBy != null)
                order.minorSort(defaultOrderBy, OrderBy.Order.Ascending);
        }
        return order;
    }
348730
protected function parseOrder(Query $query, $order)
    {
        foreach ($order as $key => $val) {
            if ($val instanceof Expression) {
                $array[] = $val->getValue();
            } elseif (is_array($val) && preg_match('/^[\w\.]+$/', $key)) {
                $array[] = $this->parseOrderField($query, $key, $val);
            } elseif ('[rand]' == $val) {
                $array[] = $this->parseRand($query);
            } elseif (is_string($val)) {
                if (is_numeric($key)) {
                    list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' ');
                } else {
                    $sort = $val;
                }

                if (preg_match('/^[\w\.]+$/', $key)) {
                    $sort    = strtoupper($sort);
                    $sort    = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
                    $array[] = $this->parseKey($query, $key, true) . $sort;
                } else {
                    throw new Exception('order express error:' . $key);
                }
            }
        }

        return empty($array) ? '' : ' ORDER BY ' . implode(',', $array);
    }
677421
public Swagger2MarkupConfigBuilder withDefinitionOrdering(OrderBy orderBy) {
        Validate.notNull(orderBy, "%s must not be null", "orderBy");
        Validate.isTrue(orderBy != OrderBy.CUSTOM, "You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
        config.definitionOrderBy = orderBy;
        return this;
    }
578166
def get_ordering(self):
        """"""
        if self.sorting_field:
            return [self.sorting_field]
        prefix = self.get_prefix()
        fields = self.get_ordering_with_prefix()
        if self.prefix:
            fields = [f.replace(prefix, "", 1) for f in fields]
        return [
            f
            for f in fields
            if f.lstrip("-") in self.get_ordering_fields_lookups()
        ]
224521
private void _buildOrderClause(
                    final List<Order> orders,
                    final StringBuilder stmt
                    )
    {
        int  n_orders = (orders == null ? 0 : orders.size());
        if (n_orders == 0) {
            return;
        }

        stmt.append( _ORDER_BY_ );
        for (int  i = 0; i < n_orders; i++) {
            if (i > 0) {
                stmt.append( "," );
            }

            final Order  order = orders.get( i );
            _buildProperty( order.getProperty(), stmt );
            //throws SearchException

            if (order.isDescending()) {
                stmt.append( _DESC_ );
            }
        }
    }
859845
def group_order(tlist):
    """"""
    tidx, token = tlist.token_next_by(t=T.Keyword.Order)
    while token:
        pidx, prev_ = tlist.token_prev(tidx)
        if imt(prev_, i=sql.Identifier, t=T.Number):
            tlist.group_tokens(sql.Identifier, pidx, tidx)
            tidx = pidx
        tidx, token = tlist.token_next_by(t=T.Keyword.Order, idx=tidx)
139280
protected function getOrderingsByField(string $field, array $values, string $order = QueryInterface::ORDER_DESCENDING): array {
    $orderings = [];

    if (!empty($values)) {
      foreach ($values as $value) {
        $orderings["$field={$value}"] = $order;
      }
    }

    return $orderings;
  }
479879
def ReqOrderAction(self, OrderID: str):
        
        of = self.orders[OrderID]

        if not of:
            return -1
        else:
            pOrderId = of.OrderID
            return self.t.ReqOrderAction(
                self.broker,
                self.investor,
                OrderRef=pOrderId.split('|')[2],
                FrontID=int(pOrderId.split('|')[1]),
                SessionID=int(pOrderId.split('|')[0]),
                InstrumentID=of.InstrumentID,
                ActionFlag=TThostFtdcActionFlagType.THOST_FTDC_AF_Delete)
889900
public static <S extends Storable> OrderingList<S> get(OrderedProperty<S>... orderings) {
        OrderingList<S> list = emptyList();
        if (orderings != null && orderings.length > 0) {
            for (OrderedProperty<S> property : orderings) {
                list = list.concat(property);
            }
        }
        return list;
    }
712875
public Query orderby(final Expression... orderbyColumns) {
        if (orderbyColumns == null) {
            return this;
        }

        return orderby(Arrays.asList(orderbyColumns));
    }
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