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

format_code_block() — anthropic-sdk-python Function Reference

Architecture documentation for the format_code_block() function in ruffen-docs.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  62c685ea_e05a_24b8_aec4_0a1e17749e4f["format_code_block()"]
  3965d879_b0ae_9368_c20d_7ddc509b318b["ruffen-docs.py"]
  62c685ea_e05a_24b8_aec4_0a1e17749e4f -->|defined in| 3965d879_b0ae_9368_c20d_7ddc509b318b
  1ef0ada9_3a11_ea8f_5e8f_176327d79666["format_str()"]
  1ef0ada9_3a11_ea8f_5e8f_176327d79666 -->|calls| 62c685ea_e05a_24b8_aec4_0a1e17749e4f
  style 62c685ea_e05a_24b8_aec4_0a1e17749e4f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/utils/ruffen-docs.py lines 107–119

def format_code_block(code: str) -> str:
    return subprocess.check_output(
        [
            sys.executable,
            "-m",
            "ruff",
            "format",
            "--stdin-filename=script.py",
            f"--line-length={DEFAULT_LINE_LENGTH}",
        ],
        encoding="utf-8",
        input=code,
    )

Subdomains

Called By

Frequently Asked Questions

What does format_code_block() do?
format_code_block() is a function in the anthropic-sdk-python codebase, defined in scripts/utils/ruffen-docs.py.
Where is format_code_block() defined?
format_code_block() is defined in scripts/utils/ruffen-docs.py at line 107.
What calls format_code_block()?
format_code_block() is called by 1 function(s): format_str.

Analyze Your Own Codebase

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

Try Supermodel Free