コード例 #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
ファイル: data.py プロジェクト: B-Rich/Fem-Coding-Challenge
 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
ファイル: bgl_reader.py プロジェクト: ilius/pyglossary
	def __init__(
		self,
		fileobj=None,
		closeFileobj=False,
		**kwargs
	):
		GzipFile.__init__(self, fileobj=fileobj, **kwargs)
		self.closeFileobj = closeFileobj
コード例 #7
0
ファイル: gzip2.py プロジェクト: RominYue/SearchEngineDemo
    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
ファイル: gzip2.py プロジェクト: jroakes/CommonCrawlJob
    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
ファイル: gzip2.py プロジェクト: christianbuck/CorpusMining
 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
ファイル: urls.py プロジェクト: mpsiva89/WeasyPrint
 def __init__(self, fileobj):
     GzipFile.__init__(self, fileobj=fileobj)
     self.fileobj_to_close = fileobj
コード例 #13
0
ファイル: compat.py プロジェクト: 1FENQI/WeasyPrint
 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
ファイル: fileio.py プロジェクト: joaks1/PyMsBayes
 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
ファイル: fileio.py プロジェクト: vishalbelsare/PyMsBayes
 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)