forked from psf/requests
-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring prepare method and mypy error #61
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ousret
reviewed
Jan 7, 2024
Thank you for opening this. |
…h and error handling, simplify URL host extraction, and handle None password cases
…ptimized hostname extraction, and updated exception handling
Ousret
reviewed
Jan 10, 2024
why pypy-3.7 don't passed ? |
It seems to fails non-deterministically. Nothing to do with this. |
Ok, PR is ok for you ? |
Mostly OK, I'll do a minor edit prior to merge as soon as I can. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactoring Suggestions
Separation of Responsibilities: The prepare method currently does two things: it creates a new PreparedRequest object and configures it. To improve clarity, these two responsibilities could be separated into two distinct methods.
Creation Method: You could have a separate method for creating the PreparedRequest object, which would make the code more modular and reusable.
Configuration Method: Another method could be dedicated to configuring this PreparedRequest object. This method would take a PreparedRequest object as a parameter and apply all the necessary configurations.
Error when launching mypy: src/niquests/utils.py:235: error: Incompatible return value type (got "tuple[str | None, str | None]", expected "tuple[str, str] | None") [return-value]
Suggested correction by modifying the get_netrc_auth function.