Skip to content

Commit 6125459

Browse files
committed
Fix mypy configuration for optional dependencies
1 parent 47a8d46 commit 6125459

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ repos:
2525
additional_dependencies:
2626
- pydantic>=2.5.0
2727
- types-click
28-
args: [--ignore-missing-imports]
28+
args: [--ignore-missing-imports, --no-warn-unused-ignores]
2929
files: ^src/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ lint:
2929
uv run ruff check .
3030

3131
type:
32-
uv run mypy src --ignore-missing-imports
32+
uv run mypy src
3333

3434
format:
3535
uv run ruff format .

src/sitescanner/scanners/nmap_metasploit_fuzzy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
try:
1616
from rapidfuzz import fuzz
17-
except ImportError: # pragma: no cover - optional dependency
18-
fuzz = None
17+
except Exception: # pragma: no cover - optional dependency
18+
fuzz = None # type: ignore[assignment]
1919

2020
if TYPE_CHECKING:
2121
from collections.abc import Iterable
@@ -31,7 +31,7 @@ def _similarity(a: str, b: str) -> float:
3131
# use token_set_ratio which handles tokenization and ordering well
3232
return float(fuzz.token_set_ratio(a, b))
3333
# fallback to difflib ratio scaled to 0-100
34-
return SequenceMatcher(None, a, b).ratio() * 100.0
34+
return SequenceMatcher(None, a, b).ratio() * 100.0 # type: ignore[unreachable]
3535

3636

3737
def load_rules(path: Path | None = None) -> list[dict]:

0 commit comments

Comments
 (0)