Loading lib/galaxy/managers/tags.py +4 −4 Original line number Diff line number Diff line from enum import Enum from typing import ( List, Optional, ) Loading @@ -13,6 +12,7 @@ from galaxy.managers.context import ProvidesUserContext from galaxy.model import ItemTagAssociation from galaxy.model.tags import GalaxyTagHandlerSession from galaxy.schema.fields import EncodedDatabaseIdField from galaxy.schema.schema import TagCollection taggable_item_names = {item: item for item in ItemTagAssociation.associated_item_names} # This Enum is generated dynamically and mypy can not statically infer it's real type Loading @@ -31,7 +31,7 @@ class ItemTagsPayload(BaseModel): title="Item class", description="The name of the class of the item that will be tagged.", ) item_tags: Optional[List[str]] = Field( item_tags: Optional[TagCollection] = Field( default=None, title="Item tags", description="The list of tags that will replace the current tags associated with the item.", Loading @@ -48,8 +48,8 @@ class TagsManager: """Apply a new set of tags to an item; previous tags are deleted.""" tag_handler = GalaxyTagHandlerSession(trans.sa_session) new_tags: Optional[str] = None if payload.item_tags and len(payload.item_tags) > 0: new_tags = ",".join(payload.item_tags) if payload.item_tags and len(payload.item_tags.__root__) > 0: new_tags = ",".join(payload.item_tags.__root__) item = self._get_item(trans, payload) user = trans.user tag_handler.delete_item_tags(user, item) Loading Loading
lib/galaxy/managers/tags.py +4 −4 Original line number Diff line number Diff line from enum import Enum from typing import ( List, Optional, ) Loading @@ -13,6 +12,7 @@ from galaxy.managers.context import ProvidesUserContext from galaxy.model import ItemTagAssociation from galaxy.model.tags import GalaxyTagHandlerSession from galaxy.schema.fields import EncodedDatabaseIdField from galaxy.schema.schema import TagCollection taggable_item_names = {item: item for item in ItemTagAssociation.associated_item_names} # This Enum is generated dynamically and mypy can not statically infer it's real type Loading @@ -31,7 +31,7 @@ class ItemTagsPayload(BaseModel): title="Item class", description="The name of the class of the item that will be tagged.", ) item_tags: Optional[List[str]] = Field( item_tags: Optional[TagCollection] = Field( default=None, title="Item tags", description="The list of tags that will replace the current tags associated with the item.", Loading @@ -48,8 +48,8 @@ class TagsManager: """Apply a new set of tags to an item; previous tags are deleted.""" tag_handler = GalaxyTagHandlerSession(trans.sa_session) new_tags: Optional[str] = None if payload.item_tags and len(payload.item_tags) > 0: new_tags = ",".join(payload.item_tags) if payload.item_tags and len(payload.item_tags.__root__) > 0: new_tags = ",".join(payload.item_tags.__root__) item = self._get_item(trans, payload) user = trans.user tag_handler.delete_item_tags(user, item) Loading