Home / Function/ l_sa_check() — langchain Function Reference

l_sa_check() — langchain Function Reference

Architecture documentation for the l_sa_check() function in mustache.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  abfb140d_b449_a24c_b081_77bcd120e90c["l_sa_check()"]
  88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6["mustache.py"]
  abfb140d_b449_a24c_b081_77bcd120e90c -->|defined in| 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6
  ee317545_08fa_c1b5_d4bc_6d8f5e1e4e7c["tokenize()"]
  ee317545_08fa_c1b5_d4bc_6d8f5e1e4e7c -->|calls| abfb140d_b449_a24c_b081_77bcd120e90c
  style abfb140d_b449_a24c_b081_77bcd120e90c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/utils/mustache.py lines 66–89

def l_sa_check(
    template: str,  # noqa: ARG001
    literal: str,
    is_standalone: bool,  # noqa: FBT001
) -> bool:
    """Do a preliminary check to see if a tag could be a standalone.

    Args:
        template: The template. (Not used.)
        literal: The literal.
        is_standalone: Whether the tag is standalone.

    Returns:
        Whether the tag could be a standalone.
    """
    # If there is a newline, or the previous tag was a standalone
    if literal.find("\n") != -1 or is_standalone:
        padding = literal.rsplit("\n", maxsplit=1)[-1]

        # If all the characters since the last newline are spaces
        # Then the next tag could be a standalone
        # Otherwise it can't be
        return padding.isspace() or not padding
    return False

Domain

Subdomains

Called By

Frequently Asked Questions

What does l_sa_check() do?
l_sa_check() is a function in the langchain codebase, defined in libs/core/langchain_core/utils/mustache.py.
Where is l_sa_check() defined?
l_sa_check() is defined in libs/core/langchain_core/utils/mustache.py at line 66.
What calls l_sa_check()?
l_sa_check() is called by 1 function(s): tokenize.

Analyze Your Own Codebase

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

Try Supermodel Free