GNews icon indicating copy to clipboard operation
GNews copied to clipboard

Add Type Hints to Core Functions

Open ranahaani opened this issue 2 months ago • 3 comments

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 typing module for complex types like List[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

ranahaani avatar Oct 21 '25 04:10 ranahaani

I would like to work on this, please assign to me.

esther-anierobi avatar Oct 22 '25 01:10 esther-anierobi

assign this task to me

Gowtham2801031902 avatar Oct 22 '25 18:10 Gowtham2801031902

Hi @ranahaani,I went through the code structure and understood the code and what changes to make. Please assign this issue to me.

Ananya44444 avatar Oct 22 '25 18:10 Ananya44444