# Own modules
from trace_maillog import magic
-__version__ = '0.3.3'
+__version__ = '0.4.1'
LOG = logging.getLogger(__name__)
"""Base class for all exceptions defined in this module."""
pass
+# =============================================================================
+class NoFilehandleError(BaseAnyUncompressError, RuntimeError):
+
+ def __str__(self):
+ return "The undelaying file handle is already destroyed."
+
# =============================================================================
class InvalidCompressionError(BaseAnyUncompressError, NotImplementedError):
self.container.close()
self.container = None
+ # -------------------------------------------------------------------------
+ @property
+ def closed(self):
+ '''True if the stream is closed.'''
+ if self._fh:
+ return self._fh.closed
+ return True
+
+ # -------------------------------------------------------------------------
+ def flush(self):
+ if self._fh:
+ return self._fh.flush()
+ return None
+
+ # -------------------------------------------------------------------------
+ def fileno(self):
+ if self._fh:
+ return self._fh.fileno()
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def isatty(self):
+ if self._fh:
+ return self._fh.isatty()
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def next(self):
+ if self._fh:
+ return self._fh.next()
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def peek(self, size):
+ if self._fh:
+ return self._fh.peek(size)
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def read(self, size=-1):
+ if self._fh:
+ return self._fh.read(size)
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def readline(self, size=-1):
+ if self._fh:
+ return self._fh.readline(size)
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def readlines(self, hint=-1):
+ if self._fh:
+ return self._fh.readlines(hint)
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def seek(self, offset, whence=os.SEEK_SET)
+ if self._fh:
+ return self._fh.seek(offset, whence)
+ raise NoFilehandleError()
+
+ # -------------------------------------------------------------------------
+ def tell(self):
+ if self._fh:
+ return self._fh.tell()
+ raise NoFilehandleError()
+
# -------------------------------------------------------------------------
if HAS_BZIP2:
compression_types['bz2']['supported'] = True