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 8, 2024
1 parent 7d20d4c commit 7c88c02
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 @@ -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")
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 7c88c02

Please sign in to comment.