示例#1
0
文件: data.py 项目: wrand/tweater
 def __init__(self,
              filename=None,
              mode=None,
              compresslevel=9,
              fileobj=None,
              **kwargs):
     """
     @return: a buffered gzip file object
     @rtype: C{BufferedGzipFile}
     @param filename: a filesystem path
     @type filename: C{str}
     @param mode: a file mode which can be any of 'r', 'rb', 'a', 'ab', 
         'w', or 'wb'
     @type mode: C{str}
     @param compresslevel: The compresslevel argument is an integer from 1
         to 9 controlling the level of compression; 1 is fastest and 
         produces the least compression, and 9 is slowest and produces the
         most compression. The default is 9.
     @type compresslevel: C{int}
     @param fileobj: a StringIO stream to read from instead of a file.
     @type fileobj: C{StringIO}
     @kwparam size: number of bytes to buffer during calls to
         L{read()} and L{write()}
     @type size: C{int}
     """
     GzipFile.__init__(self, filename, mode, compresslevel, fileobj)
     self._size = kwargs.get('size', self.SIZE)
     self._buffer = StringIO()
     # cStringIO does not support len.
     self._len = 0
示例#2
0
    def __init__(self,
                 filename=None,
                 mode=None,
                 compresslevel=9,
                 fileobj=None,
                 **kwargs):
        """
        Return a buffered gzip file object.

        :param filename: a filesystem path
        :type filename: str
        :param mode: a file mode which can be any of 'r', 'rb', 'a', 'ab',
            'w', or 'wb'
        :type mode: str
        :param compresslevel: The compresslevel argument is an integer from 1
            to 9 controlling the level of compression; 1 is fastest and
            produces the least compression, and 9 is slowest and produces the
            most compression. The default is 9.
        :type compresslevel: int
        :param fileobj: a BytesIO stream to read from instead of a file.
        :type fileobj: BytesIO
        :param size: number of bytes to buffer during calls to read() and write()
        :type size: int
        :rtype: BufferedGzipFile
        """
        GzipFile.__init__(self, filename, mode, compresslevel, fileobj)
        self._size = kwargs.get('size', self.SIZE)
        self._buffer = compat.BytesIO()
        # cStringIO does not support len.
        self._len = 0
示例#3
0
 def __init__(self, filename=None, mode=None, compresslevel=9, 
              fileobj=None, **kwargs):
     """
     @return: a buffered gzip file object
     @rtype: C{BufferedGzipFile}
     @param filename: a filesystem path
     @type filename: C{str}
     @param mode: a file mode which can be any of 'r', 'rb', 'a', 'ab', 
         'w', or 'wb'
     @type mode: C{str}
     @param compresslevel: The compresslevel argument is an integer from 1
         to 9 controlling the level of compression; 1 is fastest and 
         produces the least compression, and 9 is slowest and produces the
         most compression. The default is 9.
     @type compresslevel: C{int}
     @param fileobj: a StringIO stream to read from instead of a file.
     @type fileobj: C{StringIO}
     @kwparam size: number of bytes to buffer during calls to
         L{read()} and L{write()}
     @type size: C{int}
     """   
     GzipFile.__init__(self, filename, mode, compresslevel, fileobj)
     self._size = kwargs.get('size', self.SIZE)
     self._buffer = StringIO()
     # cStringIO does not support len.
     self._len = 0
示例#4
0
文件: data.py 项目: abelenki/spamlibs
    def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None, **kwargs):
        """
        Return a buffered gzip file object.

        :param filename: a filesystem path
        :type filename: str
        :param mode: a file mode which can be any of 'r', 'rb', 'a', 'ab',
            'w', or 'wb'
        :type mode: str
        :param compresslevel: The compresslevel argument is an integer from 1
            to 9 controlling the level of compression; 1 is fastest and
            produces the least compression, and 9 is slowest and produces the
            most compression. The default is 9.
        :type compresslevel: int
        :param fileobj: a StringIO stream to read from instead of a file.
        :type fileobj: StringIO
        :param size: number of bytes to buffer during calls to read() and write()
        :type size: int
        :rtype: BufferedGzipFile
        """
        GzipFile.__init__(self, filename, mode, compresslevel, fileobj)
        self._size = kwargs.get("size", self.SIZE)
        self._buffer = StringIO()
        # cStringIO does not support len.
        self._len = 0
示例#5
0
	def __init__(
		self,
		fileobj=None,
		closeFileobj=False,
		**kwargs
	):
		GzipFile.__init__(self, fileobj=fileobj, **kwargs)
		self.closeFileobj = closeFileobj
示例#6
0
	def __init__(
		self,
		fileobj=None,
		closeFileobj=False,
		**kwargs
	):
		GzipFile.__init__(self, fileobj=fileobj, **kwargs)
		self.closeFileobj = closeFileobj
示例#7
0
    def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None):
        BaseGzipFile.__init__(self, filename=filename, mode=mode, compresslevel=compresslevel, fileobj=fileobj)

        if self.mode == WRITE:
            # Indicates the start of a new member if value is True.
            # The BaseGzipFile constructor already wrote the header for new
            # member, so marking as False.
            self._new_member = False

        # When _member_lock is True, only one member in gzip file is read
        self._member_lock = False
示例#8
0
 def __init__(self, filename=None, mode=None, start=(), stop=None,
                 pwarning=1, *args, **kwds):
     filename = os.path.join(IMDB_PTDF_DIR, filename)
     try:
         GzipFile.__init__(self, filename, mode, *args, **kwds)
     except IOError, e:
         if not pwarning: raise
         print 'WARNING WARNING WARNING'
         print 'WARNING unable to read the "%s" file.' % filename
         print 'WARNING The file will be skipped, and the contained'
         print 'WARNING information will NOT be stored in the database.'
         print 'WARNING Complete error: ', e
         # re-raise the exception.
         raise
示例#9
0
    def __init__(self,
                 filename=None,
                 mode=None,
                 compresslevel=9,
                 fileobj=None):
        BaseGzipFile.__init__(self,
                              filename=filename,
                              mode=mode,
                              compresslevel=compresslevel,
                              fileobj=fileobj)

        if self.mode == WRITE:
            # Indicates the start of a new member if value is True.
            # The BaseGzipFile constructor already wrote the header for new
            # member, so marking as False.
            self._new_member = False

        # When _member_lock is True, only one member in gzip file is read
        self._member_lock = False
示例#10
0
 def __init__(self,
              filename=None,
              mode=None,
              start=(),
              stop=None,
              pwarning=1,
              *args,
              **kwds):
     filename = os.path.join(IMDB_PTDF_DIR, filename)
     try:
         GzipFile.__init__(self, filename, mode, *args, **kwds)
     except IOError, e:
         if not pwarning: raise
         print 'WARNING WARNING WARNING'
         print 'WARNING unable to read the "%s" file.' % filename
         print 'WARNING The file will be skipped, and the contained'
         print 'WARNING information will NOT be stored in the database.'
         print 'WARNING Complete error: ', e
         # re-raise the exception.
         raise
示例#11
0
 def __init__(self, fileobj):
     GzipFile.__init__(self, fileobj=fileobj)
     # When _member_lock is True, only one member in gzip file is read
     self._member_lock = False
示例#12
0
 def __init__(self, fileobj):
     GzipFile.__init__(self, fileobj=fileobj)
     self.fileobj_to_close = fileobj
示例#13
0
 def __init__(self, fileobj):
     GzipFile.__init__(self, fileobj=fileobj)
     self.fileobj_to_close = fileobj
示例#14
0
 def __init__(self, shortpath, filepath):
     DataFileBase.__init__(self, shortpath, filepath)
     StdGzipFile.__init__(self, filepath, 'wb')
示例#15
0
 def __init__(self, *args, **kwargs):
     GzipFile.__init__(self, *args, **kwargs)
     self.__class__.open_files.add(self)
示例#16
0
文件: fixes.py 项目: Lem97/mne-python
 def __init__(self, *args, **kwargs):
     return GzipFile.__init__(self, *args, **kwargs)
示例#17
0
 def __init__(self, fileobj):
     GzipFile.__init__(self, fileobj=fileobj)
     # When _member_lock is True, only one member in gzip file is read
     self._member_lock = False
示例#18
0
 def __init__(self, *args, **kwargs):
     GzipFile.__init__(self, *args, **kwargs)
     self.__class__.open_files.add(self)
示例#19
0
 def __init__(self, *args, **kwargs):
     return GzipFile.__init__(self, *args, **kwargs)