_expand_include_patterns() — langchain Function Reference
Architecture documentation for the _expand_include_patterns() function in file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fea81925_aad2_dbab_3ab4_96f18a5cb4c7["_expand_include_patterns()"] 2be37047_277b_5443_dc33_7aebad3faaa4["file_search.py"] fea81925_aad2_dbab_3ab4_96f18a5cb4c7 -->|defined in| 2be37047_277b_5443_dc33_7aebad3faaa4 60184a91_fab8_982f_769b_44d51b7e4b97["_is_valid_include_pattern()"] 60184a91_fab8_982f_769b_44d51b7e4b97 -->|calls| fea81925_aad2_dbab_3ab4_96f18a5cb4c7 54e626eb_8746_c714_57b6_ac728c78ed52["_match_include_pattern()"] 54e626eb_8746_c714_57b6_ac728c78ed52 -->|calls| fea81925_aad2_dbab_3ab4_96f18a5cb4c7 style fea81925_aad2_dbab_3ab4_96f18a5cb4c7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/langchain_anthropic/middleware/file_search.py lines 23–54
def _expand_include_patterns(pattern: str) -> list[str] | None:
"""Expand brace patterns like `*.{py,pyi}` into a list of globs."""
if "}" in pattern and "{" not in pattern:
return None
expanded: list[str] = []
def _expand(current: str) -> None:
start = current.find("{")
if start == -1:
expanded.append(current)
return
end = current.find("}", start)
if end == -1:
raise ValueError
prefix = current[:start]
suffix = current[end + 1 :]
inner = current[start + 1 : end]
if not inner:
raise ValueError
for option in inner.split(","):
_expand(prefix + option + suffix)
try:
_expand(pattern)
except ValueError:
return None
return expanded
Domain
Subdomains
Source
Frequently Asked Questions
What does _expand_include_patterns() do?
_expand_include_patterns() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/file_search.py.
Where is _expand_include_patterns() defined?
_expand_include_patterns() is defined in libs/partners/anthropic/langchain_anthropic/middleware/file_search.py at line 23.
What calls _expand_include_patterns()?
_expand_include_patterns() is called by 2 function(s): _is_valid_include_pattern, _match_include_pattern.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free