generate_docs_src_versions_for_file() — fastapi Function Reference
Architecture documentation for the generate_docs_src_versions_for_file() function in docs.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 60ad8e04_4e5f_5afa_9cb5_c074d1ab6d61["generate_docs_src_versions_for_file()"] 089911a1_02c3_0f6b_d62d_71c980ade67e["docs.py"] 60ad8e04_4e5f_5afa_9cb5_c074d1ab6d61 -->|defined in| 089911a1_02c3_0f6b_d62d_71c980ade67e style 60ad8e04_4e5f_5afa_9cb5_c074d1ab6d61 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/docs.py lines 413–445
def generate_docs_src_versions_for_file(file_path: Path) -> None:
target_versions = ["py39", "py310"]
base_content = file_path.read_text(encoding="utf-8")
previous_content = {base_content}
for target_version in target_versions:
version_result = subprocess.run(
[
find_ruff_bin(),
"check",
"--target-version",
target_version,
"--fix",
"--unsafe-fixes",
"-",
],
input=base_content.encode("utf-8"),
capture_output=True,
)
content_target = version_result.stdout.decode("utf-8")
format_result = subprocess.run(
[find_ruff_bin(), "format", "-"],
input=content_target.encode("utf-8"),
capture_output=True,
)
content_format = format_result.stdout.decode("utf-8")
if content_format in previous_content:
continue
previous_content.add(content_format)
version_file = file_path.with_name(
file_path.name.replace(".py", f"_{target_version}.py")
)
logging.info(f"Writing to {version_file}")
version_file.write_text(content_format, encoding="utf-8")
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does generate_docs_src_versions_for_file() do?
generate_docs_src_versions_for_file() is a function in the fastapi codebase, defined in scripts/docs.py.
Where is generate_docs_src_versions_for_file() defined?
generate_docs_src_versions_for_file() is defined in scripts/docs.py at line 413.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free