Skip to content

Commit

Permalink
chore: add explicit parameters in zipfile
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBredehoft committed Apr 4, 2024
1 parent c3982ca commit cedebba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/concrete/ml/pandas/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def deserialize_elementwise(array: numpy.ndarray) -> numpy.ndarray:


def serialize_evaluation_keys(evaluation_keys: fhe.EvaluationKeys) -> bytes:
"""Serialize the evaluation keys into a string of hexadecimal numbers.
"""Serialize the evaluation keys into bytes.
Args:
evaluation_keys (fhe.EvaluationKeys): The evaluation keys to serialize.
Expand Down
6 changes: 3 additions & 3 deletions src/concrete/ml/pandas/dataframe.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Define the encrypted data-frame framework."""
import json
import zipfile
from pathlib import Path
from typing import Dict, Hashable, List, Optional, Sequence, Tuple, Union
from zipfile import ZIP_STORED, ZipFile

import numpy
import pandas
Expand Down Expand Up @@ -327,7 +327,7 @@ def save(self, path: Union[Path, str]):

encrypted_df_json_bytes = json.dumps(encrypted_df_dict).encode(encoding="utf-8")

with zipfile.ZipFile(path, "w") as zip_file:
with ZipFile(path, "w", compression=ZIP_STORED, allowZip64=True) as zip_file:
zip_file.writestr("encrypted_dataframe.json", encrypted_df_json_bytes)
zip_file.writestr("evaluation_keys", evaluation_keys)

Expand All @@ -346,7 +346,7 @@ def load(cls, path: Union[Path, str]):
if path.suffix != ".zip":
path = path.with_suffix(".zip")

with zipfile.ZipFile(path, "r") as zip_file:
with ZipFile(path, "r", compression=ZIP_STORED, allowZip64=True) as zip_file:
with zip_file.open("encrypted_dataframe.json") as encrypted_df_json_file:
encrypted_df_json_bytes = encrypted_df_json_file.read()
encrypted_df_dict = json.loads(encrypted_df_json_bytes)
Expand Down

0 comments on commit cedebba

Please sign in to comment.