diff --git a/chebai/preprocessing/datasets/tox21.py b/chebai/preprocessing/datasets/tox21.py index 98d78009..79cd35e9 100644 --- a/chebai/preprocessing/datasets/tox21.py +++ b/chebai/preprocessing/datasets/tox21.py @@ -56,14 +56,16 @@ def processed_file_names(self) -> List[str]: def download(self) -> None: """Downloads and extracts the dataset.""" - with NamedTemporaryFile("rb") as gout: - request.urlretrieve( - "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/tox21.csv.gz", - gout.name, - ) - with gzip.open(gout.name) as gfile: - with open(os.path.join(self.raw_dir, "tox21.csv"), "wt") as fout: - fout.write(gfile.read().decode()) + gout = NamedTemporaryFile("rb") + gout.close() + + request.urlretrieve( + "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/tox21.csv.gz", + gout.name, + ) + with gzip.open(gout.name) as gfile: + with open(os.path.join(self.raw_dir, "tox21.csv"), "wt") as fout: + fout.write(gfile.read().decode()) def setup_processed(self) -> None: """Processes and splits the dataset."""