← Files AgentBrokoARCHIVED FILE

.venv/Lib/site-packages/eth_abi/utils/string.py

436 Bytes · Oct 5, 2026 · 18:33 UTC

↓ Download file

from typing import (
    Any,
)


def abbr(value: Any, limit: int = 79) -> str:
    """
    Converts a value into its string representation and abbreviates that
    representation based on the given length `limit` if necessary.
    """
    rep = repr(value)

    if len(rep) > limit:
        if limit < 3:
            raise ValueError("Abbreviation limit may not be less than 3")

        rep = rep[: limit - 3] + "..."

    return rep

SHA-256: 7e3b004760bb5e5bb96c7a26c71e65e2b9400c5b41cb319341fba0313a3c4d09