##// END OF EJS Templates
Merge branch 'newkernel' into trunk with all new Qt console work....
Merge branch 'newkernel' into trunk with all new Qt console work. This provides a new main script, ipython-qtconsole, that offers a rich Qt widget capable of multiline editing, inline plots, html help and much more. This branch was developed over the last two months mostly by Evan Patterson, Brian Granger and Fernando Perez, thanks to the support of Enthought, Inc. The code is now in a good prototype stage, and it's being merged into trunk where further work, polishing and stabilization will take place.

File last commit:

r1459:8d08214a
r3070:95e9a8d0 merge
Show More
file_like.py
66 lines | 1.7 KiB | text/x-python | PythonLexer
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 # encoding: utf-8
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407 """ File like object that redirects its write calls to a given callback."""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------
import sys
class FileLike(object):
""" FileLike object that redirects all write to a callback.
Only the write-related methods are implemented, as well as those
required to read a StringIO.
"""
closed = False
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407 def __init__(self, write_callback):
self.write = write_callback
Gael Varoquaux
Synchronous stdout/stderr output.
r1383
def flush(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 pass
def close(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 pass
def writelines(self, lines):
gvaroquaux
More docstring work.
r1459 map(self.write, lines)
Gael Varoquaux
Synchronous stdout/stderr output.
r1383
def isatty(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 return False
def getvalue(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 return ''
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407 def reset(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407 pass
Gael Varoquaux
Synchronous stdout/stderr output.
r1383
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407 def truncate(self):
gvaroquaux
More docstring work.
r1459 """ This method is there for compatibility with other file-like
objects.
"""
Gael Varoquaux
Synchronous stdout/stderr output.
r1383 pass
Gael Varoquaux
Modified OutputTrap to accept a file-like object and use it instead of...
r1407