Skip to content

Commit

Permalink
[WIP] Remove model attr type hints that conflict with SA2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Dec 12, 2023
1 parent 4fcf474 commit 0f88054
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@
)
from galaxy.model.orm.now import now
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.objectstore import ObjectStore

# from galaxy.objectstore import ObjectStore
from galaxy.schema.invocation import InvocationCancellationUserRequest
from galaxy.schema.schema import (
DatasetCollectionPopulatedState,
Expand Down Expand Up @@ -215,8 +216,9 @@ class DeclarativeMeta(_DeclarativeMeta, type):
pass

from galaxy.datatypes.data import Data
from galaxy.tools import DefaultToolState
from galaxy.workflow.modules import WorkflowModule

# from galaxy.tools import DefaultToolState
# from galaxy.workflow.modules import WorkflowModule

class _HasTable:
table: Table
Expand Down Expand Up @@ -730,7 +732,7 @@ class User(Base, Dictifiable, RepresentById):
"FormValues", primaryjoin=(lambda: User.form_values_id == FormValues.id) # type: ignore[has-type]
)
# Add type hint (will this work w/SA?)
api_keys: "List[APIKeys]" = relationship(
api_keys = relationship(
"APIKeys",
back_populates="user",
order_by=lambda: desc(APIKeys.create_time),
Expand Down Expand Up @@ -760,7 +762,7 @@ class User(Base, Dictifiable, RepresentById):
),
)

preferences: association_proxy # defined at the end of this module
preferences = None

# attributes that will be accessed and returned when calling to_dict( view='collection' )
dict_collection_visible_keys = ["id", "email", "username", "deleted", "active", "last_password_change"]
Expand Down Expand Up @@ -1358,8 +1360,8 @@ class Job(Base, JobLike, UsesCreateAndUpdateTime, Dictifiable, Serializable):
"WorkflowInvocationStep", back_populates="job", uselist=False, cascade_backrefs=False
)

any_output_dataset_collection_instances_deleted: column_property # defined at the end of this module
any_output_dataset_deleted: column_property # defined at the end of this module
any_output_dataset_collection_instances_deleted = None
any_output_dataset_deleted = None

dict_collection_visible_keys = ["id", "state", "exit_code", "update_time", "create_time", "galaxy_version"]
dict_element_visible_keys = [
Expand Down Expand Up @@ -3003,8 +3005,8 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
update_time = column_property(
select(func.max(HistoryAudit.update_time)).where(HistoryAudit.history_id == id).scalar_subquery(),
)
users_shared_with_count: column_property # defined at the end of this module
average_rating: column_property # defined at the end of this module
users_shared_with_count = None
average_rating = None

# Set up proxy so that
# History.users_shared_with
Expand Down Expand Up @@ -3933,7 +3935,7 @@ class conversion_messages(str, Enum):

permitted_actions = get_permitted_actions(filter="DATASET")
file_path = "/tmp/"
object_store: Optional[ObjectStore] = None # This get initialized in mapping.py (method init) by app.py
object_store = None # This get initialized in mapping.py (method init) by app.py
engine = None

def __init__(
Expand Down Expand Up @@ -7347,7 +7349,7 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById):
)
users_shared_with = relationship("StoredWorkflowUserShareAssociation", back_populates="stored_workflow")

average_rating: column_property
average_rating = None

# Set up proxy so that
# StoredWorkflow.users_shared_with
Expand Down Expand Up @@ -7461,15 +7463,15 @@ class Workflow(Base, Dictifiable, RepresentById):
source_metadata = Column(JSONType)
uuid = Column(UUIDType, nullable=True)

steps: List["WorkflowStep"] = relationship(
steps = relationship(
"WorkflowStep",
back_populates="workflow",
primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore[has-type]
order_by=lambda: asc(WorkflowStep.order_index), # type: ignore[has-type]
cascade="all, delete-orphan",
lazy=False,
)
comments: List["WorkflowComment"] = relationship(
comments = relationship(
"WorkflowComment",
back_populates="workflow",
primaryjoin=(lambda: Workflow.id == WorkflowComment.workflow_id), # type: ignore[has-type]
Expand All @@ -7488,7 +7490,7 @@ class Workflow(Base, Dictifiable, RepresentById):
back_populates="workflows",
)

step_count: column_property
step_count = None

dict_collection_visible_keys = ["name", "has_cycles", "has_errors"]
dict_element_visible_keys = ["name", "has_cycles", "has_errors"]
Expand Down Expand Up @@ -7646,7 +7648,7 @@ class WorkflowStep(Base, RepresentById):
when_expression = Column(JSONType)
uuid = Column(UUIDType)
label = Column(Unicode(255))
temp_input_connections: Optional[InputConnDictType]
temp_input_connections = None
parent_comment_id = Column(Integer, ForeignKey("workflow_comment.id"), nullable=True)

parent_comment = relationship(
Expand All @@ -7655,7 +7657,7 @@ class WorkflowStep(Base, RepresentById):
back_populates="child_steps",
)

subworkflow: Optional[Workflow] = relationship(
subworkflow = relationship(
"Workflow",
primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id),
back_populates="parent_workflow_steps",
Expand Down Expand Up @@ -7684,9 +7686,9 @@ class WorkflowStep(Base, RepresentById):

# Injected attributes
# TODO: code using these should be refactored to not depend on these non-persistent fields
module: Optional["WorkflowModule"]
state: Optional["DefaultToolState"]
upgrade_messages: Optional[Dict]
module = None
state = None
upgrade_messages = None

STEP_TYPE_TO_INPUT_TYPE = {
"data_input": "dataset",
Expand Down Expand Up @@ -8102,20 +8104,20 @@ class WorkflowComment(Base, RepresentById):
back_populates="comments",
)

child_steps: List["WorkflowStep"] = relationship(
child_steps = relationship(
"WorkflowStep",
primaryjoin=(lambda: WorkflowStep.parent_comment_id == WorkflowComment.id),
back_populates="parent_comment",
)

parent_comment: "WorkflowComment" = relationship(
parent_comment = relationship(
"WorkflowComment",
primaryjoin=(lambda: WorkflowComment.id == WorkflowComment.parent_comment_id),
back_populates="child_comments",
remote_side=[id],
)

child_comments: List["WorkflowComment"] = relationship(
child_comments = relationship(
"WorkflowComment",
primaryjoin=(lambda: WorkflowComment.parent_comment_id == WorkflowComment.id),
back_populates="parent_comment",
Expand Down Expand Up @@ -8227,7 +8229,7 @@ class WorkflowInvocation(Base, UsesCreateAndUpdateTime, Dictifiable, Serializabl
order_by=lambda: WorkflowInvocationStep.order_index,
cascade_backrefs=False,
)
workflow: Workflow = relationship("Workflow")
workflow = relationship("Workflow")
output_dataset_collections = relationship(
"WorkflowInvocationOutputDatasetCollectionAssociation",
back_populates="workflow_invocation",
Expand Down Expand Up @@ -8881,7 +8883,7 @@ class WorkflowInvocationStep(Base, Dictifiable, Serializable):
select(WorkflowStep.order_index).where(WorkflowStep.id == workflow_step_id).scalar_subquery()
)

subworkflow_invocation_id: column_property
subworkflow_invocation_id = None

dict_collection_visible_keys = [
"id",
Expand Down Expand Up @@ -9893,7 +9895,7 @@ class Page(Base, HasTags, Dictifiable, RepresentById):
)
users_shared_with = relationship("PageUserShareAssociation", back_populates="page")

average_rating: column_property # defined at the end of this module
average_rating = None

# Set up proxy so that
# Page.users_shared_with
Expand Down Expand Up @@ -10019,7 +10021,7 @@ class Visualization(Base, HasTags, Dictifiable, RepresentById):
)
users_shared_with = relationship("VisualizationUserShareAssociation", back_populates="visualization")

average_rating: column_property # defined at the end of this module
average_rating = None

# Set up proxy so that
# Visualization.users_shared_with
Expand Down

0 comments on commit 0f88054

Please sign in to comment.