Home / Function/ _literal_eval_str() — langchain Function Reference

_literal_eval_str() — langchain Function Reference

Architecture documentation for the _literal_eval_str() function in test_imports.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fe343a33_7414_9ca3_120c_9230b711167f["_literal_eval_str()"]
  1a4ae21b_d553_aa88_bac6_fd6971a4e02d["test_imports.py"]
  fe343a33_7414_9ca3_120c_9230b711167f -->|defined in| 1a4ae21b_d553_aa88_bac6_fd6971a4e02d
  ed754162_a014_59bf_8b3f_a17462a35481["_dict_from_ast()"]
  ed754162_a014_59bf_8b3f_a17462a35481 -->|calls| fe343a33_7414_9ca3_120c_9230b711167f
  style fe343a33_7414_9ca3_120c_9230b711167f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/test_imports.py lines 153–165

def _literal_eval_str(node: ast.AST) -> str:
    """Evaluate an AST literal node to its corresponding string value.

    Args:
        node: The AST node representing a literal value.

    Returns:
        The corresponding string value.
    """
    if isinstance(node, ast.Constant) and isinstance(node.value, str):
        return node.value
    msg = f"Invalid DEPRECATED_LOOKUP format: expected str, got {type(node).__name__}"
    raise AssertionError(msg)

Domain

Subdomains

Called By

Frequently Asked Questions

What does _literal_eval_str() do?
_literal_eval_str() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/test_imports.py.
Where is _literal_eval_str() defined?
_literal_eval_str() is defined in libs/langchain/tests/unit_tests/test_imports.py at line 153.
What calls _literal_eval_str()?
_literal_eval_str() is called by 1 function(s): _dict_from_ast.

Analyze Your Own Codebase

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

Try Supermodel Free