mahout
mahout copied to clipboard
refactor: Add comprehensive type hints to backend modules
Overview
This PR adds comprehensive type annotations to all three backend modules, improving IDE support and enabling static type checking. closes #643
What's Changed
- Added type annotations to all functions in qumat/qiskit_backend.py
- Added type annotations to all functions in qumat/cirq_backend.py
- Added type annotations to all functions in qumat/amazon_braket_backend.py
- Added necessary imports (
typing.Any,numpy) - Used modern union syntax for flexible types (e.g.,
LocalSimulator | AwsDevice)
Why This Change
The backend modules lacked type hints, making it harder for developers to:
- Get proper IDE autocomplete and IntelliSense
- Catch type-related bugs during development
- Understand function signatures at a glance
This change improves developer experience without altering any functionality.
Benefits
- ✅ Better IDE autocomplete and IntelliSense support
- ✅ Enable static type checking with mypy
- ✅ Improved code documentation through types
- ✅ Easier to catch type-related bugs early
Testing
- ✅ All existing tests pass (no functionality changes)
- ✅ Type annotations are consistent across all backends
- ✅ No runtime behavior changes