Home / Function/ assert_signatures_in_sync() — anthropic-sdk-python Function Reference

assert_signatures_in_sync() — anthropic-sdk-python Function Reference

Architecture documentation for the assert_signatures_in_sync() function in _reflection.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  a2d69b37_5b6c_5f10_4f4d_529ef0309e88["assert_signatures_in_sync()"]
  5f498a17_95ee_cd14_01ce_dab1a2bfac8d["_reflection.py"]
  a2d69b37_5b6c_5f10_4f4d_529ef0309e88 -->|defined in| 5f498a17_95ee_cd14_01ce_dab1a2bfac8d
  style a2d69b37_5b6c_5f10_4f4d_529ef0309e88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_reflection.py lines 13–42

def assert_signatures_in_sync(
    source_func: Callable[..., Any],
    check_func: Callable[..., Any],
    *,
    exclude_params: set[str] = set(),
) -> None:
    """Ensure that the signature of the second function matches the first."""

    check_sig = inspect.signature(check_func)
    source_sig = inspect.signature(source_func)

    errors: list[str] = []

    for name, source_param in source_sig.parameters.items():
        if name in exclude_params:
            continue

        custom_param = check_sig.parameters.get(name)
        if not custom_param:
            errors.append(f"the `{name}` param is missing")
            continue

        if custom_param.annotation != source_param.annotation:
            errors.append(
                f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}"
            )
            continue

    if errors:
        raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors))

Subdomains

Frequently Asked Questions

What does assert_signatures_in_sync() do?
assert_signatures_in_sync() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_reflection.py.
Where is assert_signatures_in_sync() defined?
assert_signatures_in_sync() is defined in src/anthropic/_utils/_reflection.py at line 13.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free