Home / File/ translation_fixer.py — fastapi Source File

translation_fixer.py — fastapi Source File

Architecture documentation for translation_fixer.py, a python file in the fastapi codebase. 7 imports, 10 dependents.

File python FastAPI Routing 7 imports 10 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  99e3c039_dae8_2ebf_8149_637bcc119c08["translation_fixer.py"]
  af9b440f_13c4_d91e_f8ae_bfe199b060d2["os"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> af9b440f_13c4_d91e_f8ae_bfe199b060d2
  07d79a2e_d4e9_0bbb_be90_936274444c8c["collections.abc"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> 07d79a2e_d4e9_0bbb_be90_936274444c8c
  b3e303a2_3f2d_638d_930c_3a5dcc2f5a42["pathlib"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> b3e303a2_3f2d_638d_930c_3a5dcc2f5a42
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> 0dda2280_3359_8460_301c_e98c77e78185
  a73533d9_0a96_e8d9_5dcf_b4fd5359ebb5["typer"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> a73533d9_0a96_e8d9_5dcf_b4fd5359ebb5
  c463d6a9_085f_f272_b9fc_455b7e9b6a57["doc_parsing_utils.py"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> c463d6a9_085f_f272_b9fc_455b7e9b6a57
  63822d7d_03fc_4331_3f93_3026c9c03415["check_translation"]
  99e3c039_dae8_2ebf_8149_637bcc119c08 --> 63822d7d_03fc_4331_3f93_3026c9c03415
  a177ffbf_7528_97be_11ea_eed9815c64b3["test_code_blocks_lines_number_mismatch.py"]
  a177ffbf_7528_97be_11ea_eed9815c64b3 --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  388303cd_0b88_353a_b73e_39f18234feda["test_code_blocks_mermaid.py"]
  388303cd_0b88_353a_b73e_39f18234feda --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  08980139_ae67_3f76_2010_12cc1d0bb7b2["test_code_blocks_number_mismatch.py"]
  08980139_ae67_3f76_2010_12cc1d0bb7b2 --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  4382d5e1_6eca_318d_8c89_ecab455c564e["test_code_blocks_wrong_lang_code.py"]
  4382d5e1_6eca_318d_8c89_ecab455c564e --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  f38dc5dc_aa7f_23cc_5b5a_fb25ed3adeca["test_number_mismatch.py"]
  f38dc5dc_aa7f_23cc_5b5a_fb25ed3adeca --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  48906fa4_259b_4458_df4c_09c003b55355["test_compex_doc.py"]
  48906fa4_259b_4458_df4c_09c003b55355 --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  ea780e59_0602_ee14_b646_ddf831d7faec["test_header_level_mismatch.py"]
  ea780e59_0602_ee14_b646_ddf831d7faec --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  style 99e3c039_dae8_2ebf_8149_637bcc119c08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import os
from collections.abc import Iterable
from pathlib import Path
from typing import Annotated

import typer

from scripts.doc_parsing_utils import check_translation

non_translated_sections = (
    f"reference{os.sep}",
    "release-notes.md",
    "fastapi-people.md",
    "external-links.md",
    "newsletter.md",
    "management-tasks.md",
    "management.md",
    "contributing.md",
)


cli = typer.Typer()


@cli.callback()
def callback():
    pass


def iter_all_lang_paths(lang_path_root: Path) -> Iterable[Path]:
    """
    Iterate on the markdown files to translate in order of priority.
    """

    first_dirs = [
        lang_path_root / "learn",
        lang_path_root / "tutorial",
        lang_path_root / "advanced",
        lang_path_root / "about",
        lang_path_root / "how-to",
    ]
    first_parent = lang_path_root
    yield from first_parent.glob("*.md")
    for dir_path in first_dirs:
        yield from dir_path.rglob("*.md")
    first_dirs_str = tuple(str(d) for d in first_dirs)
    for path in lang_path_root.rglob("*.md"):
        if str(path).startswith(first_dirs_str):
            continue
        if path.parent == first_parent:
            continue
        yield path


def get_all_paths(lang: str):
    res: list[str] = []
    lang_docs_root = Path("docs") / lang / "docs"
    for path in iter_all_lang_paths(lang_docs_root):
        relpath = path.relative_to(lang_docs_root)
        if not str(relpath).startswith(non_translated_sections):
// ... (73 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does translation_fixer.py do?
translation_fixer.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in translation_fixer.py?
translation_fixer.py defines 7 function(s): callback, cli, fix_all, fix_pages, get_all_paths, iter_all_lang_paths, process_one_page.
What does translation_fixer.py depend on?
translation_fixer.py imports 7 module(s): check_translation, collections.abc, doc_parsing_utils.py, os, pathlib, typer, typing.
What files import translation_fixer.py?
translation_fixer.py is imported by 10 file(s): test_code_blocks_lines_number_mismatch.py, test_code_blocks_mermaid.py, test_code_blocks_number_mismatch.py, test_code_blocks_wrong_lang_code.py, test_compex_doc.py, test_header_level_mismatch.py, test_header_number_mismatch.py, test_html_links_number_mismatch.py, and 2 more.
Where is translation_fixer.py in the architecture?
translation_fixer.py is located at scripts/translation_fixer.py (domain: FastAPI, subdomain: Routing, directory: scripts).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free