From 7c88c025c45d6204667ff50c14bbf2173b9dc4ef Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 8 Apr 2024 12:40:54 -0400 Subject: [PATCH] More explicit optionals? --- lib/galaxy/model/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index d6006e745e30..6ce94dc8801a 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -206,19 +206,19 @@ _datatypes_registry = None -OPTIONAL_STR_TO_STR_DICT = Optional[Dict[str, str]] +STR_TO_STR_DICT = Dict[str, str] class TransformAction(TypedDict): action: str -TRANSFORM_ACTIONS = Optional[List[TransformAction]] +TRANSFORM_ACTIONS = List[TransformAction] mapper_registry = registry( type_annotation_map={ - OPTIONAL_STR_TO_STR_DICT: JSONType, - TRANSFORM_ACTIONS: MutableJSONType, + Optional[STR_TO_STR_DICT]: JSONType, + Optional[TRANSFORM_ACTIONS]: MutableJSONType, }, ) @@ -1418,7 +1418,7 @@ class Job(Base, JobLike, UsesCreateAndUpdateTime, Dictifiable, Serializable): params: Mapped[Optional[str]] = mapped_column(TrimmedString(255), index=True) handler: Mapped[Optional[str]] = mapped_column(TrimmedString(255), index=True) preferred_object_store_id: Mapped[Optional[str]] = mapped_column(String(255), nullable=True) - object_store_id_overrides: Mapped[OPTIONAL_STR_TO_STR_DICT] = mapped_column(JSONType) + object_store_id_overrides: Mapped[Optional[STR_TO_STR_DICT]] = mapped_column(JSONType) user = relationship("User") galaxy_session = relationship("GalaxySession") @@ -4372,7 +4372,7 @@ class DatasetSource(Base, Dictifiable, Serializable): dataset_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("dataset.id"), index=True) source_uri: Mapped[Optional[str]] = mapped_column(TEXT) extra_files_path: Mapped[Optional[str]] = mapped_column(TEXT) - transform: Mapped[TRANSFORM_ACTIONS] = mapped_column(MutableJSONType) + transform: Mapped[Optional[TRANSFORM_ACTIONS]] = mapped_column(MutableJSONType) dataset = relationship("Dataset", back_populates="sources") hashes = relationship("DatasetSourceHash", back_populates="source") dict_collection_visible_keys = ["id", "source_uri", "extra_files_path", "transform"]