Skip to content

Commit

Permalink
cast instead of type ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-held committed Oct 7, 2021
1 parent 25801f9 commit bb01f0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cabinetry/templates/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
import pathlib
from typing import Any, Dict, Optional
from typing import Any, cast, Dict, Optional

from cabinetry import histo
from cabinetry import route
Expand Down Expand Up @@ -60,9 +60,9 @@ def _histo_path(
systematic, template, "VariationPath"
)
if variation_override is not None:
# skip mypy for next line: _check_for_override should return Optional[str]
# for VariationPath, and not a list, but mypy cannot know this
variation_path = variation_override # type: ignore
# _check_for_override should return Optional[str] for VariationPath, but
# mypy cannot know that it will not be a list, so explicitly cast to str
variation_path = cast(str, variation_override)
else:
log.warning(
f"no VariationPath override specified for {region['Name']} / "
Expand Down

0 comments on commit bb01f0c

Please # to comment.