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
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
Problem
While some files have type hints (e.g.,
user.py,DataGenerator.py), many functions lack complete type annotations.Impact
Tasks
infra/logging_config.pySQl_answer.pyinfra/AnswerValidator.pyinfra/DataGenerator.pymypy infra/ --strictType Hint Guidelines
typing.Optional[T]for nullable typestyping.Union[T1, T2]for multiple allowed typestyping.List[T],typing.Dict[K, V]for collectionstyping.Anysparingly, only when truly necessary-> Nonefor functions without return valueReferences