Skip to content

Commit

Permalink
[WIP] Silence mypy errors caused by model edits
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Dec 19, 2023
1 parent 812273f commit 710ffca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/managers/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ def update_broadcasted_notification(self, notification_id: int, request: Notific
def get_user_notification_preferences(self, user: User) -> UserNotificationPreferences:
"""Gets the user's current notification preferences or the default ones if no preferences are set."""
current_notification_preferences = (
user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME]
if NOTIFICATION_PREFERENCES_SECTION_NAME in user.preferences
user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] # type:ignore[index]
if NOTIFICATION_PREFERENCES_SECTION_NAME in user.preferences # type:ignore[operator]
else None
)
try:
Expand All @@ -291,7 +291,7 @@ def update_user_notification_preferences(
"""Updates the user's notification preferences with the requested changes."""
notification_preferences = self.get_user_notification_preferences(user)
notification_preferences.update(request.preferences)
user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] = notification_preferences.json()
user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] = notification_preferences.json() # type:ignore[index]
with transaction(self.sa_session):
self.sa_session.commit()
return notification_preferences
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ def __module_from_dict(
temp_input_connections: Dict[str, Union[List[DictConnection], DictConnection]] = step_dict.get(
"input_connections", {}
)
step.temp_input_connections = temp_input_connections
step.temp_input_connections = temp_input_connections # type: ignore[assignment]

# Create the model class for the step
steps.append(step)
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/workflow/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ def get_inputs(self):

def restrict_options(self, step, connections: Iterable[WorkflowStepConnection], default_value):
try:
static_options = []
static_options = [] # type:ignore[var-annotated]
# Retrieve possible runtime options for 'select' type inputs
for connection in connections:
# Well this isn't a great assumption...
Expand Down Expand Up @@ -2511,13 +2511,13 @@ def inject(self, step: WorkflowStep, step_args=None, steps=None, **kwargs):
If step_args is provided from a web form this is applied to generate
'state' else it is just obtained from the database.
"""
step.upgrade_messages = {}
step.upgrade_messages = {} # type: ignore[assignment]

# Make connection information available on each step by input name.
step.setup_input_connections_by_name()

# Populate module.
module = step.module = module_factory.from_workflow_step(self.trans, step, **kwargs)
module = step.module = module_factory.from_workflow_step(self.trans, step, **kwargs) # type: ignore[assignment]

# Any connected input needs to have value DummyDataset (these
# are not persisted so we need to do it every time)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/app/tools/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestMetadata(TestCase, tools_support.UsesTools):
def setUp(self):
super().setUp()
self.setup_app()
model.Dataset.object_store = self.app.object_store
model.Dataset.object_store = self.app.object_store # type: ignore[assignment]
job = model.Job()
sa_session = self.app.model.session
sa_session.add(job)
Expand Down

0 comments on commit 710ffca

Please sign in to comment.