Add removal of decompressed pickle file

This commit is contained in:
Koa Wells 2023-10-04 15:11:35 -04:00
parent 29ba43f1d9
commit a97c068513

View File

@ -14,6 +14,7 @@ import math
import pickle
import sys
import pathlib
import os
from pathlib import Path
from typing import List, Union
@ -309,7 +310,9 @@ class City:
"""
with open(str(compressed_city_filename), 'rb') as source, open(str(destination_filename), 'wb') as destination:
destination.write(bz2.decompress(source.read()))
return City.load(destination_filename)
loaded_city = City.load(destination_filename)
os.unlink(destination_filename)
return loaded_city
def save(self, city_filename):
"""