What problem does it solve?
Refactor Python code to improve readability, maintainability, and correctness by enforcing Single Responsibility, Pythonic idioms, explicit type hints, robust error handling, consistent naming, and test-friendly structure. It guides developers to perform deliberate, staged refactors rather than ad-hoc rewrites.
Core Features & Use Cases
- SRP-first: Break large modules into focused functions and classes with clear responsibilities.
- Type hints & idioms: Introduce modern Python typings, idiomatic constructs, and safer patterns.
- Testing-friendly: Preserve behavior while improving testability; provide rationale for changes.
- Use Case: You have a legacy module with tangled logic; refactor into smaller, well-named components with explicit interfaces ready for unit tests.
Quick Start
Refactor the provided Python function to follow SRP and typing guidelines, producing a clean, well-structured version suitable for testing.