Home / File/ any_str.py — langchain Source File

any_str.py — langchain Source File

Architecture documentation for any_str.py, a python file in the langchain codebase. 1 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ff1b0329_5d1f_9ace_5bc7_a70a4a9bb082["any_str.py"]
  67ec3255_645e_8b6e_1eff_1eb3c648ed95["re"]
  ff1b0329_5d1f_9ace_5bc7_a70a4a9bb082 --> 67ec3255_645e_8b6e_1eff_1eb3c648ed95
  style ff1b0329_5d1f_9ace_5bc7_a70a4a9bb082 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import re


class AnyStr(str):
    __slots__ = ("prefix",)

    def __init__(self, prefix: str | re.Pattern[str] = "") -> None:
        super().__init__()
        self.prefix = prefix

    def __eq__(self, other: object) -> bool:
        return isinstance(other, str) and (
            other.startswith(self.prefix)
            if isinstance(self.prefix, str)
            else self.prefix.match(other) is not None
        )

    def __hash__(self) -> int:
        return hash((str(self), self.prefix))

Subdomains

Classes

Dependencies

  • re

Frequently Asked Questions

What does any_str.py do?
any_str.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What does any_str.py depend on?
any_str.py imports 1 module(s): re.
Where is any_str.py in the architecture?
any_str.py is located at libs/langchain_v1/tests/unit_tests/agents/any_str.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain_v1/tests/unit_tests/agents).

Analyze Your Own Codebase

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

Try Supermodel Free