Compute an exclusive split (i.e. 'feature' '==' 'val')
545745
@Override protected Split eqSplit(int col, Data d, int[] dist, int distWeight, Random rand) {
    final int[] distR = new int[d.classes()], distL = dist.clone();
    final double upperBoundReduction = upperBoundReduction(d.classes());
    double maxReduction = -1;
    int bestSplit = -1;
    int min = d.colMinIdx(col);
    int max = d.colMaxIdx(col);
    for (int i = min; i < max+1; ++i) {
      for (int j = 0; j < distR.length; ++j) {
        int v = _columnDists[col][i][j];
        distL[j] += distR[j];
        distR[j] = v;
        distL[j] -= v;
      }
      int totL = 0, totR = 0;
      for (int e: distL) totL += e;
      if (totL == 0)   continue;
      for (int e: distR) totR += e;
      if (totR == 0) continue;
      double eL = 0, eR = 0;
      for (int e: distL) eL += gain(e,totL);
      for (int e: distR) eR += gain(e,totR);
      double eReduction = upperBoundReduction - ( (eL * totL + eR * totR) / (totL + totR) );

      if (eReduction == maxReduction){
        if (rand.nextInt(10)<2) bestSplit=i; // randomly pick one out of several
      } else if (eReduction > maxReduction) {
        bestSplit = i;  maxReduction = eReduction;
      }
      if (i==0 && d.columnArity(col) == 1) break; // for boolean features, only one split needs to be evaluated
    }
    return bestSplit == -1
            ? Split.impossible(Utils.maxIndex(dist,_random))
            : Split.exclusion(col,bestSplit,maxReduction);
  }
418857
function isDiffable (val) {
  switch (getType(val)) {
    case 'array':
    case 'object':
      return true

    case 'string':
      return val.length >= 40 || (val.trim().match(/\n/g) || []).length >= 1

    default:
      return false
  }
}
79658
def _simplify_feature_value(self, name, value):
        """"""
        if name == 'prefix':
            channel_modes, channel_chars = value.split(')')
            channel_modes = channel_modes[1:]

            # [::-1] to reverse order and go from lowest to highest privs
            value = OrderedDict(list(zip(channel_modes, channel_chars))[::-1])

            return value

        elif name == 'chanmodes':
            value = value.split(',')
            return value

        elif name == 'targmax':
            max_available = {}
            for sort in value.split(','):
                command, limit = sort.split(':')
                command = command.casefold()
                max_available[command] = limit_to_number(limit)

            return max_available

        elif name == 'chanlimit':
            limit_available = {}
            for sort in value.split(','):
                chan_types, limit = sort.split(':')
                for prefix in chan_types:
                    limit_available[prefix] = limit_to_number(limit)

            return limit_available

        elif name in _limits:
            value = limit_to_number(value)
            return value

        else:
            return value
193281
def split(orig, sep=None):
    '''
    
    '''
    exp = re.compile(r'\s+' if sep is None else re.escape(sep))
    pos = 0
    length = len(orig)
    while True:
        match = exp.search(orig, pos)
        if not match:
            if pos < length or sep is not None:
                val = orig[pos:]
                if val:
                    # Only yield a value if the slice was not an empty string,
                    # because if it is then we've reached the end. This keeps
                    # us from yielding an extra blank value at the end.
                    yield val
            break
        if pos < match.start() or sep is not None:
            yield orig[pos:match.start()]
        pos = match.end()
28545
def split(self):
        
        if self.package_request.conflict or (len(self.variant_slice) == 1):
            return None
        else:
            r = self.variant_slice.split()
            if r is None:
                return None
            else:
                slice, next_slice = r
                scope = self._copy(slice)
                next_scope = self._copy(next_slice)
                return (scope, next_scope)
1230101
def validate_value_string (f, value_string):
    
    assert isinstance(f, Feature)
    assert isinstance(value_string, basestring)
    if f.free or value_string in f.values:
        return

    values = [value_string]

    if f.subfeatures:
        if not value_string in f.values and \
               not value_string in f.subfeatures:
            values = value_string.split('-')

    # An empty value is allowed for optional features
    if not values[0] in f.values and \
           (values[0] or not f.optional):
        raise InvalidValue ("'%s' is not a known value of feature '%s'\nlegal values: '%s'" % (values [0], f.name, f.values))

    for v in values [1:]:
        # this will validate any subfeature values in value-string
        implied_subfeature(f, v, values[0])
309127
function parseFeatures (features) {
  features = defaultValue(features, '')
  if (!features) {
    return {}
  }

  return features
    .split(',')
    .map(toNameAndValuePair)
    .reduce(toPlainObject, {})
}
451431
function normalize(val) {
  if (Array.isArray(val)) {
    val = val.join(' ');
  }
  return val.split(' ').join('\\ ');
}
286012
def paren_split(sep,string):
    
    if len(sep) != 1: raise Exception("Separation string must be one character long")
    retlist = []
    level = 0
    blevel = 0
    left = 0
    for i in range(len(string)):
        if string[i] == "(": level += 1
        elif string[i] == ")": level -= 1
        elif string[i] == "[": blevel += 1
        elif string[i] == "]": blevel -= 1
        elif string[i] == sep and level == 0 and blevel == 0:
            retlist.append(string[left:i])
            left = i+1
    retlist.append(string[left:])
    return retlist
1324233
def _split_into_mimetype_and_priority(x):
    
    if ';' in x:
        content_type, priority = x.split(';')
        casted_priority = float(priority.split('=')[1])
    else:
        content_type, casted_priority = x, 1.0

    content_type = content_type.lstrip().rstrip()  # Replace ' text/html' to 'text/html'
    return content_type, casted_priority
720484
void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit )
	{
		Element<Corner> e1 = next(e0);

		e0.object.splitable = canBeSplit(contour,e0,mustSplit);

		if( e0.object.splitable ) {
			setSplitVariables(contour, e0, e1);
		}
	}
181486
function splitMultipleValues(envObject) {
  try {
    const data = Object.keys(envObject)
    return data.reduce((p, v) => {
      p[v] = envObject[v]
      if (envObject[v].indexOf(',') !== -1) {
        p[v] = envObject[v].split(',')
      }
      return p
    }, {})
  } catch (err) {
    throw err
  }
}
729516
def contains_exclusive(self, x, y):
        
        left, bottom, right, top = self._aarect.lbrt()
        return (left <= x < right) and (bottom < y <= top)
182692
function (featureStringCommaSeparated) {
  var arrayFeatures = featureStringCommaSeparated
    .split(',')
    .filter(function (x) { return x.length })
    .map(function (x) { return x.replace(/[\*\/]/g, '') }); // Eliminate XSS vuln
  var arrayUnsupportedFeatures = [];
  for (var i = 0; i < arrayFeatures.length; i++) {
    var supportedFeature = true;
    var fullFeature = arrayFeatures[i];
    if (contains(fullFeature, "~")) {
      if (contains(fullFeature, "Intl.~locale")) {
        supportedFeature = checkIntlLocale(window, fullFeature);
      } else {
        console.warn('Feature ' + fullFeature + ' can not be detected because it has not JavaScript API.');
      }
    } else {
      // Get the feature and the container Object
      var featureString = fullFeature.substring(fullFeature.lastIndexOf('.') + 1);
      if (contains(featureString, "@@")) {
        console.warn('Feature ' + featureString + ' can not be detected because it depends on Symbol.');
      } else {
        var objectString = fullFeature.substring(0, fullFeature.lastIndexOf('.'));
        var object = getDescendantProp(window, objectString);
        if (object !== undefined) {
          //if ((object.hasOwnProperty(featureString)) === false) {
          if ((featureString in object) === false) {
            supportedFeature = false;
          }
        } else {
          supportedFeature = false;
        }
      }
    }
    // If the feature is not supported by the browser, then add it to polyfill it
    if (supportedFeature === false) {
      arrayUnsupportedFeatures.push(fullFeature);
    }
  }
  return arrayUnsupportedFeatures;
}
65607
def val_to_bin(edges, x):
    """"""
    ibin = np.digitize(np.array(x, ndmin=1), edges) - 1
    return ibin
1370976
def _partition_spec(self, shape, partition_info):
    """"""
    if partition_info is None:
      return ''  # Empty string indicates a non-partitioned tensor.
    ssi = tf.Variable.SaveSliceInfo(
        full_name=self._var_name,
        full_shape=partition_info.full_shape,
        var_offset=partition_info.var_offset,
        var_shape=shape)
    return ssi.spec
314379
def split(self, point=None):
    
    if point is None:
      point = len(self) / 2

    r1 = Sequence(self.name + ".1", self.sequenceData[:point])
    r2 = Sequence(self.name + ".2", self.sequenceData[point:])

    return r1, r2