Skip to content

Commit

Permalink
Make OutStream a bit more file-like by inheriting from IOBase and add…
Browse files Browse the repository at this point in the history
…ing attributes.
  • Loading branch information
bfroehle committed Jul 27, 2012
1 parent 0a83b1b commit b7dcbc4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions IPython/zmq/iostream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import time
from io import StringIO
from io import StringIO, IOBase

from session import extract_header, Message

Expand All @@ -15,7 +15,7 @@
# Stream classes
#-----------------------------------------------------------------------------

class OutStream(object):
class OutStream(IOBase):
"""A file like object that publishes the stream to a 0MQ PUB socket."""

# The time interval between automatic flushes, in seconds.
Expand Down Expand Up @@ -59,6 +59,14 @@ def isatty(self):
def encoding(self):
return encoding.DEFAULT_ENCODING

@property
def mode(self):
return 'w'

@property
def errors(self):
return None

def __next__(self):
raise IOError('Read not supported on a write only stream.')

Expand Down

0 comments on commit b7dcbc4

Please sign in to comment.