From e790bd2eb2dac80bb3ad9878049d938764e200c8 Mon Sep 17 00:00:00 2001 From: sandes Date: Wed, 25 Mar 2020 23:53:18 -0300 Subject: [PATCH] buffer size @methodclass --- setup.py | 4 ++-- zipfly/__init__.py | 28 ++++++++++++++++++++++++---- zipfly/__init__.pyc | Bin 0 -> 5865 bytes 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 zipfly/__init__.pyc diff --git a/setup.py b/setup.py index 75f5da6..21915dd 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,9 @@ name='zipfly', packages=['zipfly'], description='ZipFly', - version='1.1.4', + version='1.1.5', url='http://github.com/buzonIO/zipfly', - download_url = 'https://github.com/BuzonIO/zipfly/archive/v1.1.4.tar.gz', + download_url = 'https://github.com/BuzonIO/zipfly/archive/v1.1.5.tar.gz', author='Buzon', author_email='support@buzon.io', keywords=['zipfly','buzon'], diff --git a/zipfly/__init__.py b/zipfly/__init__.py index a254394..cfe61a9 100644 --- a/zipfly/__init__.py +++ b/zipfly/__init__.py @@ -6,7 +6,7 @@ """ from __future__ import unicode_literals, print_function, with_statement -__version__ = '1.1.4' +__version__ = '1.1.5' from zipfile import ( ZIP_STORED, @@ -77,21 +77,38 @@ def get_chunk(): return entry.read(1024 * self.chunksize) return get_chunk() + + + def get_size(self): + + return self._buffer_size + def buffer_size(self): # using to get the buffer size # this size is different from the size of each file added - + + for i in self.generator(): pass return self._buffer_size + def generator(self): + """ + @ from_file classemthod of ZipFile->ZipInfo + + filename should be the path to a file or directory on the filesystem. + arcname is the name which it will have within the archive (by default, + this will be the same as filename, but without a drive letter and with + leading path separators removed). + """ + stream = Stream() with ZipFile(stream, mode='w', ) as zf: - for path in self.paths: + for path in self.paths: z_info = ZipInfo.from_file(path['filesystem'], path['name']) @@ -109,4 +126,7 @@ def generator(self): yield stream.get() self._buffer_size = stream.size() - stream.close() \ No newline at end of file + stream.close() + + + # close stream \ No newline at end of file diff --git a/zipfly/__init__.pyc b/zipfly/__init__.pyc new file mode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