Split a power/toughness string on the correct slash.

        Correctly accounts for curly braces to denote fractions.
        E.g., '2/2' --> ['2', '2']
        '3{1/2}/3{1/2}' --> ['3{1/2}', '3{1/2}']
326813
def split_pow_tgh(self, text):
        
        return [n for n in re.split(r"/(?=([^{}]*{[^{}]*})*[^{}]*$)", text)
                if n is not None][:2]
1355226
def convert_to_decimal(string):
    
    number_or_fraction = '(?:\d{1,2}) | (?:\d{1,10} \\ \d{1,10})'
    m = re.compile('''\[?\s?            # opening bracket
                    \d{{1,2}}\s?,\s?    # first number
                    {0} \s?,\s?         # second number (can be a fraction)
                    {0} \s?,\s?         # third number (can be a fraction)
                    \]?\s?              # closing bracket
                    '''.format(number_or_fraction), re.VERBOSE)
    if not m.match(string):
        raise ValueError

    h, m, s = re.sub('\[|\]', '', string).split(', ')
    result = int(h)
    if '/' in m:
        m = m.split('/')
        result += int(m[0]) * 1.0 / int(m[1]) / 60
    else:
        result += int(m) * 1.0 / 60
    if '/' in s:
        s = s.split('/')
        result += int(s[0]) * 1.0 / int(s[1]) / 3600
    else:
        result += int(s) * 1.0 / 60
    return result
349975
def width_aware_slice(s, start, end, replacement_char=u' '):
    # type: (Text, int, int, Text)
    
    divides = [0]
    for c in s:
        divides.append(divides[-1] + wcswidth(c))

    new_chunk_chars = []
    for char, char_start, char_end in zip(s, divides[:-1], divides[1:]):
        if char_start == start and char_end == start:
            continue  # don't use zero-width characters at the beginning of a slice
                      # (combining characters combine with the chars before themselves)
        elif char_start >= start and char_end <= end:
            new_chunk_chars.append(char)
        else:
            new_chunk_chars.extend(replacement_char * interval_overlap(char_start, char_end, start, end))

    return ''.join(new_chunk_chars)
1220086
def _slice(expr, start=None, stop=None, step=None):
    

    return _string_op(expr, Slice, _start=start, _end=stop, _step=step)
174404
function trimmedLeftIndex(string) {
    var index = -1,
        length = string.length;

    while (++index < length) {
      var c = string.charCodeAt(index);
      if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 ||
          (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)))) {
        break;
      }
    }
    return index;
  }
685857
def str_fraction(self):
        """"""
        if self._eta.undefined:
            return None

        # Determine denominator and its unit.
        unit_denominator, unit = self._unit_class(self.denominator).auto
        formatter = '%d' if unit_denominator == self.denominator else '%0.2f'
        denominator = locale.format(formatter, unit_denominator, grouping=True)

        # Determine numerator.
        unit_numerator = getattr(self._unit_class(self.numerator), unit)
        if self.done:
            rounded_numerator = unit_numerator
        else:
            rounded_numerator = float(Decimal(str(unit_numerator)).quantize(Decimal('.01'), rounding=ROUND_DOWN))
        numerator = locale.format(formatter, rounded_numerator, grouping=True).rjust(len(denominator))

        return '{0}/{1} {2}'.format(numerator, denominator, unit)
394620
function split(path) {
    var res = [];
    var level = 0;
    var key = '';

    for (var i = 0; i < path.length; i++) {
      var c = path.substr(i, 1);

      if (level === 0 && (c === '.' || c === '[')) {
        if (c === '[') {
          level++;
          i++;
          c = path.substr(i, 1);
        }

        if (key) { // the first value could be a string
          res.push(key);
        }
        key = '';
        continue;
      }

      if (c === ']') {
        level--;
        key = key.slice(0, -1);
        continue;
      }

      key += c;
    }

    res.push(key);

    return res;
  }
47858
def _split_params(tag_prefix, tag_suffix):
    ""
    if tag_suffix[-1:] != ')':
        raise ValueError, "unbalanced parenthesis in type %s%s" % (tag_prefix, tag_suffix)
    return map(_maybe_int, tag_suffix[:-1].split(','))
121908
def split_str(string):
    """"""
    split = string.split(' ')
    return ' '.join(split[:len(split) // 2]), ' '.join(split[len(split) // 2:])
444354
def process_format(self, kind, context):
		""""""
		
		result = None
		
		while True:
			chunk = yield result
			
			if chunk is None:
				return
			
			# We need to split the expression defining the format string from the values to pass when formatting.
			# We want to allow any Python expression, so we'll need to piggyback on Python's own parser in order
			# to exploit the currently available syntax.  Apologies, this is probably the scariest thing in here.
			split = -1
			line = chunk.line
			
			try:
				ast.parse(line)
			except SyntaxError as e:  # We expect this, and catch it.  It'll have exploded after the first expr.
				split = line.rfind(' ', 0, e.offset)
			
			result = chunk.clone(line='_bless(' + line[:split].rstrip() + ').format(' + line[split:].lstrip() + ')')
640803
function rectify(str) {
  let minus = String.fromCharCode(consts.minus);
  let point = String.fromCharCode(consts.point);

  // Remove the negative sign if necessary.
  let abs = (str[0] === minus) ? str.slice(1) : str;

  // Split into fractional and integer parts.
  let split = abs.split(point);
  let integerPart = split[0] || '';
  let fractionalPart = split[1] || '';

  // Trim zeros.
  integerPart = removeLeadingZeros(integerPart);
  fractionalPart = removeTrailingZeros(fractionalPart);

  // Put it back together.
  let rectified;
  rectified = integerPart ? integerPart : consts.alphabet[0];
  rectified += fractionalPart ? point + fractionalPart : '';

  // Replace the negative sign if necessary.
  if (str[0] === minus && rectified != consts.alphabet[0]) rectified = minus + rectified;

  return rectified;
}
403194
function(string, options) {
      options = options || {};
      var separator = options.separator || '_';
      var split = options.split || /(?=[A-Z])/;

      return string.split(split).join(separator);
    }
610079
function split (str) {
  if (str.indexOf(':') >= 0) {
    var parts = str.split(':')
    var m = parts.shift()
    parts = parts.join(':').split(FIELD_REGEX)
    parts.unshift(m)
    return parts
  } else {
    return str.split(FIELD_REGEX)
  }
}
1060560
def split_func(string):
    
    ind = string.index("(")
    return string[:ind], string[ind+1:-1].strip('"')
508157
def fraction_digits(n: Literal) -> Optional[int]:
    
    # Note - the last expression below isolates the fractional portion, reverses it (e.g. 017320 --> 023710) and
    #        converts it to an integer and back to a string
    return None if not is_numeric(n) or n.value is None \
        else 0 if is_integer(n) or '.' not in str(n.value) or str(n.value).split('.')[1] == '0' \
        else len(str(int(str(n.value).split('.')[1][::-1])))
427646
def convert_string_to_number(str)
      matches = RE_NUMBER_STR.match(str)

      s = matches[:sign] == '-' ? -1 : 1
      i = matches[:integer].to_i
      f = matches[:fractional].to_i
      d = matches[:fractional] ? matches[:fractional].length : 0
      t = matches[:exponent_sign] == '-' ? -1 : 1
      e = matches[:exponent].to_i

      # I know this looks nutty, but it's exactly what's defined in the spec,
      # and it works.
      s * (i + f * 10**-d) * 10**(t * e)
    end
681879
function parse (str, options) {
  var tokens = [];
  var key = 0;
  var index = 0;
  var path = '';
  var defaultDelimiter = options && options.delimiter || '/';
  var res;

  while ((res = PATH_REGEXP.exec(str)) != null) {
    var m = res[0];
    var escaped = res[1];
    var offset = res.index;
    path += str.slice(index, offset);
    index = offset + m.length;

    // Ignore already escaped sequences.
    if (escaped) {
      path += escaped[1];
      continue
    }

    var next = str[index];
    var prefix = res[2];
    var name = res[3];
    var capture = res[4];
    var group = res[5];
    var modifier = res[6];
    var asterisk = res[7];

    // Push the current path onto the tokens.
    if (path) {
      tokens.push(path);
      path = '';
    }

    var partial = prefix != null && next != null && next !== prefix;
    var repeat = modifier === '+' || modifier === '*';
    var optional = modifier === '?' || modifier === '*';
    var delimiter = res[2] || defaultDelimiter;
    var pattern = capture || group;

    tokens.push({
      name: name || key++,
      prefix: prefix || '',
      delimiter: delimiter,
      optional: optional,
      repeat: repeat,
      partial: partial,
      asterisk: !!asterisk,
      pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
    });
  }

  // Match any characters still remaining.
  if (index < str.length) {
    path += str.substr(index);
  }

  // If the path exists, push it onto the end.
  if (path) {
    tokens.push(path);
  }

  return tokens
}