mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-29 17:42:12 +08:00
Drop use of deprecated `method parameter of starlette FileResponse`
Removed in starlette 1.0, see https://github.com/Kludex/starlette/pull/3147 Fix the following mypy errors in package tests: ``` galaxy/webapps/base/api.py:94: error: Too many arguments for "__init__" of "FileResponse" [call-arg] super().__init__( ^~~~~~~~~~~~~~~~~ galaxy/webapps/base/api.py:95: error: Argument 8 to "__init__" of "FileResponse" has incompatible type "str | None"; expected "str" [arg-type] ..., media_type, background, filename, stat_result, method, content_dispo... ^~~~~~ ```
This commit is contained in:
@@ -88,11 +88,17 @@ class GalaxyFileResponse(FileResponse):
|
||||
background: Optional["BackgroundTask"] = None,
|
||||
filename: Optional[str] = None,
|
||||
stat_result: Optional[os.stat_result] = None,
|
||||
method: Optional[str] = None,
|
||||
content_disposition_type: str = "attachment",
|
||||
) -> None:
|
||||
super().__init__(
|
||||
path, status_code, headers, media_type, background, filename, stat_result, method, content_disposition_type
|
||||
path=path,
|
||||
status_code=status_code,
|
||||
headers=headers,
|
||||
media_type=media_type,
|
||||
background=background,
|
||||
filename=filename,
|
||||
stat_result=stat_result,
|
||||
content_disposition_type=content_disposition_type,
|
||||
)
|
||||
self.headers["accept-ranges"] = "bytes"
|
||||
self.xsendfile = self.nginx_x_accel_redirect_base or self.apache_xsendfile
|
||||
|
||||
@@ -290,7 +290,7 @@ class FastAPIDatasets:
|
||||
assert isinstance(display_data, IOBase)
|
||||
file_name = getattr(display_data, "name", None)
|
||||
assert file_name
|
||||
return GalaxyFileResponse(file_name, headers=headers, method=request.method)
|
||||
return GalaxyFileResponse(file_name, headers=headers)
|
||||
|
||||
@router.get(
|
||||
"/api/histories/{history_id}/contents/{history_content_id}/display",
|
||||
@@ -374,7 +374,7 @@ class FastAPIDatasets:
|
||||
if isinstance(display_data, IOBase):
|
||||
file_name = getattr(display_data, "name", None)
|
||||
if file_name:
|
||||
return GalaxyFileResponse(file_name, headers=headers, method=request.method)
|
||||
return GalaxyFileResponse(file_name, headers=headers)
|
||||
elif isinstance(display_data, ZipstreamWrapper):
|
||||
return StreamingResponse(display_data.response(), headers=headers)
|
||||
elif isinstance(display_data, bytes):
|
||||
|
||||
Reference in New Issue
Block a user