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%
Build a helper that adjusts multivalue query parameters on a URL while preserving order and returning the final values for a target key. Operations run in order: replacements overwrite listed keys, additions append new entries afterward, and an optional removal then drops a single matching occurrence.
@generates
from typing import Dict, List, Optional, Tuple
def apply_query_controls(
url: str,
additions: Dict[str, List[str]],
removal: Optional[Tuple[str, str]],
replacements: Dict[str, List[str]],
read_key: str,
) -> Tuple[str, List[str]]:
"""
Adjust multivalue query parameters on the given URL.
- `replacements` overwrites all existing values for listed keys with the provided lists, in the order given.
- Each list in `additions` then appends individual query entries after current values for that key, preserving overall ordering of other keys.
- `removal`, when provided, removes one matching value for the given key without disturbing other values for that key.
- Returns a tuple of the updated URL string and the ordered values for `read_key` after all operations.
"""Provides URL parsing and ordered multivalue query handling.