class_docstr: Convert IPython 'syntax' to valid Python.
  
  Eventually this code may grow to be the full IPython syntax conversion
  implementation, but for now it only does prompt convertion.
class_docstr_tok: ["Convert","IPython","'syntax","'","to","valid","Python",".","Eventually","this","code","may","grow","to","be","the","full","IPython","syntax","conversion","implementation",",","but","for","now","it","only","does","prompt","convertion","."]
docstr: Convert IPython prompts to python ones in a string.
docstr_tok: ["Convert","IPython","prompts","to","python","ones","in","a","string","."]
code: def __call__(self, ds):
      """Convert IPython prompts to python ones in a string."""
      from . import globalipapp
  
      pyps1 = ">>> "
      pyps2 = "... "
      pyout = ""
  
      dnew = ds
      dnew = self.rps1.sub(pyps1, dnew)
      dnew = self.rps2.sub(pyps2, dnew)
      dnew = self.rout.sub(pyout, dnew)
      ip = globalipapp.get_ipython()
  
      # Convert input IPython source into valid Python.
      out = []
      newline = out.append
      for line in dnew.splitlines():
          mps1 = self.rpyps1.match(line)
          if mps1 is not None:
              prompt, text = mps1.groups()
              newline(prompt + ip.prefilter(text, False))
              continue
  
          mps2 = self.rpyps2.match(line)
          if mps2 is not None:
              prompt, text = mps2.groups()
              newline(prompt + ip.prefilter(text, True))
              continue
  
          newline(line)
      newline("")  # ensure a closing newline, needed by doctest
      # print "PYSRC:", '\n'.join(out)  # dbg
      return "\n".join(out)
  
file_path: catboost/contrib/python/ipython/py2/IPython/testing/ipunittest.py
imports: from __future__ import absolute_import
  import re
  import unittest
  from doctest import DocTestFinder, DocTestRunner, TestResults
label_desc: Use image node_id 2 for calling the IPython2PythonConverter obj's underlying member method code with example usage: obj.__call__(ds) and returns: str