Home / Function/ strip_ansi() — langchain Function Reference

strip_ansi() — langchain Function Reference

Architecture documentation for the strip_ansi() function in test_file.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dbd1329b_a843_29c6_04d5_0d55023c8909["strip_ansi()"]
  208c1f71_5b87_0580_ea58_7fe3e9a67452["test_file.py"]
  dbd1329b_a843_29c6_04d5_0d55023c8909 -->|defined in| 208c1f71_5b87_0580_ea58_7fe3e9a67452
  100acb5f_bd9c_a651_cfbb_009e1e585010["test_filecallback()"]
  100acb5f_bd9c_a651_cfbb_009e1e585010 -->|calls| dbd1329b_a843_29c6_04d5_0d55023c8909
  style dbd1329b_a843_29c6_04d5_0d55023c8909 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/callbacks/test_file.py lines 37–44

def strip_ansi(text: str) -> str:
    """Removes ANSI escape sequences from a string.

    Args:
        text: The string potentially containing ANSI codes.
    """
    ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
    return ansi_escape.sub("", text)

Domain

Subdomains

Frequently Asked Questions

What does strip_ansi() do?
strip_ansi() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/callbacks/test_file.py.
Where is strip_ansi() defined?
strip_ansi() is defined in libs/langchain/tests/unit_tests/callbacks/test_file.py at line 37.
What calls strip_ansi()?
strip_ansi() is called by 1 function(s): test_filecallback.

Analyze Your Own Codebase

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

Try Supermodel Free