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