mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
fix wrong type annotations
This commit is contained in:
@@ -90,7 +90,7 @@ def view_converters(datatypes_registry: Registry) -> DatatypeConverterList:
|
||||
return parse_obj_as(DatatypeConverterList, converters)
|
||||
|
||||
|
||||
def _get_edam_details(datatypes_registry: Registry, edam_ids: Dict[str, str]):
|
||||
def _get_edam_details(datatypes_registry: Registry, edam_ids: Dict[str, str]) -> Dict[str, Dict]:
|
||||
details_dict = {}
|
||||
for (format, edam_iri) in edam_ids.items():
|
||||
edam_details = datatypes_registry.edam.get(edam_iri, {})
|
||||
@@ -106,7 +106,7 @@ def _get_edam_details(datatypes_registry: Registry, edam_ids: Dict[str, str]):
|
||||
|
||||
def view_edam_formats(
|
||||
datatypes_registry: Registry, detailed: Optional[bool] = False
|
||||
) -> Union[Dict[str, str], DatatypesEDAMDetailsDict]:
|
||||
) -> Union[Dict[str, str], Dict[str, Dict[str, str]]]:
|
||||
if detailed:
|
||||
return _get_edam_details(datatypes_registry, datatypes_registry.edam_formats)
|
||||
else:
|
||||
@@ -115,7 +115,7 @@ def view_edam_formats(
|
||||
|
||||
def view_edam_data(
|
||||
datatypes_registry: Registry, detailed: Optional[bool] = False
|
||||
) -> Union[Dict[str, str], DatatypesEDAMDetailsDict]:
|
||||
) -> Union[Dict[str, str], Dict[str, Dict[str, str]]]:
|
||||
if detailed:
|
||||
return _get_edam_details(datatypes_registry, datatypes_registry.edam_data)
|
||||
else:
|
||||
|
||||
@@ -3,6 +3,7 @@ API operations allowing clients to determine datatype supported by Galaxy.
|
||||
"""
|
||||
import logging
|
||||
from typing import (
|
||||
cast,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
@@ -122,14 +123,15 @@ class FastAPIDatatypes:
|
||||
)
|
||||
async def edam_formats(self) -> Dict[str, str]:
|
||||
"""Gets a map of datatypes and their corresponding EDAM formats."""
|
||||
return view_edam_formats(self.datatypes_registry)
|
||||
return cast(Dict[str, str], view_edam_formats(self.datatypes_registry))
|
||||
|
||||
@router.get(
|
||||
"/api/datatypes/edam_formats/detailed",
|
||||
summary="Returns a dictionary of datatypes and EDAM format details",
|
||||
response_description="Dictionary of EDAM format details containing the EDAM iri, label, and definition",
|
||||
response_model=DatatypesEDAMDetailsDict,
|
||||
)
|
||||
async def edam_formats_detailed(self) -> DatatypesEDAMDetailsDict:
|
||||
async def edam_formats_detailed(self):
|
||||
"""Gets a map of datatypes and their corresponding EDAM formats.
|
||||
EDAM formats contain the EDAM iri, label, and definition."""
|
||||
return view_edam_formats(self.datatypes_registry, True)
|
||||
@@ -141,14 +143,15 @@ class FastAPIDatatypes:
|
||||
)
|
||||
async def edam_data(self) -> Dict[str, str]:
|
||||
"""Gets a map of datatypes and their corresponding EDAM data."""
|
||||
return view_edam_data(self.datatypes_registry)
|
||||
return cast(Dict[str, str], view_edam_data(self.datatypes_registry))
|
||||
|
||||
@router.get(
|
||||
"/api/datatypes/edam_data/detailed",
|
||||
summary="Returns a dictionary of datatypes and EDAM data details",
|
||||
response_description="Dictionary of EDAM data details containing the EDAM iri, label, and definition",
|
||||
response_model=DatatypesEDAMDetailsDict,
|
||||
)
|
||||
async def edam_data_detailed(self) -> DatatypesEDAMDetailsDict:
|
||||
async def edam_data_detailed(self):
|
||||
"""Gets a map of datatypes and their corresponding EDAM data.
|
||||
EDAM data contains the EDAM iri, label, and definition."""
|
||||
return view_edam_data(self.datatypes_registry, True)
|
||||
|
||||
Reference in New Issue
Block a user