Conditions | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | 1 | import io |
|
29 | def zip_file(zipfile, files: list[ZipData]): |
||
30 | # Create a ZipFile object in write mode |
||
31 | with ZipFile(zipfile, 'w') as zipf: |
||
32 | # Add the input file to the zip archive with its base name |
||
33 | for f in files: |
||
34 | zinfo = ZipInfo( |
||
35 | filename=f.filename, |
||
36 | # date_time=datetime_to_tuple(datetime.now()) |
||
37 | ) |
||
38 | zinfo.compress_type = 8 |
||
39 | zinfo.create_system = 0 |
||
40 | |||
41 | with zipf.open(zinfo, 'w') as stream: |
||
42 | stream.write(f.data) |
||
43 |