mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Make read/write_pickle_gz quiet
This commit is contained in:
@@ -134,17 +134,13 @@ class PickleGzInstance(Instance):
|
|||||||
write_pickle_gz(self.instance, self.filename)
|
write_pickle_gz(self.instance, self.filename)
|
||||||
|
|
||||||
|
|
||||||
def write_pickle_gz(obj: Any, filename: str, quiet: bool = False) -> None:
|
def write_pickle_gz(obj: Any, filename: str) -> None:
|
||||||
if not quiet:
|
|
||||||
logger.info(f"Writing: {filename}")
|
|
||||||
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||||
with gzip.GzipFile(filename, "wb") as file:
|
with gzip.GzipFile(filename, "wb") as file:
|
||||||
pickle.dump(obj, cast(IO[bytes], file))
|
pickle.dump(obj, cast(IO[bytes], file))
|
||||||
|
|
||||||
|
|
||||||
def read_pickle_gz(filename: str, quiet: bool = False) -> Any:
|
def read_pickle_gz(filename: str) -> Any:
|
||||||
if not quiet:
|
|
||||||
logger.info(f"Reading: {filename}")
|
|
||||||
with gzip.GzipFile(filename, "rb") as file:
|
with gzip.GzipFile(filename, "rb") as file:
|
||||||
return pickle.load(cast(IO[bytes], file))
|
return pickle.load(cast(IO[bytes], file))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user