refactor: Improve host handling and add comprehensive documentation#22
Merged
refactor: Improve host handling and add comprehensive documentation#22
Conversation
This file contains hidden or 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
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.
Summary
Comprehensive refactoring of host-related functionality in Python APIs, adding documentation, fixing architectural issues, and updating tests. This fixes issue #19.
Motivation
The Python API is missing a way to use the parsed Host from a Url without reparsing it again (see #19).
Changes
Rust Library:
Url.hostfieldpuband document itPython Bindings:
Displaytrait implementation forHostenumClonederive forHostenum to fix PyO3 compatibilityHoststructHost::domain(),Host::subdomain,Host::suffix+ documentationFaupCompatmethods to use properHostmethod calls instead of direct field access:get_domain(): Now useshost.domain()get_subdomain(): Now useshost.subdomain()get_host(): Now returnsOption<String>with proper string conversionget_tld(): Now useshost.suffix_ref()Type System:
pyfaup.pyi) to reflect new method signaturesUrl.hosttype fromOptional[str]toOptional[Host]subdomain,domain,suffix) fromUrlclass in favor of method calls onUrl.hostobjectTests:
Hostmethod callsHost.domain(),Host.subdomain(), andHost.suffix()methodsNonehandlingBreaking Changes
Url.hostis nowOptional[Host]instead ofOptional[str]subdomain,domain,suffixonUrlno longer works - use method calls onHostinsteadFaupCompat.get_host()now returnsOption<String>instead ofOption<&str>(but this should be transparent for python usage)Testing