Skip to content

Commit

Permalink
Fix package mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Feb 13, 2024
1 parent ca383a8 commit 55378aa
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/model/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ def export_history(
# Write collections' attributes (including datasets list) to file.
stmt_hdca = (
select(model.HistoryDatasetCollectionAssociation)
.where(model.HistoryDatasetCollectionAssociation.history == history)
.where(model.HistoryDatasetCollectionAssociation.history == history) # type:ignore[arg-type]
.where(model.HistoryDatasetCollectionAssociation.deleted == expression.false())
)
collections = sa_session.scalars(stmt_hdca)
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/tool_util/toolbox/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
PollingObserver = None
Observer = None # type:ignore[assignment, misc]
FileSystemEventHandler = object # type:ignore[assignment, misc]
PollingObserver = None # type:ignore[assignment, misc]
can_watch = False

from galaxy.util.hash_util import md5_hash_file
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tools/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def __init__(
if isinstance(dataset_instance, HasTags):
self.groups = {
tag.user_value.lower()
for tag in dataset_instance.tags # type:ignore[attr-defined]
for tag in dataset_instance.tags # type:ignore[unused-ignore, attr-defined]
if tag.user_tname == "group"
}
else:
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/util/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
PollingObserver = None
Observer = None # type:ignore[assignment]
FileSystemEventHandler = object # type:ignore[assignment, misc]
PollingObserver = None # type:ignore[assignment, misc]
can_watch = False

from galaxy.util.hash_util import md5_hash_file
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy_test/selenium/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def setup_shared_state(self):
NavigatesGalaxyMixin = object


class UsesLibraryAssertions(NavigatesGalaxyMixin):
class UsesLibraryAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
@retry_assertion_during_transitions
def assert_num_displayed_items_is(self, n):
num_displayed = self.num_displayed_items()
Expand All @@ -546,7 +546,7 @@ def num_displayed_items(self) -> int:
return len(self.libraries_table_elements())


class UsesHistoryItemAssertions(NavigatesGalaxyMixin):
class UsesHistoryItemAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
def assert_item_peek_includes(self, hid, expected):
item_body = self.history_panel_item_component(hid=hid)
peek_text = item_body.peek.wait_for_text()
Expand Down Expand Up @@ -584,7 +584,7 @@ def assert_item_hid_text(self, hid):
)


class UsesWorkflowAssertions(NavigatesGalaxyMixin):
class UsesWorkflowAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
@retry_assertion_during_transitions
def _assert_showing_n_workflows(self, n):
if (actual_count := len(self.workflow_index_table_elements())) != n:
Expand Down
6 changes: 3 additions & 3 deletions lib/tool_shed/test/base/playwrightbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _fill_form_value(self, form: Locator, control_name: str, value: FormValueTyp
input_s = form.locator(f"select[name='{control_name}']")
if input_i.count():
if control_name in ["redirect"]:
input_i.input_value = value
input_i.input_value = value # type:ignore[method-assign, assignment]
else:
if isinstance(value, bool):
if value and not input_i.is_checked():
Expand All @@ -142,9 +142,9 @@ def _fill_form_value(self, form: Locator, control_name: str, value: FormValueTyp
else:
input_i.fill(value)
if input_t.count():
input_t.fill(value)
input_t.fill(value) # type:ignore[arg-type]
if input_s.count():
input_s.select_option(value)
input_s.select_option(value) # type:ignore[arg-type]

def edit_repository_categories(self, categories_to_add: List[str], categories_to_remove: List[str]) -> None:
multi_select = "form[name='categories'] select[name='category_id']"
Expand Down
4 changes: 2 additions & 2 deletions lib/tool_shed/test/base/twillbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
)

import twill.commands as tc
from twill.browser import FormElement
from twill.browser import FormElement # type:ignore[attr-defined]

from galaxy.util import smart_str
from .browser import (
Expand All @@ -19,7 +19,7 @@


def visit_url(url: str, allowed_codes: List[int]) -> str:
new_url = tc.go(url)
new_url = tc.go(url) # type:ignore[func-returns-value]
return_code = tc.browser.code
assert return_code in allowed_codes, "Invalid HTTP return code {}, allowed codes: {}".format(
return_code,
Expand Down
5 changes: 4 additions & 1 deletion test/unit/app/managers/test_HistoryManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def test_base(self):

self.log("should be able to order")
history3 = self.history_manager.create(name="history3", user=user2)
name_first_then_time = (model.History.name, sqlalchemy.desc(model.History.create_time))
name_first_then_time = (
model.History.name,
sqlalchemy.desc(model.History.create_time),
) # type:ignore[var-annotated]
assert self.history_manager.list(order_by=name_first_then_time) == [history2, history1, history3]

def test_copy(self):
Expand Down

0 comments on commit 55378aa

Please sign in to comment.