Skip to content

Commit

Permalink
Use aiofiles
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Apr 3, 2024
1 parent 3c5397f commit 4256968
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions adit/dicom_web/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import logging
import os
from pathlib import Path
from typing import Literal

from adrf.views import APIView as AsyncApiView
from adrf.views import sync_to_async
from aiofiles.os import makedirs
from django.conf import settings
from rest_framework.exceptions import NotAcceptable, NotFound, ParseError, ValidationError
from rest_framework.request import Request
Expand Down Expand Up @@ -160,10 +159,10 @@ async def _generate_temp_folder(
folder_path = Path(settings.TEMP_DICOM_DIR) / "wado"
if level == "STUDY":
folder_path = folder_path / ("study_" + study_uid)
await sync_to_async(os.makedirs)(folder_path, exist_ok=True)
await makedirs(folder_path, exist_ok=True)
elif level == "SERIES":
folder_path = folder_path / ("series_" + series_uid)
await sync_to_async(os.makedirs)(folder_path, exist_ok=True)
await makedirs(folder_path, exist_ok=True)

return folder_path

Expand Down

0 comments on commit 4256968

Please sign in to comment.