mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 05:45:37 +08:00
Remove more __root__ and construct calls
This commit is contained in:
@@ -2694,14 +2694,14 @@ class BcoModelExportStore(WorkflowInvocationOnlyExportStore):
|
||||
empirical_error=export_options.override_empirical_error or {},
|
||||
algorithmic_error=export_options.override_algorithmic_error or {},
|
||||
)
|
||||
usability_domain = UsabilityDomain(__root__=usability_domain_str)
|
||||
usability_domain = UsabilityDomain(root=usability_domain_str)
|
||||
description_domain = DescriptionDomain(
|
||||
keywords=keywords,
|
||||
xref=export_options.override_xref or [],
|
||||
platform=["Galaxy"],
|
||||
pipeline_steps=pipeline_steps,
|
||||
)
|
||||
parametric_domain = ParametricDomain(__root__=parametric_domain_items)
|
||||
parametric_domain = ParametricDomain(root=parametric_domain_items)
|
||||
io_domain = InputAndOutputDomain(
|
||||
input_subdomain=input_subdomain_items,
|
||||
output_subdomain=output_subdomain_items,
|
||||
|
||||
@@ -391,8 +391,8 @@ class FastAPIHistories:
|
||||
use_tasks = accept == ExportTaskListResponse.__accept_type__
|
||||
exports = self.service.index_exports(trans, history_id, use_tasks, limit, offset)
|
||||
if use_tasks:
|
||||
return ExportTaskListResponse(__root__=exports)
|
||||
return JobExportHistoryArchiveListResponse(__root__=exports)
|
||||
return ExportTaskListResponse(root=exports)
|
||||
return JobExportHistoryArchiveListResponse(root=exports)
|
||||
|
||||
@router.put( # PUT instead of POST because multiple requests should just result in one object being created.
|
||||
"/api/histories/{history_id}/exports",
|
||||
|
||||
@@ -45,7 +45,7 @@ class FastAPIRoles:
|
||||
@router.get("/api/roles")
|
||||
def index(self, trans: ProvidesUserContext = DependsOnTrans) -> RoleListResponse:
|
||||
roles = self.role_manager.list_displayable_roles(trans)
|
||||
return RoleListResponse(__root__=[role_to_model(r) for r in roles])
|
||||
return RoleListResponse(root=[role_to_model(r) for r in roles])
|
||||
|
||||
@router.get("/api/roles/{id}")
|
||||
def show(self, id: DecodedDatabaseIdField, trans: ProvidesUserContext = DependsOnTrans) -> RoleModelResponse:
|
||||
|
||||
@@ -142,9 +142,7 @@ class ToolShedRepositoriesController(BaseGalaxyAPIController):
|
||||
irm = InstallRepositoryManager(self.app)
|
||||
installed_tool_shed_repositories = irm.install(tool_shed_url, name, owner, changeset_revision, payload)
|
||||
if installed_tool_shed_repositories:
|
||||
return InstalledToolShedRepositories(
|
||||
__root__=list(map(self.service._show, installed_tool_shed_repositories))
|
||||
)
|
||||
return InstalledToolShedRepositories(root=list(map(self.service._show, installed_tool_shed_repositories)))
|
||||
message = "No repositories were installed, possibly because the selected repository has already been installed."
|
||||
return dict(status="ok", message=message)
|
||||
|
||||
@@ -245,7 +243,7 @@ class ToolShedRepositoriesController(BaseGalaxyAPIController):
|
||||
return installed_tool_shed_repositories
|
||||
elif isinstance(installed_tool_shed_repositories, InstalledToolShedRepositories):
|
||||
all_installed_tool_shed_repositories.extend(installed_tool_shed_repositories.__root__)
|
||||
return InstalledToolShedRepositories(__root__=all_installed_tool_shed_repositories)
|
||||
return InstalledToolShedRepositories(root=all_installed_tool_shed_repositories)
|
||||
|
||||
@require_admin
|
||||
@expose_api
|
||||
|
||||
@@ -559,7 +559,7 @@ class FastAPIUsers:
|
||||
for key, attributes in valid_dbkeys.items():
|
||||
attributes["id"] = key
|
||||
dbkey_collection.append(attributes)
|
||||
return CustomBuildsCollection.construct(__root__=dbkey_collection)
|
||||
return CustomBuildsCollection.model_construct(root=dbkey_collection)
|
||||
|
||||
@router.delete(
|
||||
"/api/users/{user_id}/custom_builds/{key}", name="delete_custom_build", summary="Delete a custom build"
|
||||
|
||||
@@ -594,7 +594,7 @@ class HistoriesContentsService(ServiceBase, ServesExportStores, ConsumesModelSto
|
||||
:raises: RequestParameterInvalidException, ObjectNotFound, InsufficientPermissionsException, InternalServerError
|
||||
RequestParameterMissingException
|
||||
"""
|
||||
payload_dict = payload.dict(by_alias=True)
|
||||
payload_dict = payload.model_dump(by_alias=True)
|
||||
hda = self.hda_manager.get_owned(history_content_id, trans.user, current_history=trans.history, trans=trans)
|
||||
assert hda is not None
|
||||
self.history_manager.error_unless_mutable(hda.history)
|
||||
|
||||
@@ -78,7 +78,7 @@ class LibrariesService(ServiceBase, ConsumesModelStores):
|
||||
for library in query:
|
||||
library_dict = self.library_manager.get_library_dict(trans, library, prefetched_ids)
|
||||
libraries.append(LibrarySummary(**library_dict))
|
||||
return LibrarySummaryList(__root__=libraries)
|
||||
return LibrarySummaryList(root=libraries)
|
||||
|
||||
def show(self, trans, id: DecodedDatabaseIdField) -> LibrarySummary:
|
||||
"""Returns detailed information about a library."""
|
||||
|
||||
@@ -92,9 +92,9 @@ class NotificationService(ServiceBase):
|
||||
"""
|
||||
self.notification_manager.ensure_notifications_enabled()
|
||||
if user_context.anonymous:
|
||||
return UserNotificationListResponse(__root__=[])
|
||||
return UserNotificationListResponse(root=[])
|
||||
user_notifications = self._get_user_notifications(user_context, limit, offset)
|
||||
return UserNotificationListResponse(__root__=user_notifications)
|
||||
return UserNotificationListResponse(root=user_notifications)
|
||||
|
||||
def get_broadcasted_notification(
|
||||
self, user_context: ProvidesUserContext, notification_id: int
|
||||
@@ -118,7 +118,7 @@ class NotificationService(ServiceBase):
|
||||
self.notification_manager.ensure_notifications_enabled()
|
||||
active_only = not user_context.user_is_admin
|
||||
broadcasted_notifications = self._get_all_broadcasted(active_only=active_only)
|
||||
return BroadcastNotificationListResponse(__root__=broadcasted_notifications)
|
||||
return BroadcastNotificationListResponse(root=broadcasted_notifications)
|
||||
|
||||
def get_user_notification(self, user: User, notification_id: int) -> UserNotificationResponse:
|
||||
"""Gets the information of the notification received by the user with the given ID."""
|
||||
|
||||
@@ -74,9 +74,7 @@ class PagesService(ServiceBase):
|
||||
|
||||
pages, total_matches = self.manager.index_query(trans, payload, include_total_count)
|
||||
return (
|
||||
PageSummaryList.construct(
|
||||
__root__=[trans.security.encode_all_ids(p.to_dict(), recursive=True) for p in pages]
|
||||
),
|
||||
PageSummaryList.construct(root=[trans.security.encode_all_ids(p.to_dict(), recursive=True) for p in pages]),
|
||||
total_matches,
|
||||
)
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ class ToolShedPopulator:
|
||||
assert_msg = f"Updating repository [{repository}] with path [{path}] and commit_message {commit_message} failed to update repository contents, no changes found. Response: [{response_json}]"
|
||||
raise AssertionError(assert_msg)
|
||||
api_asserts.assert_status_code_is_ok(response)
|
||||
return RepositoryUpdate(__root__=response.json())
|
||||
return RepositoryUpdate(root=response.json())
|
||||
|
||||
def new_repository(self, category_ids: Union[List[str], str], prefix: str = DEFAULT_PREFIX) -> Repository:
|
||||
name = random_name(prefix=prefix)
|
||||
@@ -293,7 +293,7 @@ class ToolShedPopulator:
|
||||
"repositories/get_ordered_installable_revisions", params=request.dict()
|
||||
)
|
||||
api_asserts.assert_status_code_is_ok(revisions_response)
|
||||
return OrderedInstallableRevisions(__root__=revisions_response.json())
|
||||
return OrderedInstallableRevisions(root=revisions_response.json())
|
||||
|
||||
def assert_has_n_installable_revisions(self, repository: Repository, n: int):
|
||||
revisions = self.get_ordered_installable_revisions(repository.owner, repository.name)
|
||||
@@ -312,7 +312,7 @@ class ToolShedPopulator:
|
||||
def repository_index(self, request: Optional[RepositoryIndexRequest]) -> RepositoryIndexResponse:
|
||||
repository_response = self._api_interactor.get("repositories", params=(request.dict() if request else {}))
|
||||
api_asserts.assert_status_code_is_ok(repository_response)
|
||||
return RepositoryIndexResponse(__root__=repository_response.json())
|
||||
return RepositoryIndexResponse(root=repository_response.json())
|
||||
|
||||
def get_usernames_allowed_to_push(self, repository: HasRepositoryId) -> List[str]:
|
||||
repository_id = self._repository_id(repository)
|
||||
@@ -373,7 +373,7 @@ class ToolShedPopulator:
|
||||
f"repositories/{repository_id}/metadata?downloadable_only={downloadable_only}"
|
||||
)
|
||||
api_asserts.assert_status_code_is_ok(metadata_response)
|
||||
return RepositoryMetadata(__root__=metadata_response.json())
|
||||
return RepositoryMetadata(root=metadata_response.json())
|
||||
|
||||
def reset_metadata(self, repository: HasRepositoryId) -> ResetMetadataOnRepositoryResponse:
|
||||
repository_id = self._repository_id(repository)
|
||||
|
||||
@@ -54,7 +54,7 @@ def example_bc_core_object() -> BioComputeObjectCore:
|
||||
email="normal@example.com",
|
||||
orcid="http://orcid.org/0000-0002-1825-0097",
|
||||
)
|
||||
parametric_domain = ParametricDomain(__root__=[])
|
||||
parametric_domain = ParametricDomain(root=[])
|
||||
provenance_domain = ProvenanceDomain(
|
||||
name="workflow_name",
|
||||
version="workflow_version.0",
|
||||
@@ -64,7 +64,7 @@ def example_bc_core_object() -> BioComputeObjectCore:
|
||||
contributors=[contributor],
|
||||
license="MIT",
|
||||
)
|
||||
usability_domain = UsabilityDomain(__root__=["workflow annotation"])
|
||||
usability_domain = UsabilityDomain(root=["workflow annotation"])
|
||||
gx_extension_domains = extension_domains(
|
||||
galaxy_url="https://usegalaxy.org",
|
||||
galaxy_version="22.05.0",
|
||||
|
||||
Reference in New Issue
Block a user