mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-29 23:38:51 +00:00
Lint Python notebooks with ruff. (#12677)
The new ruff version fixed the blocking bugs, and I was able to fairly easily us to a passing state: ruff fixed some issues on its own, I fixed a handful by hand, and I added a list of narrowly-targeted exclusions for files that are currently failing ruff rules that we probably should look into eventually. I went pretty lenient on the docs / cookbooks rules, allowing dead code and such things. Perhaps in the future we may want to tighten the rules further, but this is already a good set of checks that found real issues and will prevent them going forward.
This commit is contained in:
@@ -10,7 +10,7 @@ DOCS_TEMPLATES_DIR = Path(os.path.abspath(__file__)).parents[1] / "docs" / "temp
|
||||
|
||||
|
||||
readmes = list(glob.glob(str(TEMPLATES_DIR) + "/*/README.md"))
|
||||
destinations = [readme[len(str(TEMPLATES_DIR)) + 1:-10] + ".md" for readme in readmes]
|
||||
destinations = [readme[len(str(TEMPLATES_DIR)) + 1 : -10] + ".md" for readme in readmes]
|
||||
for source, destination in zip(readmes, destinations):
|
||||
full_destination = DOCS_TEMPLATES_DIR / destination
|
||||
shutil.copyfile(source, full_destination)
|
||||
@@ -33,4 +33,3 @@ with open(TEMPLATES_INDEX_DESTINATION, "r") as f:
|
||||
content = re.sub("\]\(\.\.\/", "](/docs/templates/", content)
|
||||
with open(TEMPLATES_INDEX_DESTINATION, "w") as f:
|
||||
f.write(sidebar_hidden + content)
|
||||
|
||||
|
Reference in New Issue
Block a user