Add Type Hints to Core Functions
Description
Add comprehensive type hints to all functions in gnews.py using Python 3.8+ syntax. This will improve code readability, enable better IDE support, and help catch type-related bugs early.
Why?
Type hints provide better developer experience, enable static type checking with tools like mypy, and make the codebase more maintainable. This is a foundational improvement that will benefit all future development.
How?
- Add type hints to all function parameters and return types
- Use
typingmodule for complex types likeList[Dict[str, str]] - Add type hints to class attributes and methods
- Ensure compatibility with Python 3.8+
Files to Modify
gnews/gnews.py
Acceptance Criteria
- [ ] All functions have proper type hints
- [ ] Type hints follow Python 3.8+ syntax
- [ ] No breaking changes to existing API
- [ ] Code passes mypy type checking
- [ ] Documentation updated if needed
Example
def get_news(self, keyword: str) -> List[Dict[str, str]]:
"""Get news articles for a given keyword."""
# implementation
Resources
Difficulty: Easy
Time Estimate: 1-2 hours
I would like to work on this, please assign to me.
assign this task to me
Hi @ranahaani,I went through the code structure and understood the code and what changes to make. Please assign this issue to me.