Skip to content

Add complete type hints to all public methods and functions #29

@moshesham

Description

@moshesham

Problem

While some files have type hints (e.g., user.py, DataGenerator.py), many functions lack complete type annotations.

Impact

  • Reduced code readability
  • Harder to catch type-related bugs
  • Poor IDE autocomplete support
  • Not following modern Python best practices (PEP 484)

Tasks

  • Add type hints to infra/logging_config.py
  • Add type hints to SQl_answer.py
  • Review and complete type hints in infra/AnswerValidator.py
  • Review and complete type hints in infra/DataGenerator.py
  • Add type hints to all test files
  • Run mypy to validate type hints: mypy infra/ --strict
  • Update any dynamically typed sections with proper annotations
  • Document type hint conventions in CONTRIBUTING.md

Type Hint Guidelines

  • Use typing.Optional[T] for nullable types
  • Use typing.Union[T1, T2] for multiple allowed types
  • Use typing.List[T], typing.Dict[K, V] for collections
  • Use typing.Any sparingly, only when truly necessary
  • Add return type annotations to all functions
  • Use -> None for functions without return value

References

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions