mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-09 19:08:51 -06:00
simulate_perfect: Do not overwrite original file
This commit is contained in:
@@ -29,12 +29,15 @@ class InstanceIterator:
|
||||
self.current += 1
|
||||
if isinstance(result, str):
|
||||
logger.debug("Read: %s" % result)
|
||||
if result.endswith(".gz"):
|
||||
with gzip.GzipFile(result, "rb") as file:
|
||||
result = pickle.load(file)
|
||||
else:
|
||||
with open(result, "rb") as file:
|
||||
result = pickle.load(file)
|
||||
try:
|
||||
if result.endswith(".gz"):
|
||||
with gzip.GzipFile(result, "rb") as file:
|
||||
result = pickle.load(file)
|
||||
else:
|
||||
with open(result, "rb") as file:
|
||||
result = pickle.load(file)
|
||||
except pickle.UnpicklingError:
|
||||
raise Exception(f"Invalid instance file: {result}")
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user