Skip to content

Commit

Permalink
fix(tests): missing os
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Jan 30, 2024
1 parent 2d5bf9e commit 90e8e2f
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions src/nbiatoolkit/nbia.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from math import e
from .auth import OAuth2
from .utils.nbia_endpoints import NBIA_ENDPOINTS
from .logger.logger import setup_logger
Expand Down Expand Up @@ -147,13 +146,10 @@ def getPatients(self, Collection: str = "") -> Union[list[dict[str, str]], None]
), "PatientId must be a string, but received: %s" % type(
patient["PatientId"]
)


patientList.append(
{
"PatientId": patient["PatientId"],
"PatientName": patient["PatientName"],
"PatientSex": patient["PatientSex"],
"Collection": patient["Collection"],
}
patient
)

return patientList
Expand Down Expand Up @@ -269,27 +265,26 @@ def downloadSeries(

try:
os.makedirs(downloadDir)
except FileExistsError:
pass

for seriesUID in SeriesInstanceUID:
future = executor.submit(
self._downloadSingleSeries,
SeriesInstanceUID=seriesUID,
downloadDir=downloadDir,
filePattern=filePattern,
overwrite=overwrite,
)
futures.append(future)

for seriesUID in SeriesInstanceUID:
future = executor.submit(
self._downloadSingleSeries,
SeriesInstanceUID=seriesUID,
downloadDir=downloadDir,
filePattern=filePattern,
overwrite=overwrite,
)
futures.append(future)
# Use tqdm to create a progress bar
with tqdm(
total=len(futures), desc=f"Downloading {len(futures)} series"
) as pbar:
for future in cf.as_completed(futures):
pbar.update(1)

except Exception as e:
self.log.error("Error creating download directory: %s", e)
raise e
else:
# Use tqdm to create a progress bar
with tqdm(
total=len(futures), desc=f"Downloading {len(futures)} series"
) as pbar:
for future in cf.as_completed(futures):
pbar.update(1)
return True

# _downloadSingleSeries is a helper function that downloads a single series
Expand Down

0 comments on commit 90e8e2f

Please sign in to comment.