|
|
@ -30,13 +30,18 @@ _DOCS_DIR = _CURRENT_PATH / "docs"
|
|
|
|
def find_files(path):
|
|
|
|
def find_files(path):
|
|
|
|
"""Find all MDX files in the given path"""
|
|
|
|
"""Find all MDX files in the given path"""
|
|
|
|
# Check if is file first
|
|
|
|
# Check if is file first
|
|
|
|
|
|
|
|
if ".ipynb_checkpoints" in str(path):
|
|
|
|
|
|
|
|
return
|
|
|
|
if os.path.isfile(path):
|
|
|
|
if os.path.isfile(path):
|
|
|
|
yield path
|
|
|
|
yield path
|
|
|
|
return
|
|
|
|
return
|
|
|
|
for root, _, files in os.walk(path):
|
|
|
|
for root, _, files in os.walk(path):
|
|
|
|
for file in files:
|
|
|
|
for file in files:
|
|
|
|
if file.endswith(".mdx") or file.endswith(".md"):
|
|
|
|
if file.endswith(".mdx") or file.endswith(".md"):
|
|
|
|
yield os.path.join(root, file)
|
|
|
|
full = os.path.join(root, file)
|
|
|
|
|
|
|
|
if ".ipynb_checkpoints" in str(full):
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
yield full
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_full_module_name(module_path, class_name):
|
|
|
|
def get_full_module_name(module_path, class_name):
|
|
|
@ -79,7 +84,7 @@ def main():
|
|
|
|
.replace(".md", "/")
|
|
|
|
.replace(".md", "/")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
doc_url = f"https://python.langchain.com/docs/{relative_path}"
|
|
|
|
doc_url = f"https://python.langchain.com/v0.2/docs/{relative_path}"
|
|
|
|
for import_info in file_imports:
|
|
|
|
for import_info in file_imports:
|
|
|
|
doc_title = import_info["title"]
|
|
|
|
doc_title = import_info["title"]
|
|
|
|
class_name = import_info["imported"]
|
|
|
|
class_name = import_info["imported"]
|
|
|
@ -97,7 +102,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
def _get_doc_title(data: str, file_name: str) -> str:
|
|
|
|
def _get_doc_title(data: str, file_name: str) -> str:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return re.findall(r"^#\s+(.*)", data, re.MULTILINE)[0]
|
|
|
|
return re.findall(r"^#\s*(.*)", data, re.MULTILINE)[0]
|
|
|
|
except IndexError:
|
|
|
|
except IndexError:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
# Parse the rst-style titles
|
|
|
|
# Parse the rst-style titles
|
|
|
|