Flip basic label quadrant if needed, to avoid crossing a bent relationship line
769802
function adjustQuadrant(quadrant, point, opposite) {
		if ((opposite.x == point.x) || (opposite.y == point.y)) return quadrant;
		var flipHorizontally = [4, 3, 2, 1]
		var flipVertically = [2, 1, 4, 3]
		var oppositeQuadrant = (opposite.y < point.y) ?
							((opposite.x < point.x) ? 2 : 1) :
							((opposite.x < point.x) ? 3 : 4);
		// if an opposite relation end is in the same quadrant as a label, we need to flip the label
		if (oppositeQuadrant === quadrant) {
			if (config.direction === 'LR') return flipHorizontally[quadrant-1];
			if (config.direction === 'TD') return flipVertically[quadrant-1];
		}
		return quadrant; 	
	}
222136
function flip(fn) {
  return function() {
    var first = arguments[0];
    var second = arguments[1];
    var rest = [].slice.call(arguments, 2);
    return fn.apply(this, [second, first].concat(rest));
  };
}
962751
protected double[] alignLabels(List<ClassLabel> l1, double[] d1, Collection<ClassLabel> l2) {
    assert (l1.size() == d1.length);
    if(l1 == l2) {
      return d1.clone();
    }
    double[] d2 = new double[l2.size()];
    Iterator<ClassLabel> i2 = l2.iterator();
    for(int i = 0; i2.hasNext();) {
      ClassLabel l = i2.next();
      int idx = l1.indexOf(l);
      if(idx < 0 && getLogger().isDebuggingFiner()) {
        getLogger().debugFiner("Label not found: " + l);
      }
      d2[i] = (idx >= 0) ? d1[idx] : 0.; // Default to 0 for unknown labels!
    }
    return d2;
  }
686459
def flip(self):
        
        self._load()
        groups = self.config.keys()
        tabular = {}
        for g in groups:
            config = self.config[g]
            for k in config:
                r = tabular.get(k, {})
                r[g] = config[k]
                tabular[k] = r
        return tabular
497253
def CRPS(label, pred):
    
    for i in range(pred.shape[0]):
        for j in range(pred.shape[1] - 1):
            if pred[i, j] > pred[i, j + 1]:
                pred[i, j + 1] = pred[i, j]
    return np.sum(np.square(label - pred)) / label.size
528881
function(segment_sizes, total_size, line, layout){
        // The passes done for fitting a label, and provided tolerances for each pass
        // First straight is chosen with a low tolerance. Then curved. Then straight with a higher tolerance.
        const passes = [
            { type: 'straight', tolerance : (layout.no_curving) ? LINE_EXCEED_STRAIGHT_NO_CURVE : LINE_EXCEED_STRAIGHT },
            { type: 'curved' },
            { type: 'straight', tolerance : LINE_EXCEED_STAIGHT_LOOSE }
        ];

        // loop through passes. first label found wins.
        for (let i = 0; i < passes.length; i++){
            let check = passes[i];
            let label;
            if (check.type === 'straight'){
                label = new LabelLineStraight(total_size, line, layout, check.tolerance);
            }
            else if (check.type === 'curved' && !layout.no_curving && line.length > 2){
                label = new LabelLineCurved(segment_sizes, line, layout);
            }

            if (label && !label.throw_away) {
                return label;
            }
        }

        return false;
    }
1319257
function flipCorners(value) {
  var elements = value.split(/\s+/);

  if (!elements) { return value; }

  switch (elements.length) {
    // 5px 10px 15px 20px => 10px 5px 20px 15px
    case 4: return [elements[1], elements[0], elements[3], elements[2]].join(' ');

    // 5px 10px 20px => 10px 5px 10px 20px
    case 3: return [elements[1], elements[0], elements[1], elements[2]].join(' ');

    // 5px 10px => 10px 5px
    case 2: return [elements[1], elements[0]].join(' ');
  }

  return value;
}
812981
function cornerLine(p, quadrant, size) {

  switch (quadrant) {
    case Const.top_left: return new Pair(p).to(p.$add(size, size));
    case Const.top_right: return new Pair(p).to(p.$add(-size, size));
    case Const.bottom_left: return new Pair(p).to(p.$add(size, -size));
    case Const.bottom_right: return new Pair(p).to(p.$add(-size, -size));
    case Const.top: return new Pair(p).to(p.$add(0, size));
    case Const.bottom: return new Pair(p).to(p.$add(0, -size));
    case Const.left: return new Pair(p).to(p.$add(size, 0));
    default: return new Pair(p).to(p.$add(-size, 0));
  }
}
9370
def flip_coords(X,loop):
    
    if(loop[0]==1):
        return np.array(map(lambda i: np.array([i[2],i[1],i[0],i[5],i[4],i[3]]),X))
    else:
        return X
225567
def bbox_flip(bbox, d, rows, cols):
    
    if d == 0:
        bbox = bbox_vflip(bbox, rows, cols)
    elif d == 1:
        bbox = bbox_hflip(bbox, rows, cols)
    elif d == -1:
        bbox = bbox_hflip(bbox, rows, cols)
        bbox = bbox_vflip(bbox, rows, cols)
    else:
        raise ValueError('Invalid d value {}. Valid values are -1, 0 and 1'.format(d))
    return bbox
762644
def ensure_compatible(left, right):
    """"""
    conflicts = list(conflicting_pairs(left, right))
    if conflicts:
        raise ValueError('conflicting values for object/property pairs: %r' % conflicts)
928763
def choose_other_label(k, y):
    """"""
    return choice(list(set(range(1, k + 1)) - set([y])))
1366247
function(labels, direction, step, start_offset, font_offsets, extra_font_options) {
    function x_offset(value) {
      return value * direction[0];
    }
    
    function y_offset(value) {
      return value * direction[1];
    }
    
    /* Start at the origin */
    var x = this.x_padding_left - 1 + x_offset(start_offset),
        y = this.options.height - this.y_padding_bottom + y_offset(start_offset),
        pathString = '',
        i,
        font_options = {};
    Helpers.extend(font_options, this.font_options);
    Helpers.extend(font_options, extra_font_options || {});

    for (i = 0; i < labels.length; i++) {
      pathString += 'M' + x + ',' + y;
      if (typeof labels[i] !== 'undefined' && (labels[i] + '').length > 0) {
        pathString += 'L' + (x + y_offset(5)) + ',' + (y + x_offset(5));
        this.paper.text(x + font_offsets[0], y - font_offsets[1], labels[i]).attr(font_options).toFront();
      }
      x = x + x_offset(step);
      y = y + y_offset(step);
    }

    this.paper.path(pathString).attr({ stroke: this.options.label_colour });
  }
370194
public void flip(int x, int y) {
    int offset = y * rowSize + (x / 32);
    bits[offset] ^= 1 << (x & 0x1f);
  }
1134594
def xyzlabel(labelx, labely, labelz):
    """"""
    xlabel(labelx)
    ylabel(labely)
    zlabel(labelz)
29244
def FlipAllowed(self):
    """"""
    if not hasattr(self, 'flipped'):
      raise errors.ParseError('Not defined.')

    if not self.flipped:
      return

    if self.current_expression.operator:
      if not self.current_expression.operator.lower() in (
          'is', 'contains', 'inset', 'equals'):
        raise errors.ParseError(
            'Keyword \'not\' does not work against operator: {0:s}'.format(
                self.current_expression.operator))
286677
def inverted(self):
        
        out = self.copy()
        out.setInverted(not self.isInverted())
        return out