class_docstr: A Python notebook reader.
docstr: Split lines into code blocks.
docstr_tok: ["Split","lines","into","code","blocks","."]
code: def split_lines_into_blocks(self, lines):
      """Split lines into code blocks."""
      if len(lines) == 1:
          yield lines[0]
          raise StopIteration()
      import ast
  
      source = "\n".join(lines)
      code = ast.parse(source)
      starts = [x.lineno - 1 for x in code.body]
      for i in range(len(starts) - 1):
          yield "\n".join(lines[starts[i] : starts[i + 1]]).strip("\n")
      yield "\n".join(lines[starts[-1] :]).strip("\n")
  
file_path: nbformat/nbformat/v2/nbpy.py
imports: from __future__ import annotations
  import re
  from .nbbase import new_code_cell, new_notebook, new_text_cell, new_worksheet
  from .rwbase import NotebookReader, NotebookWriter
label_desc: Use image node_id 5 for calling the PyReader obj's underlying member method code with example usage: obj.split_lines_into_blocks(lines) without return types