Use modern X | None syntax after dev migration

This commit is contained in:
Nuwan Goonasekera
2026-07-08 01:25:43 +05:30
parent 42dfcdd5f5
commit 05c726109c
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -374,9 +374,9 @@ class FastAPIDatasets:
self,
request: Request,
history_content_id: HistoryDatasetIDPathParam,
history_id: Optional[HistoryIDPathParam] = None,
history_id: HistoryIDPathParam | None = None,
trans=DependsOnTrans,
to_ext: Optional[str] = ToExtQueryParam,
to_ext: str | None = ToExtQueryParam,
):
"""Downloads the whole dataset file. Clients must follow the 302 redirect this route may return."""
return self._download(request, trans, history_content_id, to_ext)
@@ -396,12 +396,12 @@ class FastAPIDatasets:
request: Request,
history_content_id: HistoryDatasetIDPathParam,
trans=DependsOnTrans,
to_ext: Optional[str] = ToExtQueryParam,
to_ext: str | None = ToExtQueryParam,
):
"""Downloads the whole dataset file. Clients must follow the 302 redirect this route may return."""
return self._download(request, trans, history_content_id, to_ext)
def _download(self, request: Request, trans, dataset_id: DecodedDatabaseIdField, to_ext: Optional[str]):
def _download(self, request: Request, trans, dataset_id: DecodedDatabaseIdField, to_ext: str | None):
# Default to_ext to "data" so the route always behaves as a whole-file download (server infers
# the extension from the datatype) rather than a preview.
to_ext = to_ext or "data"
@@ -650,9 +650,9 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin):
self,
trans: ProvidesHistoryContext,
dataset_id: DecodedDatabaseIdField,
to_ext: Optional[str] = None,
to_ext: str | None = None,
hda_ldda: DatasetSourceType = DatasetSourceType.hda,
) -> Optional[str]:
) -> str | None:
"""Return a backing-store URL a whole-file download can be redirected to, or None to stream.
Used by the dedicated download route; the regular display route never redirects.
@@ -678,7 +678,7 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin):
self,
trans: ProvidesHistoryContext,
dataset_id: DecodedDatabaseIdField,
to_ext: Optional[str] = None,
to_ext: str | None = None,
hda_ldda: DatasetSourceType = DatasetSourceType.hda,
) -> dict[str, str]:
"""Build response headers for a HEAD download request from object-store metadata.