mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
cdc8e2d0c2
Fixing warnings. Needs to be propagated to 0.1 branch if this works. ![Screenshot 2024-05-17 at 2 34 15 PM](https://github.com/langchain-ai/langchain/assets/9557659/e6ac95a9-5686-4747-9ab8-4cb49942dc8d)
22 lines
460 B
Python
22 lines
460 B
Python
import os
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
DOCS_DIR = Path(os.path.abspath(__file__)).parents[1]
|
|
|
|
|
|
def update_links(doc_path, docs_link):
|
|
with open(DOCS_DIR / doc_path, "r") as f:
|
|
content = f.read()
|
|
|
|
# replace relative links
|
|
content = re.sub(r"\]\(\.\/", f"]({docs_link}", content)
|
|
|
|
with open(DOCS_DIR / doc_path, "w") as f:
|
|
f.write(content)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
update_links(sys.argv[1], sys.argv[2])
|