Split code at plt.show()
322117
def split_code_at_show(text):
    

    parts = []
    is_doctest = contains_doctest(text)

    part = []
    for line in text.split("\n"):
        if (not is_doctest and line.strip() == 'plt.show()') or \
               (is_doctest and line.strip() == '>>> plt.show()'):
            part.append(line)
            parts.append("\n".join(part))
            part = []
        else:
            part.append(line)
    if "\n".join(part).strip():
        parts.append("\n".join(part))
    return parts
874474
def split_on_condition(seq, condition):
    """"""
    l1, l2 = tee((condition(item), item) for item in seq)
    return (i for p, i in l1 if p), (i for p, i in l2 if not p)
837169
def get_pltdotstr(self, **kws_usr):
        """"""
        dotstrs = self.get_pltdotstrs(**kws_usr)
        assert len(dotstrs) == 1
        return dotstrs[0]
576391
def split(attrs, inputs, proto_obj):
    """"""
    split_list = attrs.get('split') if 'split' in attrs else []
    new_attrs = translation_utils._fix_attribute_names(attrs,
                                                       {'split' : 'num_outputs'})
    if 'axis' not in attrs:
        new_attrs = translation_utils._add_extra_attributes(new_attrs, {'axis': 0})

    if not split_list:
        num_outputs = len(proto_obj.model_metadata.get('output_tensor_data'))
    else:
        if len(set(split_list)) == 1:
            num_outputs = len(split_list)
        else:
            raise NotImplementedError("Operator {} in MXNet does not support variable splits."
                                      "Tracking the issue to support variable split here: "
                                      "https://github.com/apache/incubator-mxnet/issues/11594"
                                      .format('split'))

    new_attrs['num_outputs'] = num_outputs
    return 'split', new_attrs, inputs
658549
def display(self, codes=[], fg=None, bg=None):
        
        codes, fg, bg = Magic.displayformat(codes, fg, bg)
        color = 0
        for c in codes:
            try:
                f = getattr(self, '_display_' + c)
                out = f()
                if out: color |= out
            except AttributeError:
                pass
        cfg, cfgi, cbg, cbgi = self._split_attributes(
                          self._get_console_info()['attributes'])
        if self.reverse_input:
            cfg, cbg = (cbg // 0x10), (cfg * 0x10)
            cfgi, cbgi = (cbgi // 0x10), (cfgi * 0x10)
        if fg != None:
            color |= self.FG[fg]
            self.real_fg = self.FG[fg]
        else: color |= cfg
        if bg != None:
            color |= self.BG[bg]
        else: color |= cbg
        color |= (cfgi | cbgi)
        fg, fgi, bg, bgi = self._split_attributes(color)
        if self.dim_output:
            # intense black
            fg = 0
            fgi = self.FG_INTENSITY
        if self.reverse_output:
            fg, bg = (bg // 0x10), (fg * 0x10)
            fgi, bgi = (bgi // 0x10), (fgi * 0x10)
            self.reverse_input = True
        if self.hidden_output:
            fg = (bg // 0x10)
            fgi = (bgi // 0x10)
        self._set_attributes(fg | fgi | bg | bgi)
383680
def _slice_replace(code, index, old, new):
        """"""
        nodes = [str(node) for node in code.get(index)]
        substring = "".join(nodes).replace(old, new)
        code.nodes[index] = parse_anything(substring).nodes
837227
def split_string(self, string, splitter='.', allow_empty=True):
        """"""
        i = 0
        rv = []
        need_split = False
        while i < len(string):
            m = re.compile(_KEY_NAME).match(string, i)
            if not need_split and m:
                i = m.end()
                body = m.group(1)
                if body[:3] == '"""':
                    body = self.converter.unescape(body[3:-3])
                elif body[:3] == "'''":
                    body = body[3:-3]
                elif body[0] == '"':
                    body = self.converter.unescape(body[1:-1])
                elif body[0] == "'":
                    body = body[1:-1]
                if not allow_empty and not body:
                    raise TomlDecodeError(
                        self.lineno,
                        'Empty section name is not allowed: %r' % string)
                rv.append(body)
                need_split = True
            elif need_split and string[i] == splitter:
                need_split = False
                i += 1
                continue
            else:
                raise TomlDecodeError(self.lineno,
                                      'Illegal section name: %r' % string)
        if not need_split:
            raise TomlDecodeError(
                self.lineno,
                'Empty section name is not allowed: %r' % string)
        return rv
633343
def _split_raw(self):
        """"""

        self._splitted = self._split_re.split(self.raw)
        # search split locations (basically empty strings)
        self._sections = [ind for ind, elem in enumerate(self._splitted) if not elem]
298943
def _parse_show_output(cmd_ret):
    '''
    
    '''
    parsed_data = dict()
    list_key = None

    for line in cmd_ret.splitlines():
        # Skip empty lines.
        if not line.strip():
            continue

        # If there are indented lines below an existing key, assign them as a list value
        # for that key.
        if not salt.utils.stringutils.contains_whitespace(line[0]):
            list_key = None

        if list_key:
            list_value = _convert_to_closest_type(line)
            parsed_data.setdefault(list_key, []).append(list_value)
            continue

        items = [item.strip() for item in line.split(':', 1)]

        key = items[0].lower()
        key = ' '.join(key.split()).replace(' ', '_')

        # Track the current key so that we can use it in instances where the values
        # appear on subsequent lines of the output.
        list_key = key

        try:
            value = items[1]
        except IndexError:
            # If the line doesn't have the separator or is otherwise invalid, skip it.
            log.debug('Skipping line: %s', line)
            continue

        if value:
            parsed_data[key] = _convert_to_closest_type(value)

    return _convert_parsed_show_output(parsed_data=parsed_data)
1272639
def get_coding(text):
    
    for line in text.splitlines()[:2]:
        result = CODING_RE.search(to_text_string(line))
        if result:
            return result.group(1)
    return None
1053663
function split (matcher, mapper, options) {
  var decoder = new Decoder()
  var soFar = ''
  var maxLength = options && options.maxLength;
  var trailing = options && options.trailing === false ? false : true
  if('function' === typeof matcher)
    mapper = matcher, matcher = null
  if (!matcher)
    matcher = /\r?\n/

  function emit(stream, piece) {
    if(mapper) {
      try {
        piece = mapper(piece)
      }
      catch (err) {
        return stream.emit('error', err)
      }
      if('undefined' !== typeof piece)
        stream.queue(piece)
    }
    else
      stream.queue(piece)
  }

  function next (stream, buffer) {
    var pieces = ((soFar != null ? soFar : '') + buffer).split(matcher)
    soFar = pieces.pop()

    if (maxLength && soFar.length > maxLength)
      return stream.emit('error', new Error('maximum buffer reached'))

    for (var i = 0; i < pieces.length; i++) {
      var piece = pieces[i]
      emit(stream, piece)
    }
  }

  return through(function (b) {
    next(this, decoder.write(b))
  },
  function () {
    if(decoder.end)
      next(this, decoder.end())
    if(trailing && soFar != null)
      emit(this, soFar)
    this.queue(null)
  })
}
169750
function(code) {
    var lines = [];
    code.split(/\n/).forEach(line => {
      var segs = line.split(/(\s*#)/);
      var ln = {code: segs[0]};
      if (segs.length > 1)
        ln.comment = segs.reduce((c, seg, i) => i > 1 ? c + seg : seg, '');
      lines.push(ln);
    });
    return lines;
  }
322265
def _split_python(python):
    
    python = _preprocess(python)
    if not python:
        return []
    lexer = PythonSplitLexer()
    lexer.read(python)
    return lexer.chunks
957984
def _stripped_codes(codes):
    """"""
    return tuple([
        code.strip() for code in codes.split(',')
        if code.strip()
    ])
219537
def code(self, text, lang=None):
        """"""
        # WARNING: lang is discarded currently.
        with self.paragraph(stylename='code'):
            lines = text.splitlines()
            for line in lines[:-1]:
                self._code_line(line)
                self.linebreak()
            self._code_line(lines[-1])
554018
def split(s):
    
    return map(lambda w: filter(lambda c: c != '\x00', w), lexsplit(s))
90892
def split(self, decode=True):
        
        start = 0
        result = []
        message = self.decoded_bits if decode else self.plain_bits
        bit_alignments = set()
        if self.align_labels:
            for l in self.message_type:
                bit_alignments.add(l.start)
                bit_alignments.add(l.end)

        self.__bit_alignments = sorted(bit_alignments)

        for pos in self.__bit_alignments:
            result.append(message[start:pos])
            start = pos

        result.append(message[start:])
        return result