ua-generator
ua-generator copied to clipboard
Add Mypy Support and Improve Type Hinting
This PR introduces static type checking support using Mypy and enhances the overall type hinting throughout the ua-generator library.
Key Changes:
- Added py.typed marker file: Includes the
py.typedfile in the src/ua_generator directory to signal PEP 561 compliance, allowing Mypy to recognize the package for type checking. - Introduced Mypy Test: Added a new test file
test_typing.pyspecifically for verifying type hints with Mypy. This includes instructions on how to run the check. - Enhanced Type Annotations:
- Added type hints to function signatures, return types, and variables across various modules, including
utils.py,client_hints.py,options.py, and data modules withindata. - Utilized types from the typing module like List , Dict , Union , Literal , and Any for better code clarity and correctness.
- Improved type definitions within the
Versionclass and its subclasses (ChromiumVersion,AndroidVersion,WindowsVersion).
- Added type hints to function signatures, return types, and variables across various modules, including
These changes improve code maintainability, reduce potential runtime errors, and make the library easier to use correctly by providing clearer type information.