psf / requests

A simple, yet elegant, HTTP library.
https://requests.readthedocs.io/en/latest/
Apache License 2.0
52.19k stars 9.33k forks source link

chore(models): add type hints to improve type safety #6769

Closed deyjoy closed 4 months ago

deyjoy commented 4 months ago

Summary

This pull request adds type hints to the models.py file in the requests library. The goal is to improve code readability and maintainability by specifying the expected types for function arguments and return values.

Changes

Checklist

Testing

All existing tests were run to ensure that adding type hints did not introduce any breaking changes. The test results are as follows:

Warnings

The following warnings were noted during testing:

These warnings do not impact the functionality of this PR but should be addressed in future updates.

nateprewitt commented 4 months ago

Thanks for the PR, @deyjoy. Typing for Requests is already available in typeshed as stubs. We likely won't be adding inline typing to Requests in the near future.

deyjoy commented 4 months ago

Thank you for the update, @nateprewitt. I understand that inline typing won't be added as typings are already available in typeshed stubs. I appreciate the feedback and the chance to contribute. I will look for other areas where I can assist. If there are any specific needs or suggestions, please let me know. Thanks again for the opportunity!