Skip to content

Commit

Permalink
Make Python 3.12 linter happy
Browse files Browse the repository at this point in the history
Signed-off-by: Harry Mellor <[email protected]>
  • Loading branch information
hmellor committed Jan 6, 2025
1 parent 4539b13 commit 6f18c4a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/source/generate_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def determine_category(self) -> str:
str: The category of the document.
""" # noqa: E501
title = self.title.lower()
with open(self.main_file, "r") as f:
with open(self.main_file) as f:
content = f.read().lower()
final_category = "Other"
for category, category_info in CATEGORIES.items():
Expand All @@ -189,7 +189,8 @@ def determine_category(self) -> str:

def generate(self) -> str:
# Convert the path to a relative path from __file__
make_relative = lambda path: ROOT_DIR_RELATIVE / path.relative_to(ROOT_DIR)
make_relative = lambda path: ROOT_DIR_RELATIVE / path.relative_to(
ROOT_DIR)

content = f"Source <{self.url}>.\n\n"
if self.main_file.suffix == ".py":
Expand Down Expand Up @@ -218,10 +219,12 @@ def generate_examples():
EXAMPLE_DOC_DIR.mkdir(parents=True)

# Generate examples_index and examples_{category}_index files
examples_index = Index(title="Examples",
description="A collection of examples demonstrating usage of vLLM.\n\nAll documented examples are autogenerated from examples found in [vllm/examples](https://github.com/vllm-project/vllm/tree/main/examples).",
maxdepth=2,
caption="Categories")
examples_index = Index(
title="Examples",
description=
"A collection of examples demonstrating usage of vLLM.\n\nAll documented examples are autogenerated from examples found in [vllm/examples](https://github.com/vllm-project/vllm/tree/main/examples).", # noqa: E501
maxdepth=2,
caption="Categories")
category_indices = {
category: Index(title=category,
description=category_info["description"])
Expand Down

0 comments on commit 6f18c4a

Please sign in to comment.