INNER CODE UNIT · Python

join_key

Altinity/clickhouse-operator · tools/restore_shared_to_replicated.py:142

def join_key(*parts: str) -> str:
    return "/".join(p.strip("/") for p in parts if p and p.strip("/"))


def _sign(key: bytes, msg: str) -> bytes:
    return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest()


def _sigv4_key(secret: str, datestamp: str, region: str, service: str) -> bytes:
    k_date = _sign(("AWS4" + secret).encode("utf-8"), datestamp)
    k_region = hmac.new(k_date, region.encode("utf-8"), hashlib.sha256).digest()
    k_service = hmac.new(k_region, service.encode("utf-8"), hashlib.sha256).digest()
    return hmac.new(k_service, b"aws4_request", hashlib.sha256).digest()


def ensure_url_scheme(url: str) -> str:
    """urlparse('host:9000') treats 'host' as scheme and leaves netloc empty."""
    url = url.strip()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…