Skip to content

Commit

Permalink
address mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Oct 26, 2023
1 parent 47fe22d commit 8876692
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions therapy/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@ def _add_merged_meta(self, response: NormalizationService) -> NormalizationServi
"""
sources_meta = {}
therapeutic_agent = response.therapeutic_agent
sources = [response.normalized_id.split(":")[0]]
if therapeutic_agent.mappings:
sources += [m.coding.system for m in therapeutic_agent.mappings]
sources = [response.normalized_id.split(":")[0]] # type: ignore
if therapeutic_agent.mappings: # type: ignore
sources += [
m.coding.system for m in therapeutic_agent.mappings # type: ignore
]

for src in sources:
try:
Expand Down Expand Up @@ -476,11 +478,11 @@ def _add_therapeutic_agent(
)
]
else:
mappings = None
mappings = []
ind_disease_obj = core_models.Disease(
id=indication.disease_id,
label=indication.disease_label,
mappings=mappings
mappings=mappings or None
)

if indication.supplemental_info:
Expand Down
6 changes: 4 additions & 2 deletions therapy/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class ServiceMeta(BaseModel):
"""Metadata regarding the therapy-normalization service."""

name: Literal["thera-py"] = "thera-py"
version: Literal[__version__] = __version__
version: Literal[__version__] = __version__ # type: ignore
response_datetime: datetime
url: Literal[
"https://github.com/cancervariants/therapy-normalization"
Expand Down Expand Up @@ -395,7 +395,9 @@ class UnmergedNormalizationService(BaseNormalizationService):
attributes.
"""

normalized_concept_id: Optional[constr(pattern=r"^\w[^:]*:.+$")] = None # noqa: F722, E501
normalized_concept_id: Optional[ # type: ignore
constr(pattern=r"^\w[^:]*:.+$") # noqa: F722
] = None
source_matches: Dict[SourceName, MatchesNormalized]

model_config = ConfigDict(
Expand Down

0 comments on commit 8876692

Please sign in to comment.