ddi-fw 0.0.25__py3-none-any.whl → 0.0.27__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.
@@ -58,7 +58,7 @@ class ZipHelper:
58
58
  chunk = f.read(chunk_size)
59
59
  if not chunk:
60
60
  break
61
- with open(f"{output_path}/{zip_name}.zip.part{chunk_number:03}", 'wb') as chunk_file:
61
+ with open(f"{output_path}/{zip_name}.part{chunk_number:03}.zip", 'wb') as chunk_file:
62
62
  chunk_file.write(chunk)
63
63
  chunk_number += 1
64
64
  if os.path.exists(output_path+'/'+zip_name+'.zip'):
@@ -89,6 +89,13 @@ class ZipHelper:
89
89
  for file_path in value:
90
90
  zipObj.write(file_path, basename(file_path))
91
91
 
92
+ def extract_single_file(self, file_path, output_path):
93
+ with z.ZipFile(file_path, 'r') as z1:
94
+ z1.extractall(path=output_path)
95
+
96
+ '''
97
+ Extract zip files from the given path to the output path
98
+ '''
92
99
  def extract(self, input_path, output_path):
93
100
  files_paths = [input_path+'/' + p for p in os.listdir(input_path)]
94
101
  if not os.path.exists(output_path):
@@ -99,13 +106,15 @@ class ZipHelper:
99
106
  z1.extractall(path=output_path)
100
107
  print(f'{file_path} has been extracted')
101
108
 
102
- def extract_multiparts(self, output_path, parts_path, output_file):
103
- input_parts = [parts_path+'/' + p for p in os.listdir(parts_path)]
109
+ def extract_multiparts(self, input_path, output_path, output_file):
110
+ parts = [input_path+'/' + p for p in os.listdir(input_path)]
111
+ create_folder_if_not_exists(output_path)
104
112
  with open(f"{output_path}/{output_file}", 'wb') as outfile:
105
- for part in input_parts:
113
+ for part in parts:
106
114
  with open(part, 'rb') as infile:
107
115
  outfile.write(infile.read())
108
- self.extract(parts_path, output_path)
116
+ self.extract_single_file(f"{output_path}/{output_file}", output_path)
117
+ os.remove(f"{output_path}/{output_file}")
109
118
 
110
119
 
111
120
  # if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ddi_fw
3
- Version: 0.0.25
3
+ Version: 0.0.27
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=CF6Th3ntXcx_F2bzoPhUWkVE27YqZqPNrxHgDewArfs,5123
82
- ddi_fw-0.0.25.dist-info/METADATA,sha256=iGtI4gPTWiD9l5XKMCduX_kEY0ErYFX3kiLf8fujuFA,1541
83
- ddi_fw-0.0.25.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
84
- ddi_fw-0.0.25.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
85
- ddi_fw-0.0.25.dist-info/RECORD,,
81
+ ddi_fw/utils/zip_helper.py,sha256=9BzT5jnpqtiEprV8sI-fIz-2-og-8o2wlifSXPp_jv0,5479
82
+ ddi_fw-0.0.27.dist-info/METADATA,sha256=xq1C1HN_BnaimD50kcijGFTqDR9HjGmb1a_2QsXPu5I,1541
83
+ ddi_fw-0.0.27.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
84
+ ddi_fw-0.0.27.dist-info/top_level.txt,sha256=PMwHICFZTZtcpzQNPV4UQnfNXYIeLR_Ste-Wfc1h810,7
85
+ ddi_fw-0.0.27.dist-info/RECORD,,