Skip to content
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 6 commits into from
Jan 18, 2024
Merged

refactoring prepare method and mypy error #61

merged 6 commits into from
Jan 18, 2024

Conversation

fred1599
Copy link

@fred1599 fred1599 commented Jan 7, 2024

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.

@Ousret Ousret self-requested a review January 7, 2024 21:11
@Ousret
Copy link
Member

Ousret commented Jan 7, 2024

Thank you for opening this.
By my initial reading, I think that we can go further with this.

Fred added 3 commits January 8, 2024 13:08
…h and error handling, simplify URL host extraction, and handle None password cases
…ptimized hostname extraction, and updated exception handling
@fred1599
Copy link
Author

why pypy-3.7 don't passed ?

@Ousret
Copy link
Member

Ousret commented Jan 18, 2024

It seems to fails non-deterministically. Nothing to do with this.

@fred1599
Copy link
Author

It seems to fails non-deterministically. Nothing to do with this.

Ok, PR is ok for you ?

@Ousret
Copy link
Member

Ousret commented Jan 18, 2024

Mostly OK, I'll do a minor edit prior to merge as soon as I can.

@Ousret Ousret merged commit 5763718 into jawah:main Jan 18, 2024
30 of 31 checks passed
@fred1599 fred1599 deleted the refactoring_prepare_method branch January 19, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants