Skip to content

Add AbstractURL type #127

Open
Open
@mahmoud

Description

@mahmoud

Per @wsanchez and @twm in #126, consensus seems to be that hyperlink would benefit from an interface/ABC which could be for both DecodedURL and URL/EncodedURL.

AbstractURL is the current name frontrunner, as URL is already taken for legacy reasons.

To quote @twm:

These methods seem to be equivalent between URL and DecodedURL in the sense that they do semantically identical things:

to_text()
to_uri()
to_iri()
normalize()
absolute
scheme
port
rooted

__bytes__ should probably be on this list (per #55). DecodedURL appears to lack it.

I'd also suggest that URL's get_decoded_url() method and DecodedURL's encoded_url property should be part of any common interface. This would be useful in treq to avoid a chain of isinstance() checks.

click() is also similar between the two, though only the DecodedURL version accepts a DecodedURL.

Further discussion to follow, no doubt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions