Home / File/ check_imports.py — langchain Source File

check_imports.py — langchain Source File

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

File python CoreAbstractions MessageSchema 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  69b6e430_07f9_8302_d8af_b6afe873cfa9["check_imports.py"]
  d1277855_b602_121e_7de9_23a45b72f1fe["random"]
  69b6e430_07f9_8302_d8af_b6afe873cfa9 --> d1277855_b602_121e_7de9_23a45b72f1fe
  06ab3965_70ce_6e2c_feb9_564d849aa5f4["string"]
  69b6e430_07f9_8302_d8af_b6afe873cfa9 --> 06ab3965_70ce_6e2c_feb9_564d849aa5f4
  d76a28c2_c3ab_00a8_5208_77807a49449d["sys"]
  69b6e430_07f9_8302_d8af_b6afe873cfa9 --> d76a28c2_c3ab_00a8_5208_77807a49449d
  bfa79181_b1e6_eba2_0d8e_9ddb8d3b949c["traceback"]
  69b6e430_07f9_8302_d8af_b6afe873cfa9 --> bfa79181_b1e6_eba2_0d8e_9ddb8d3b949c
  2acfe0b8_5002_f60d_8c72_d2f95e51daeb["importlib.machinery"]
  69b6e430_07f9_8302_d8af_b6afe873cfa9 --> 2acfe0b8_5002_f60d_8c72_d2f95e51daeb
  style 69b6e430_07f9_8302_d8af_b6afe873cfa9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Check imports script.

Quickly verify that a list of Python files can be loaded by the Python interpreter
without raising any errors. Ran before running more expensive tests. Useful in
Makefiles.

If loading a file fails, the script prints the problematic filename and the detailed
error traceback.
"""

import random
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader

if __name__ == "__main__":
    files = sys.argv[1:]
    has_failure = False
    for file in files:
        try:
            module_name = "".join(
                random.choice(string.ascii_letters)  # noqa: S311
                for _ in range(20)
            )
            SourceFileLoader(module_name, file).load_module()
        except Exception:
            has_failure = True
            print(file)  # noqa: T201
            traceback.print_exc()
            print()  # noqa: T201

    sys.exit(1 if has_failure else 0)

Subdomains

Functions

Dependencies

  • importlib.machinery
  • random
  • string
  • sys
  • traceback

Frequently Asked Questions

What does check_imports.py do?
check_imports.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in check_imports.py?
check_imports.py defines 1 function(s): files.
What does check_imports.py depend on?
check_imports.py imports 5 module(s): importlib.machinery, random, string, sys, traceback.
Where is check_imports.py in the architecture?
check_imports.py is located at libs/langchain_v1/scripts/check_imports.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/langchain_v1/scripts).

Analyze Your Own Codebase

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

Try Supermodel Free