mustache.py — langchain Source File
Architecture documentation for mustache.py, a python file in the langchain codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6["mustache.py"] e27da29f_a1f7_49f3_84d5_6be4cb4125c8["logging"] 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6 --> e27da29f_a1f7_49f3_84d5_6be4cb4125c8 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6 --> 2bf6d401_816d_d011_3b05_a6114f55ff58 8322cf04_5861_9d4a_4ee9_a22829f66390["types"] 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6 --> 8322cf04_5861_9d4a_4ee9_a22829f66390 feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6 --> feec1ec4_6917_867b_d228_b134d0ff8099 style 88ae0419_8f6b_8b31_dd8f_a3bc6bbcb7b6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Adapted from https://github.com/noahmorrison/chevron.
MIT License.
"""
from __future__ import annotations
import logging
from collections.abc import Iterator, Mapping, Sequence
from types import MappingProxyType
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
)
if TYPE_CHECKING:
from typing import TypeAlias
logger = logging.getLogger(__name__)
Scopes: TypeAlias = list[Literal[False, 0] | Mapping[str, Any]]
# Globals
_CURRENT_LINE = 1
_LAST_TAG_LINE = None
class ChevronError(SyntaxError):
"""Custom exception for Chevron errors."""
#
# Helper functions
#
def grab_literal(template: str, l_del: str) -> tuple[str, str]:
"""Parse a literal from the template.
Args:
template: The template to parse.
l_del: The left delimiter.
Returns:
The literal and the template.
"""
global _CURRENT_LINE
try:
# Look for the next tag and move the template to it
literal, template = template.split(l_del, 1)
_CURRENT_LINE += literal.count("\n")
# There are no more tags in the template?
except ValueError:
# Then the rest of the template is a literal
// ... (645 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- collections.abc
- logging
- types
- typing
Source
Frequently Asked Questions
What does mustache.py do?
mustache.py is a source file in the langchain codebase, written in python. It belongs to the Observability domain, TelemetryUtilities subdomain.
What functions are defined in mustache.py?
mustache.py defines 10 function(s): _get_key, _get_partial, _html_escape, grab_literal, l_sa_check, parse_tag, r_sa_check, render, tokenize, typing.
What does mustache.py depend on?
mustache.py imports 4 module(s): collections.abc, logging, types, typing.
Where is mustache.py in the architecture?
mustache.py is located at libs/core/langchain_core/utils/mustache.py (domain: Observability, subdomain: TelemetryUtilities, directory: libs/core/langchain_core/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free