-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Subclass all single host url classes from AnyUrl to preserve behavior from v2.9
#10856
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
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
48d1503
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4662b687.pydantic-docs.pages.dev |
| Branch Preview URL: | https://any-url-base-type.pydantic-docs.pages.dev |
| @@ -475,10 +475,14 @@ class AnyUrl(_BaseUrl): | |||
| @property | |||
| def host(self) -> str: | |||
| """The required URL host.""" | |||
| return self._url.host # type: ignore | |||
| return self._url.host # pyright: ignore[reportReturnType] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @Viicos, using more explicit ignores :)
| @property | ||
| def host(self) -> str: | ||
| """The required URL host.""" | ||
| return self._url.host # type: ignore | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the added host specs that overrode the str | None return type from _BaseUrl, as AnyUrl enforces str
| @property | ||
| def host(self) -> str | None: # pyright: ignore[reportIncompatibleMethodOverride] | ||
| """The host part of the URL, or `None`.""" | ||
| return self._url.host | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to add this for the case where host_required=Fals because AnyUrl has host typed as str, so we indicate the optional nature here.
CodSpeed Performance ReportMerging #10856 will not alter performanceComparing Summary
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the surrounding discussion, this makes sense to me 👍
Addresses concerns from #10783 (comment)