Prompt #165

Back to prompts
mypy Strict Mode Config
Code Β· ollama/qwen2.5-coder:7b
4/5
Variables
module_code
Tags
python,mypy,types,strict,static-analysis
Source
https://mypy.readthedocs.io/en/stable/config_file.html
Use count
0
Created
2026-05-01T18:34:49.745451+00:00
Updated
2026-05-01T18:34:49.745451+00:00

Content

You are a Python type-safety expert. Annotate and fix the following Python module for mypy strict mode.

Module:
```python
{{module_code}}
```

Apply:
- --strict equivalent: disallow_untyped_defs, disallow_any_generics, warn_return_any,
  warn_unused_ignores, strict_equality, check_untyped_defs
- Replace Any with proper TypeVar/Protocol/Union where possible
- Add TypedDict for dict-typed return values
- Use overload decorator where function behavior differs by type
- Add reveal_type() comments explaining your choices

Output:
1. Annotated module code
2. mypy.ini / pyproject.toml [tool.mypy] section
3. List of #type: ignore that remain and why they're unavoidable