Skip to content

Commit

Permalink
skip api reference
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Mar 13, 2024
1 parent 36c5a1e commit b39718d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docs/website/check_embedded_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Snippet(TypedDict):

markdown_files = []
for path, directories, files in os.walk(DOCS_DIR):
if "api_reference" in path:
continue
for file in files:
if file.endswith(".md"):
markdown_files.append(os.path.join(path, file))
Expand Down Expand Up @@ -53,20 +55,23 @@ class Snippet(TypedDict):

# parse python snippets for now
count = 0
failed = 0
for snippet in snippets:
print("Processing snippet no", count, " at line", snippet["line"], "in file", snippet["file"])
if snippet["language"] in ["python", "py"]:
ast.parse(dedent(snippet["code"]))
count += 1
try:
ast.parse(dedent(snippet["code"]))
except Exception as e:
print(f"Failed to parse snippet: {e}")
failed += 1
if snippet["language"] in ["toml"]:
tomlkit.loads(snippet["code"])
...
# tomlkit.loads(snippet["code"])


count += 1

print(count)


print(f"Found {len(snippets)} snippets")

print(snippets[500]["code"])
print(failed)

0 comments on commit b39718d

Please sign in to comment.