class_docstr: A class that represent a notebook cell as a Python or Julia script
class_docstr_tok: ["A","class","that","represent","a","notebook","cell","as","a","Python","or","Julia","script"]
docstr: Return the text representation of a code cell
code: def code_to_text(self):
      """Return the text representation of a code cell"""
      active = is_active(
          self.ext,
          self.metadata,
          same_language(self.language, self.default_language),
      )
      source = copy(self.source)
      escape_code_start(source, self.ext, self.language)
      comment_questions = self.metadata.pop("comment_questions", True)
  
      if active:
          comment_magic(
              source,
              self.language,
              self.comment_magics,
              comment_questions,
          )
      else:
          source = self.markdown_to_text(source)
  
      if (
          active
          and comment_questions
          and need_explicit_marker(
              self.source, self.language, self.comment_magics
          )
      ) or self.explicit_start_marker(source):
          self.metadata[
              "endofcell"
          ] = self.cell_marker_end or endofcell_marker(
              source, self.comment
          )
  
      if not self.metadata or not self.use_cell_markers:
          return source
  
      lines = []
      endofcell = self.metadata["endofcell"]
      if endofcell == "-" or self.cell_marker_end:
          del self.metadata["endofcell"]
  
      cell_start = [self.comment, self.cell_marker_start or "+"]
      options = metadata_to_double_percent_options(
          self.metadata, self.cell_metadata_json
      )
      if options:
          cell_start.append(options)
      lines.append(" ".join(cell_start))
      lines.extend(source)
      lines.append(self.comment + f" {endofcell}")
      return lines
  
imports: import re
  import warnings
  from copy import copy
  from .cell_metadata import _IGNORE_CELL_METADATA, is_active, metadata_to_double_percent_options, metadata_to_rmd_options, metadata_to_text
  from .cell_reader import LightScriptCellReader, MarkdownCellReader, RMarkdownCellReader
  from .doxygen import markdown_to_doxygen
  from .languages import _SCRIPT_EXTENSIONS, cell_language, comment_lines, same_language
  from .magics import comment_magic, escape_code_start, need_explicit_marker
  from .metadata_filter import filter_metadata
  from .pep8 import pep8_lines_between_cells
label_desc: Use image node_id 3 for calling the LightScriptCellExporter obj's underlying member method code with example usage: obj.code_to_text() and returns: lines, source