tessl install tessl/pypi-furl@2.1.0URL manipulation made simple.
Agent Success
Agent success rate when using this tile
65%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.59x
Baseline
Agent success rate without this tile
41%
A small utility module for composing and inspecting URLs using robust URL and path helpers.
https://example.com/api/v1/ and relative ../users?active=1, return https://example.com/users?active=1 after resolving the parent directory. @testhttps://example.com/app and relative ./health, return https://example.com/health while preserving scheme and host. @test/api with segments ["v2", "users", "42"] yields /api/v2/users/42. @test/ with segments ["blog", "", "posts", "..", "2024", "10"] produces /blog/posts/2024/10 after normalizing empty and parent segments. @test/api/v2/users/42/profile returns /api/v2/users. @testhttps://demo.local:3000/base/path?q=1#frag yields scheme https, hostname demo.local, port 3000, path /base/path, query q=1, fragment frag. @testhttp://example.com yields scheme http, hostname example.com, no port, empty path, empty query, and empty fragment. @test@generates
from typing import Dict, Iterable, Optional
def resolve_relative(base_url: str, relative_path: str) -> str:
"""Return an absolute URL string after applying the relative path to the base URL."""
def join_segments(base_path: str, segments: Iterable[str]) -> str:
"""Return a normalized path string starting from base_path with provided segments appended."""
def trim_segments(path: str, drop_count: int) -> str:
"""Return a path string with the specified number of trailing segments removed (never below root)."""
def split_components(url: str) -> Dict[str, Optional[str]]:
"""Return a mapping with keys: scheme, username, password, hostname, port, path, query, fragment."""Provides low-level URL joining, splitting, and path segment handling utilities.