ddi-fw 0.0.19__py3-none-any.whl → 0.0.21__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ddi_fw/utils/zip_helper.py +21 -1
- {ddi_fw-0.0.19.dist-info → ddi_fw-0.0.21.dist-info}/METADATA +2 -1
- {ddi_fw-0.0.19.dist-info → ddi_fw-0.0.21.dist-info}/RECORD +5 -5
- {ddi_fw-0.0.19.dist-info → ddi_fw-0.0.21.dist-info}/WHEEL +0 -0
- {ddi_fw-0.0.19.dist-info → ddi_fw-0.0.21.dist-info}/top_level.txt +0 -0
ddi_fw/utils/zip_helper.py
CHANGED
@@ -15,6 +15,18 @@ class ZipHelper:
|
|
15
15
|
with z.ZipFile(f'{output_path}/{name}.zip', 'w', compression=z.ZIP_LZMA, compresslevel=z.ZIP_LZMA) as zipObj:
|
16
16
|
zipObj.write(file_path, basename(file_path))
|
17
17
|
|
18
|
+
def zip_as_multipart(self, name, folder, file_name, output_path, chunk_size):
|
19
|
+
self.zip_single_file(name, folder+'/'+file_name, output_path)
|
20
|
+
with open(file_path, 'rb') as f:
|
21
|
+
chunk_number = 1
|
22
|
+
while True:
|
23
|
+
chunk = f.read(chunk_size)
|
24
|
+
if not chunk:
|
25
|
+
break
|
26
|
+
with open(f"{folder}/path/{file_name}.part{chunk_number:03}", 'wb') as chunk_file:
|
27
|
+
chunk_file.write(chunk)
|
28
|
+
chunk_number += 1
|
29
|
+
|
18
30
|
def zip(self, zip_prefix, input_path, output_path, chunk_size):
|
19
31
|
files_paths = [input_path+'/' + p for p in os.listdir(input_path)]
|
20
32
|
count_of_chunks = math.ceil(len(files_paths) / chunk_size)
|
@@ -50,6 +62,14 @@ class ZipHelper:
|
|
50
62
|
z1.extractall(path=output_path)
|
51
63
|
print(f'{file_path} has been extracted')
|
52
64
|
|
65
|
+
def extract_multiparts(self, output_path, parts_path):
|
66
|
+
input_parts = [parts_path+'/' + p for p in os.listdir(parts_path)]
|
67
|
+
with open(output_file, 'wb') as outfile:
|
68
|
+
for part in input_parts:
|
69
|
+
with open(part, 'rb') as infile:
|
70
|
+
outfile.write(infile.read())
|
71
|
+
self.extract(parts_path, output_path)
|
72
|
+
|
53
73
|
|
54
74
|
# if __name__ == "__main__":
|
55
75
|
# helper = ZipHelper()
|
@@ -63,4 +83,4 @@ class ZipHelper:
|
|
63
83
|
# df = pd.DataFrame(data=d)
|
64
84
|
# df.to_pickle('test/dataframe.pickle')
|
65
85
|
# helper.zip_single_file(file_path='test/dataframe.pickle',output_path='test/output', name='zip')
|
66
|
-
# helper.extract(input_path='test/output', output_path='test/output')
|
86
|
+
# helper.extract(input_path='test/output', output_path='test/output')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ddi_fw
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.21
|
4
4
|
Summary: Do not use :)
|
5
5
|
Author-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
|
6
6
|
Maintainer-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
|
@@ -22,6 +22,7 @@ Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
23
23
|
Requires-Python: >=3.8
|
24
24
|
Description-Content-Type: text/markdown
|
25
|
+
Requires-Dist: python-stopwatch
|
25
26
|
Requires-Dist: importlib-resources
|
26
27
|
Requires-Dist: lxml
|
27
28
|
Requires-Dist: matplotlib
|
@@ -78,8 +78,8 @@ ddi_fw/test/type_guarding_test.py,sha256=KxjyBxohDu7lwpejalCj-REjtJ-k1S1wQbOB6TG
|
|
78
78
|
ddi_fw/utils/__init__.py,sha256=nhNU_sEp55xsZ5VtvhozjKg6r4GWP6SJI13v8F_jbCg,217
|
79
79
|
ddi_fw/utils/enums.py,sha256=19eJ3fX5eRK_xPvkYcukmug144jXPH4X9zQqtsFBj5A,671
|
80
80
|
ddi_fw/utils/utils.py,sha256=Na6Y8mY-CFbQjrgd9xC8agcrjVvTj_7KIXqFm1H_3qU,3549
|
81
|
-
ddi_fw/utils/zip_helper.py,sha256=
|
82
|
-
ddi_fw-0.0.
|
83
|
-
ddi_fw-0.0.
|
84
|
-
ddi_fw-0.0.
|
85
|
-
ddi_fw-0.0.
|
81
|
+
ddi_fw/utils/zip_helper.py,sha256=1YJmsSlY1bCaQkDFLgtZ7w2xViHSEZaL0B0ZoohdOIY,3545
|
82
|
+
ddi_fw-0.0.21.dist-info/METADATA,sha256=_seeyh1D-dtArgpdDEB-IinRJZw_y7tNklrnqaUt5u4,1541
|
83
|
+
ddi_fw-0.0.21.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
84
|
+
ddi_fw-0.0.21.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
|
85
|
+
ddi_fw-0.0.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|