mirror of
https://github.com/hwchase17/langchain.git
synced 2026-04-08 21:43:40 +00:00
x
This commit is contained in:
@@ -3,7 +3,8 @@ import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Iterable, Tuple
|
||||
from typing import Iterable, Tuple, List
|
||||
import tqdm
|
||||
|
||||
import nbformat
|
||||
from nbconvert.exporters import MarkdownExporter
|
||||
@@ -133,19 +134,24 @@ if __name__ == "__main__":
|
||||
output_docs_dir = Path(sys.argv[2])
|
||||
|
||||
source_paths_arg = os.environ.get("SOURCE_PATHS")
|
||||
source_paths: Iterable[Path]
|
||||
source_paths: List[Path]
|
||||
if source_paths_arg:
|
||||
source_path_strs = re.split(r"\s+", source_paths_arg)
|
||||
source_paths_stripped = [p.strip() for p in source_path_strs]
|
||||
source_paths = [intermediate_docs_dir / p for p in source_paths_stripped if p]
|
||||
else:
|
||||
source_paths = intermediate_docs_dir.glob("**/*.ipynb")
|
||||
source_paths = list(intermediate_docs_dir.glob("**/*.ipynb"))
|
||||
|
||||
with multiprocessing.Pool() as pool:
|
||||
pool.map(
|
||||
_process_path,
|
||||
(
|
||||
(notebook_path, intermediate_docs_dir, output_docs_dir)
|
||||
for notebook_path in source_paths
|
||||
),
|
||||
list(
|
||||
tqdm.tqdm(
|
||||
pool.imap(
|
||||
_process_path,
|
||||
(
|
||||
(notebook_path, intermediate_docs_dir, output_docs_dir)
|
||||
for notebook_path in source_paths
|
||||
),
|
||||
),
|
||||
total=len(source_paths),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user