ddi-fw 0.0.22__py3-none-any.whl → 0.0.23__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.
@@ -4,6 +4,8 @@ from os.path import basename
4
4
  from collections import defaultdict
5
5
  import math
6
6
 
7
+ from ddi_fw.utils.utils import create_folder_if_not_exists
8
+
7
9
 
8
10
  class ZipHelper:
9
11
  def __init__(self):
@@ -15,16 +17,18 @@ class ZipHelper:
15
17
  with z.ZipFile(f'{output_path}/{name}.zip', 'w', compression=z.ZIP_LZMA, compresslevel=z.ZIP_LZMA) as zipObj:
16
18
  zipObj.write(file_path, basename(file_path))
17
19
 
18
- def zip_as_multipart(self, name, folder, file_name, output_path, chunk_size):
20
+ def zip_as_multipart(self, zip_name, folder, file_name, output_path, chunk_size):
19
21
  file_path = folder+'/'+file_name
20
- self.zip_single_file(name, file_path, output_path)
22
+ parts_path=f"{folder}/parts"
23
+ self.zip_single_file(zip_name, file_path, output_path)
24
+ create_folder_if_not_exists(parts_path)
21
25
  with open(file_path, 'rb') as f:
22
26
  chunk_number = 1
23
27
  while True:
24
28
  chunk = f.read(chunk_size)
25
29
  if not chunk:
26
30
  break
27
- with open(f"{folder}/path/{file_name}.part{chunk_number:03}", 'wb') as chunk_file:
31
+ with open(f"{parts_path}/{file_name}.part{chunk_number:03}", 'wb') as chunk_file:
28
32
  chunk_file.write(chunk)
29
33
  chunk_number += 1
30
34
 
@@ -63,9 +67,9 @@ class ZipHelper:
63
67
  z1.extractall(path=output_path)
64
68
  print(f'{file_path} has been extracted')
65
69
 
66
- def extract_multiparts(self, output_path, parts_path):
70
+ def extract_multiparts(self, output_path, parts_path,output_file):
67
71
  input_parts = [parts_path+'/' + p for p in os.listdir(parts_path)]
68
- with open(output_file, 'wb') as outfile:
72
+ with open(f"{output_path}/{output_file}", 'wb') as outfile:
69
73
  for part in input_parts:
70
74
  with open(part, 'rb') as infile:
71
75
  outfile.write(infile.read())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ddi_fw
3
- Version: 0.0.22
3
+ Version: 0.0.23
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>
@@ -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=D0pYHifqfKSKEG2oTpGh_0eNwx5fYZIuR6CuQ4BorSg,3576
82
- ddi_fw-0.0.22.dist-info/METADATA,sha256=wD31gaXsInwk3ERDHuhAHDqFlwGjtOLosWU7_3nu68M,1541
83
- ddi_fw-0.0.22.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
84
- ddi_fw-0.0.22.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
85
- ddi_fw-0.0.22.dist-info/RECORD,,
81
+ ddi_fw/utils/zip_helper.py,sha256=KnOFjf7MAw7jTjYuNJKzQL_VBGDRZiWy1a72T8_Uslg,3763
82
+ ddi_fw-0.0.23.dist-info/METADATA,sha256=SkMnhWTRE0XsOT-PMUejmGVFdbNy8EBM-OWrkDErTgc,1541
83
+ ddi_fw-0.0.23.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
84
+ ddi_fw-0.0.23.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
85
+ ddi_fw-0.0.23.dist-info/RECORD,,