Enable stricter type checking of galaxy.model.tags.

This commit is contained in:
John Chilton
2021-10-27 13:34:31 -04:00
parent ba9d51ccff
commit 74a6d15913
3 changed files with 4 additions and 5 deletions
+1
View File
@@ -8116,6 +8116,7 @@ class ItemTagAssociation(Dictifiable):
dict_collection_visible_keys = ['id', 'user_tname', 'user_value']
dict_element_visible_keys = dict_collection_visible_keys
associated_item_names: List[str] = []
user_tname: Column
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
+3 -3
View File
@@ -1,6 +1,6 @@
import logging
import re
from typing import Dict
from typing import Dict, List, Optional
from sqlalchemy.orm.scoping import scoped_session
from sqlalchemy.sql import select
@@ -341,13 +341,13 @@ class TagHandler:
scrubbed_tag_list.append(self._scrub_tag_name(tag))
return scrubbed_tag_list
def _get_name_value_pair(self, tag_str):
def _get_name_value_pair(self, tag_str) -> List[Optional[str]]:
"""Get name, value pair from a tag string."""
# Use regular expression to parse name, value.
if tag_str.startswith('#'):
tag_str = f"name:{tag_str[1:]}"
reg_exp = re.compile(f"[{self.key_value_separators}]")
name_value_pair = reg_exp.split(tag_str, 1)
name_value_pair: List[Optional[str]] = list(reg_exp.split(tag_str, 1))
# Add empty slot if tag does not have value.
if len(name_value_pair) < 2:
name_value_pair.append(None)
-2
View File
@@ -361,8 +361,6 @@ check_untyped_defs = False
check_untyped_defs = False
[mypy-galaxy.model.tool_shed_install]
check_untyped_defs = False
[mypy-galaxy.model.tags]
check_untyped_defs = False
[mypy-galaxy.model.metadata]
check_untyped_defs = False
[mypy-galaxy.model]