Skip to content

Commit

Permalink
More explicit optionals?
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 15, 2024
1 parent 7afc088 commit 873ade5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)

Expand Down Expand Up @@ -1406,7 +1406,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))
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: Mapped[Optional["User"]] = relationship()
galaxy_session: Mapped[Optional["GalaxySession"]] = relationship()
Expand Down Expand Up @@ -4364,7 +4364,7 @@ class DatasetSource(Base, Dictifiable, Serializable):
dataset_id: Mapped[Optional[int]] = mapped_column(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: Mapped[Optional["Dataset"]] = relationship(back_populates="sources")
hashes: Mapped[List["DatasetSourceHash"]] = relationship(back_populates="source")
dict_collection_visible_keys = ["id", "source_uri", "extra_files_path", "transform"]
Expand Down

0 comments on commit 873ade5

Please sign in to comment.