scripts.docs_inventory¶
Static source inventory shared by the documentation build tools.
View the complete module source at #L1-L1182.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
scripts.docs_inventory
¶
Static source inventory shared by the documentation build tools.
The inventory uses Python's AST instead of importing :mod:vllm_mlx. This is
important because the documentation build runs on Linux while the runtime
package depends on Apple Silicon and MLX.
scripts.docs_inventory.REPOSITORY_URL
module-attribute
¶
scripts.docs_inventory.REPOSITORY_ROOT
module-attribute
¶
scripts.docs_inventory.Parameter
dataclass
¶
One explicit callable input reconstructed from the Python AST.
scripts.docs_inventory.Parameter.to_dict
¶
scripts.docs_inventory.Symbol
dataclass
¶
Symbol(name: str, qualname: str, full_name: str, kind: str, signature: str, parameters: tuple[Parameter, ...], return_annotation: str, docstring: str, summary: str, implementation: str, documented: bool, public: bool, addressable: bool, line: int, end_line: int, source_url: str, decorators: tuple[str, ...], calls: tuple[str, ...], state_reads: tuple[str, ...], state_writes: tuple[str, ...], raises: tuple[str, ...], return_expressions: tuple[str, ...], awaits: bool, yields: bool)
scripts.docs_inventory.Module
dataclass
¶
Module(name: str, path: str, page_path: str, docstring: str, summary: str, line_count: int, source_url: str, members: tuple[str, ...], symbols: tuple[Symbol, ...])
Documentation metadata for one tracked Python module.
scripts.docs_inventory.Module.to_dict
¶
Return a JSON-serializable representation of the module.
scripts.docs_inventory.CLIOption
dataclass
¶
CLIOption(context: str, receiver: str, flags: tuple[str, ...], destination: str, description: str, default: str, required: bool, choices: str, action: str, path: str, line: int, end_line: int, source_url: str)
One argparse option declaration found in executable source.
scripts.docs_inventory.CLIOption.to_dict
¶
scripts.docs_inventory._tracked_python_files
¶
Return tracked modules under selected roots, with a filesystem fallback.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.module_name_for_path
¶
module_name_for_path(path: Path, root: Path = REPOSITORY_ROOT) -> str
Convert a package source path into its importable dotted module name.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.page_path_for_module
¶
page_path_for_module(path: Path, root: Path = REPOSITORY_ROOT) -> Path
Return the generated documentation path for a package source file.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._first_sentence
¶
Return a compact first sentence or line from a docstring.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._parameter_descriptions
¶
Extract Google, NumPy, and Sphinx parameter descriptions.
Source code in scripts/docs_inventory.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
scripts.docs_inventory._function_parameters
¶
_function_parameters(node: FunctionDef | AsyncFunctionDef, docstring: str) -> tuple[Parameter, ...]
Return the callable inputs, annotations, defaults, and descriptions.
Source code in scripts/docs_inventory.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
scripts.docs_inventory._class_parameters
¶
_class_parameters(node: ClassDef, docstring: str) -> tuple[Parameter, ...]
Return constructor inputs from __init__ or declarative fields.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._owned_nodes
¶
Walk implementation nodes without attributing nested bodies to parents.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._ordered_unique
¶
Return non-empty strings once while preserving their source order.
scripts.docs_inventory._short_expression
¶
Render an AST expression without allowing one fact to dominate output.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._attribute_name
¶
Return tracked self or cls attribute access, if applicable.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._implementation_facts
¶
_implementation_facts(node: ClassDef | FunctionDef | AsyncFunctionDef, *, kind: str, qualname: str) -> dict[str, object]
Extract conservative behavioral facts from one definition's own body.
Source code in scripts/docs_inventory.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
scripts.docs_inventory._function_signature
¶
Render a stable function signature without importing its module.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._class_signature
¶
Render a class declaration and its bases from the AST.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._defined_member_names
¶
Return names defined directly by a module in source order.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.scan_python_file
¶
scan_python_file(path: Path, root: Path = REPOSITORY_ROOT) -> Module
Parse one Python file into module and symbol documentation metadata.
Source code in scripts/docs_inventory.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | |
scripts.docs_inventory.build_inventory
¶
build_inventory(root: Path = REPOSITORY_ROOT, source_roots: tuple[str, ...] = ('vllm_mlx',)) -> list[Module]
Build static source inventory for the selected repository roots.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.build_repository_inventory
¶
build_repository_inventory(root: Path = REPOSITORY_ROOT) -> list[Module]
Inventory runtime, documentation tools, and executable examples.
scripts.docs_inventory._literal_or_source
¶
Render a simple literal cleanly and preserve expressions as source.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.scan_cli_options
¶
scan_cli_options(paths: Iterable[Path], root: Path = REPOSITORY_ROOT) -> list[CLIOption]
Extract every argparse add_argument call from selected source files.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.build_cli_inventory
¶
build_cli_inventory(root: Path = REPOSITORY_ROOT) -> list[CLIOption]
Build the complete argparse option inventory for executable source.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._escape_table_cell
¶
scripts.docs_inventory.render_callable_signature
¶
render_callable_signature(symbol: Symbol, *, qualified: bool = False) -> str
Render a reader-facing signature without implicit self or cls.
Source code in scripts/docs_inventory.py
scripts.docs_inventory._symbol_details_url
¶
Return the generated details URL or source fallback for one symbol.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.render_contract_details
¶
render_contract_details(module: Module) -> str
Render explicit inputs and behavior for every definition in a module.
Source code in scripts/docs_inventory.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | |
scripts.docs_inventory.render_source_map
¶
render_source_map(module: Module) -> str
Render a line-precise source table for every definition in a module.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.render_symbol_index
¶
render_symbol_index(modules: list[Module]) -> str
Render a filterable index of every runtime class and callable.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.render_module_page
¶
render_module_page(module: Module) -> str
Render the generated MkDocs page for one Python module.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.render_module_for_llms
¶
render_module_for_llms(module: Module) -> str
Render a self-contained plain-Markdown API record for language models.
Source code in scripts/docs_inventory.py
scripts.docs_inventory.render_cli_reference
¶
render_cli_reference(options: list[CLIOption]) -> str
Render every discovered argparse option as a line-precise reference.
Source code in scripts/docs_inventory.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
scripts.docs_inventory.Parameter · class
scripts.docs_inventory.Parameter(name: str, kind: str, annotation: str, default: str, required: bool, description: str)
One explicit callable input reconstructed from the Python AST.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
str |
yes |
none |
Required constructor field. |
kind |
str |
yes |
none |
Required constructor field. |
annotation |
str |
yes |
none |
Required constructor field. |
default |
str |
yes |
none |
Required constructor field. |
required |
bool |
yes |
none |
Required constructor field. |
description |
str |
yes |
none |
Required constructor field. |
Returns
- Constructs:
scripts.docs_inventory.Parameter
Exceptions and behavior
Class Parameter declares 1 direct member(s).
No direct raise statement appears in this definition.
scripts.docs_inventory.Parameter.to_dict · method
Return a JSON-serializable representation of the parameter.
Parameters
This callable has no explicit inputs.
Returns
- Type:
dict[str, object] - Direct return expressions:
asdict(self)
Exceptions and behavior
Method Parameter.to_dict calls asdict; returns asdict(self).
No direct raise statement appears in this definition.
scripts.docs_inventory.Symbol · class
scripts.docs_inventory.Symbol(name: str, qualname: str, full_name: str, kind: str, signature: str, parameters: tuple[Parameter, ...], return_annotation: str, docstring: str, summary: str, implementation: str, documented: bool, public: bool, addressable: bool, line: int, end_line: int, source_url: str, decorators: tuple[str, ...], calls: tuple[str, ...], state_reads: tuple[str, ...], state_writes: tuple[str, ...], raises: tuple[str, ...], return_expressions: tuple[str, ...], awaits: bool, yields: bool)
A class, function, method, or nested definition found in source code.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
str |
yes |
none |
Required constructor field. |
qualname |
str |
yes |
none |
Required constructor field. |
full_name |
str |
yes |
none |
Required constructor field. |
kind |
str |
yes |
none |
Required constructor field. |
signature |
str |
yes |
none |
Required constructor field. |
parameters |
tuple[Parameter, ...] |
yes |
none |
Required constructor field. |
return_annotation |
str |
yes |
none |
Required constructor field. |
docstring |
str |
yes |
none |
Required constructor field. |
summary |
str |
yes |
none |
Required constructor field. |
implementation |
str |
yes |
none |
Required constructor field. |
documented |
bool |
yes |
none |
Required constructor field. |
public |
bool |
yes |
none |
Required constructor field. |
addressable |
bool |
yes |
none |
Required constructor field. |
line |
int |
yes |
none |
Required constructor field. |
end_line |
int |
yes |
none |
Required constructor field. |
source_url |
str |
yes |
none |
Required constructor field. |
decorators |
tuple[str, ...] |
yes |
none |
Required constructor field. |
calls |
tuple[str, ...] |
yes |
none |
Required constructor field. |
state_reads |
tuple[str, ...] |
yes |
none |
Required constructor field. |
state_writes |
tuple[str, ...] |
yes |
none |
Required constructor field. |
raises |
tuple[str, ...] |
yes |
none |
Required constructor field. |
return_expressions |
tuple[str, ...] |
yes |
none |
Required constructor field. |
awaits |
bool |
yes |
none |
Required constructor field. |
yields |
bool |
yes |
none |
Required constructor field. |
Returns
- Constructs:
scripts.docs_inventory.Symbol
Exceptions and behavior
Class Symbol declares 1 direct member(s).
No direct raise statement appears in this definition.
scripts.docs_inventory.Symbol.to_dict · method
Return a JSON-serializable representation of the symbol.
Parameters
This callable has no explicit inputs.
Returns
- Type:
dict[str, object] - Direct return expressions:
asdict(self)
Exceptions and behavior
Method Symbol.to_dict calls asdict; returns asdict(self).
No direct raise statement appears in this definition.
scripts.docs_inventory.Module · class
scripts.docs_inventory.Module(name: str, path: str, page_path: str, docstring: str, summary: str, line_count: int, source_url: str, members: tuple[str, ...], symbols: tuple[Symbol, ...])
Documentation metadata for one tracked Python module.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
str |
yes |
none |
Required constructor field. |
path |
str |
yes |
none |
Required constructor field. |
page_path |
str |
yes |
none |
Required constructor field. |
docstring |
str |
yes |
none |
Required constructor field. |
summary |
str |
yes |
none |
Required constructor field. |
line_count |
int |
yes |
none |
Required constructor field. |
source_url |
str |
yes |
none |
Required constructor field. |
members |
tuple[str, ...] |
yes |
none |
Required constructor field. |
symbols |
tuple[Symbol, ...] |
yes |
none |
Required constructor field. |
Returns
- Constructs:
scripts.docs_inventory.Module
Exceptions and behavior
Class Module declares 1 direct member(s).
No direct raise statement appears in this definition.
scripts.docs_inventory.Module.to_dict · method
Return a JSON-serializable representation of the module.
Parameters
This callable has no explicit inputs.
Returns
- Type:
dict[str, object] - Direct return expressions:
payload
Exceptions and behavior
Method Module.to_dict calls asdict, symbol.to_dict; returns payload.
No direct raise statement appears in this definition.
scripts.docs_inventory.CLIOption · class
scripts.docs_inventory.CLIOption(context: str, receiver: str, flags: tuple[str, ...], destination: str, description: str, default: str, required: bool, choices: str, action: str, path: str, line: int, end_line: int, source_url: str)
One argparse option declaration found in executable source.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
context |
str |
yes |
none |
Required constructor field. |
receiver |
str |
yes |
none |
Required constructor field. |
flags |
tuple[str, ...] |
yes |
none |
Required constructor field. |
destination |
str |
yes |
none |
Required constructor field. |
description |
str |
yes |
none |
Required constructor field. |
default |
str |
yes |
none |
Required constructor field. |
required |
bool |
yes |
none |
Required constructor field. |
choices |
str |
yes |
none |
Required constructor field. |
action |
str |
yes |
none |
Required constructor field. |
path |
str |
yes |
none |
Required constructor field. |
line |
int |
yes |
none |
Required constructor field. |
end_line |
int |
yes |
none |
Required constructor field. |
source_url |
str |
yes |
none |
Required constructor field. |
Returns
- Constructs:
scripts.docs_inventory.CLIOption
Exceptions and behavior
Class CLIOption declares 1 direct member(s).
No direct raise statement appears in this definition.
scripts.docs_inventory.CLIOption.to_dict · method
Return a JSON-serializable representation of the option.
Parameters
This callable has no explicit inputs.
Returns
- Type:
dict[str, object] - Direct return expressions:
asdict(self)
Exceptions and behavior
Method CLIOption.to_dict calls asdict; returns asdict(self).
No direct raise statement appears in this definition.
scripts.docs_inventory._tracked_python_files · function
scripts.docs_inventory._tracked_python_files(root: Path, source_roots: tuple[str, ...] = ('vllm_mlx',)) -> list[Path]
Return tracked modules under selected roots, with a filesystem fallback.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
root |
Path |
yes |
none |
Required positional or keyword input. |
source_roots |
tuple[str, ...] |
no |
('vllm_mlx',) |
Optional positional or keyword input; defaults to ('vllm_mlx',). |
Returns
- Type:
list[Path] - Direct return expressions:
sorted(tracked);sorted((path for source_root in source_roots for path in (root / source_root).rglob('*.py')))
Exceptions and behavior
Function _tracked_python_files calls subprocess.run, completed.stdout.splitlines, path.relative_to, sorted; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory.module_name_for_path · function
Convert a package source path into its importable dotted module name.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path |
Path |
yes |
none |
Required positional or keyword input. |
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
str - Direct return expressions:
'.'.join(parts)
Exceptions and behavior
Function module_name_for_path calls path.relative_to(root).with_suffix, path.relative_to, list, parts.pop; returns '.'.join(parts).
No direct raise statement appears in this definition.
scripts.docs_inventory.page_path_for_module · function
Return the generated documentation path for a package source file.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path |
Path |
yes |
none |
Required positional or keyword input. |
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
Path - Direct return expressions:
Path('reference') / section / relative
Exceptions and behavior
Function page_path_for_module calls path.relative_to(root).with_suffix, path.relative_to, relative.with_name, Path; returns Path('reference') / section / relative.
No direct raise statement appears in this definition.
scripts.docs_inventory._first_sentence · function
Return a compact first sentence or line from a docstring.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
docstring |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'';text[:match.start()] if match else text
Exceptions and behavior
Function _first_sentence calls ' '.join, docstring.strip().split, docstring.strip, re.search; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory._parameter_descriptions · function
Extract Google, NumPy, and Sphinx parameter descriptions.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
docstring |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
dict[str, str] - Direct return expressions:
descriptions
Exceptions and behavior
Function _parameter_descriptions calls docstring.splitlines, re.match, sphinx_match.group(1).lstrip, sphinx_match.group; returns descriptions.
No direct raise statement appears in this definition.
scripts.docs_inventory._function_parameters · function
scripts.docs_inventory._function_parameters(node: ast.FunctionDef | ast.AsyncFunctionDef, docstring: str) -> tuple[Parameter, ...]
Return the callable inputs, annotations, defaults, and descriptions.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.FunctionDef \| ast.AsyncFunctionDef |
yes |
none |
Required positional or keyword input. |
docstring |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
tuple[Parameter, ...] - Direct return expressions:
tuple(parameters)
Exceptions and behavior
Function _function_parameters calls _parameter_descriptions, len, list, enumerate; returns tuple(parameters).
No direct raise statement appears in this definition.
scripts.docs_inventory._function_parameters.append_parameter · nested function
scripts.docs_inventory._function_parameters.append_parameter(argument: ast.arg, *, kind: str, default_node: ast.AST | None, required: bool, prefix: str = '') -> None
Nested Function _function_parameters.append_parameter calls _short_expression, descriptions.get, parameters.append, Parameter; returns None.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
argument |
ast.arg |
yes |
none |
Required positional or keyword input. |
kind |
str |
yes |
none |
Required keyword-only input. |
default_node |
ast.AST \| None |
yes |
none |
Required keyword-only input. |
required |
bool |
yes |
none |
Required keyword-only input. |
prefix |
str |
no |
'' |
Optional keyword-only input; defaults to ''. |
Returns
- Type:
None - Direct return expressions:
None
Exceptions and behavior
Nested Function _function_parameters.append_parameter calls _short_expression, descriptions.get, parameters.append, Parameter; returns None.
No direct raise statement appears in this definition.
scripts.docs_inventory._class_parameters · function
scripts.docs_inventory._class_parameters(node: ast.ClassDef, docstring: str) -> tuple[Parameter, ...]
Return constructor inputs from __init__ or declarative fields.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.ClassDef |
yes |
none |
Required positional or keyword input. |
docstring |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
tuple[Parameter, ...] - Direct return expressions:
_function_parameters(initializer, '\n'.join((part for part in (docstring, initializer_docstring) if part)));();tuple(parameters)
Exceptions and behavior
Function _class_parameters calls next, isinstance, ast.get_docstring, _function_parameters; has 3 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory._owned_nodes · function
Walk implementation nodes without attributing nested bodies to parents.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.AST |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
Iterable[ast.AST] - Yields values incrementally.
Exceptions and behavior
Function _owned_nodes calls getattr, list, reversed, stack.pop; yields values incrementally.
No direct raise statement appears in this definition.
scripts.docs_inventory._ordered_unique · function
Return non-empty strings once while preserving their source order.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
values |
Iterable[str] |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
tuple[str, ...] - Direct return expressions:
tuple(dict.fromkeys((value for value in values if value)))
Exceptions and behavior
Function _ordered_unique calls tuple, dict.fromkeys; returns tuple(dict.fromkeys((value for value in values if value))).
No direct raise statement appears in this definition.
scripts.docs_inventory._short_expression · function
Render an AST expression without allowing one fact to dominate output.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.AST \| None |
yes |
none |
Required positional or keyword input. |
limit |
int |
no |
120 |
Optional keyword-only input; defaults to 120. |
Returns
- Type:
str - Direct return expressions:
'None';value if len(value) <= limit else value[:limit - 1] + '…'
Exceptions and behavior
Function _short_expression calls ' '.join, ast.unparse(node).split, ast.unparse, len; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory._attribute_name · function
Return tracked self or cls attribute access, if applicable.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.Attribute |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'.'.join(reversed(parts));''
Exceptions and behavior
Function _attribute_name calls isinstance, parts.append, '.'.join, reversed; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory._implementation_facts · function
scripts.docs_inventory._implementation_facts(node: ast.ClassDef | ast.FunctionDef | ast.AsyncFunctionDef, *, kind: str, qualname: str) -> dict[str, object]
Extract conservative behavioral facts from one definition's own body.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.ClassDef \| ast.FunctionDef \| ast.AsyncFunctionDef |
yes |
none |
Required positional or keyword input. |
kind |
str |
yes |
none |
Required keyword-only input. |
qualname |
str |
yes |
none |
Required keyword-only input. |
Returns
- Type:
dict[str, object] - Direct return expressions:
{'implementation': implementation, 'decorators': decorators, 'calls': (), 'state_reads': (), 'state_writes': (), 'raise…;{'implementation': implementation, 'decorators': decorators, 'calls': calls, 'state_reads': state_reads, 'state_writes'…
Exceptions and behavior
Function _implementation_facts calls _ordered_unique, ast.unparse, isinstance, clauses.append; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory._function_signature · function
Render a stable function signature without importing its module.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.FunctionDef \| ast.AsyncFunctionDef |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
f'{prefix} {node.name}({ast.unparse(node.args)}){returns}'
Exceptions and behavior
Function _function_signature calls isinstance, ast.unparse; returns f'{prefix} {node.name}({ast.unparse(node.args)}){returns}'.
No direct raise statement appears in this definition.
scripts.docs_inventory._class_signature · function
Render a class declaration and its bases from the AST.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.ClassDef |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
f'class {node.name}{suffix}'
Exceptions and behavior
Function _class_signature calls ast.unparse, arguments.extend, ', '.join; returns f'class {node.name}{suffix}'.
No direct raise statement appears in this definition.
scripts.docs_inventory._defined_member_names · function
Return names defined directly by a module in source order.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tree |
ast.Module |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
tuple[str, ...] - Direct return expressions:
tuple(dict.fromkeys(names))
Exceptions and behavior
Function _defined_member_names calls isinstance, names.append, tuple, dict.fromkeys; returns tuple(dict.fromkeys(names)).
No direct raise statement appears in this definition.
scripts.docs_inventory.scan_python_file · function
Parse one Python file into module and symbol documentation metadata.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path |
Path |
yes |
none |
Required positional or keyword input. |
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
Module - Direct return expressions:
Module(name=module_name, path=relative_path, page_path=page_path_for_module(path, root).as_posix(), docstring=module_do…
Exceptions and behavior
Function scan_python_file calls path.read_text, ast.parse, str, ast.walk; returns Module(name=module_name, path=relative_path, page_path=page_path_for_module(path, root).as_posix(), docstring=module_do….
No direct raise statement appears in this definition.
scripts.docs_inventory.build_inventory · function
scripts.docs_inventory.build_inventory(root: Path = REPOSITORY_ROOT, source_roots: tuple[str, ...] = ('vllm_mlx',)) -> list[Module]
Build static source inventory for the selected repository roots.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
source_roots |
tuple[str, ...] |
no |
('vllm_mlx',) |
Optional positional or keyword input; defaults to ('vllm_mlx',). |
Returns
- Type:
list[Module] - Direct return expressions:
[scan_python_file(path, root) for path in _tracked_python_files(root, source_roots)]
Exceptions and behavior
Function build_inventory calls scan_python_file, _tracked_python_files; returns [scan_python_file(path, root) for path in _tracked_python_files(root, source_roots)].
No direct raise statement appears in this definition.
scripts.docs_inventory.build_repository_inventory · function
Inventory runtime, documentation tools, and executable examples.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
list[Module] - Direct return expressions:
build_inventory(root, ('vllm_mlx', 'scripts', 'examples'))
Exceptions and behavior
Function build_repository_inventory calls build_inventory; returns build_inventory(root, ('vllm_mlx', 'scripts', 'examples')).
No direct raise statement appears in this definition.
scripts.docs_inventory._literal_or_source · function
Render a simple literal cleanly and preserve expressions as source.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
node |
ast.AST \| None |
yes |
none |
Required positional or keyword input. |
default |
str |
no |
'' |
Optional positional or keyword input; defaults to ''. |
Returns
- Type:
str - Direct return expressions:
default;' '.join(ast.unparse(node).split());' '.join(value.split());repr(value)
Exceptions and behavior
Function _literal_or_source calls ast.literal_eval, ' '.join, ast.unparse(node).split, ast.unparse; has 4 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory.scan_cli_options · function
scripts.docs_inventory.scan_cli_options(paths: Iterable[Path], root: Path = REPOSITORY_ROOT) -> list[CLIOption]
Extract every argparse add_argument call from selected source files.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
paths |
Iterable[Path] |
yes |
none |
Required positional or keyword input. |
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
list[CLIOption] - Direct return expressions:
sorted(options, key=lambda option: (option.path, option.line))
Exceptions and behavior
Function scan_cli_options calls sorted, path.read_text, ast.parse, str; returns sorted(options, key=lambda option: (option.path, option.line)).
No direct raise statement appears in this definition.
scripts.docs_inventory.build_cli_inventory · function
Build the complete argparse option inventory for executable source.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
root |
Path |
no |
REPOSITORY_ROOT |
Optional positional or keyword input; defaults to REPOSITORY_ROOT. |
Returns
- Type:
list[CLIOption] - Direct return expressions:
scan_cli_options(paths, root)
Exceptions and behavior
Function build_cli_inventory calls _tracked_python_files, scan_cli_options; returns scan_cli_options(paths, root).
No direct raise statement appears in this definition.
scripts.docs_inventory._escape_table_cell · function
Escape text for a compact Markdown table cell.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
value |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
' '.join(value.replace('|', '\\|').split())
Exceptions and behavior
Function _escape_table_cell calls ' '.join, value.replace('|', '\\|').split, value.replace; returns ' '.join(value.replace('|', '\\|').split()).
No direct raise statement appears in this definition.
scripts.docs_inventory.render_callable_signature · function
Render a reader-facing signature without implicit self or cls.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
symbol |
Symbol |
yes |
none |
Required positional or keyword input. |
qualified |
bool |
no |
False |
Optional keyword-only input; defaults to False. |
Returns
- Type:
str - Direct return expressions:
signature
Exceptions and behavior
Function render_callable_signature calls sum, any, pieces.append, symbol.signature.startswith; returns signature.
No direct raise statement appears in this definition.
scripts.docs_inventory._symbol_details_url · function
Return the generated details URL or source fallback for one symbol.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
module |
Module |
yes |
none |
Required positional or keyword input. |
symbol |
Symbol |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
f'../{page_url}#contract-{symbol.full_name}'
Exceptions and behavior
Function _symbol_details_url calls Path(module.page_path).relative_to, Path, relative.parent.as_posix, relative.with_suffix('').as_posix; returns f'../{page_url}#contract-{symbol.full_name}'.
No direct raise statement appears in this definition.
scripts.docs_inventory.render_contract_details · function
Render explicit inputs and behavior for every definition in a module.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
module |
Module |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'This module does not declare classes or functions.\n';'\n'.join(lines)
Exceptions and behavior
Function render_contract_details calls lines.extend, render_callable_signature, lines.append, _escape_table_cell; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory.render_source_map · function
Render a line-precise source table for every definition in a module.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
module |
Module |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'This module does not declare classes or functions.\n';'\n'.join(lines) + '\n'
Exceptions and behavior
Function render_source_map calls lines.append, _escape_table_cell, render_callable_signature, '\n'.join; has 2 explicit return paths.
No direct raise statement appears in this definition.
scripts.docs_inventory.render_symbol_index · function
Render a filterable index of every runtime class and callable.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
modules |
list[Module] |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'\n'.join(lines)
Exceptions and behavior
Function render_symbol_index calls sorted, len, render_callable_signature, ' '.join((symbol.full_name, symbol.kind, signature, symbol.summary)).casefold; returns '\n'.join(lines).
No direct raise statement appears in this definition.
scripts.docs_inventory.render_module_page · function
Render the generated MkDocs page for one Python module.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
module |
Module |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'\n'.join(lines)
Exceptions and behavior
Function render_module_page calls lines.extend, lines.append, render_contract_details(module).rstrip, render_contract_details; returns '\n'.join(lines).
No direct raise statement appears in this definition.
scripts.docs_inventory.render_module_for_llms · function
Render a self-contained plain-Markdown API record for language models.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
module |
Module |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'\n'.join(lines) + '\n'
Exceptions and behavior
Function render_module_for_llms calls lines.extend, lines.append, ', '.join, '; '.join; returns '\n'.join(lines) + '\n'.
No direct raise statement appears in this definition.
scripts.docs_inventory.render_cli_reference · function
Render every discovered argparse option as a line-precise reference.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options |
list[CLIOption] |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
str - Direct return expressions:
'\n'.join(lines)
Exceptions and behavior
Function render_cli_reference calls lines.extend, ', '.join, str(option.required).lower, str; returns '\n'.join(lines).
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
Parameter |
class | Parameter(name: str, kind: str, annotation: str, default: str, required: bool, description: str) |
One explicit callable input reconstructed from the Python AST. | #L24-L37 |
Parameter.to_dict |
method | Parameter.to_dict() -> dict[str, object] |
Return a JSON-serializable representation of the parameter. | #L34-L37 |
Symbol |
class | Symbol(name: str, qualname: str, full_name: str, kind: str, signature: str, parameters: tuple[Parameter, ...], return_annotation: str, docstring: str, summary: str, implementation: str, documented: bool, public: bool, addressable: bool, line: int, end_line: int, source_url: str, decorators: tuple[str, ...], calls: tuple[str, ...], state_reads: tuple[str, ...], state_writes: tuple[str, ...], raises: tuple[str, ...], return_expressions: tuple[str, ...], awaits: bool, yields: bool) |
A class, function, method, or nested definition found in source code. | #L41-L72 |
Symbol.to_dict |
method | Symbol.to_dict() -> dict[str, object] |
Return a JSON-serializable representation of the symbol. | #L69-L72 |
Module |
class | Module(name: str, path: str, page_path: str, docstring: str, summary: str, line_count: int, source_url: str, members: tuple[str, ...], symbols: tuple[Symbol, ...]) |
Documentation metadata for one tracked Python module. | #L76-L94 |
Module.to_dict |
method | Module.to_dict() -> dict[str, object] |
Return a JSON-serializable representation of the module. | #L89-L94 |
CLIOption |
class | CLIOption(context: str, receiver: str, flags: tuple[str, ...], destination: str, description: str, default: str, required: bool, choices: str, action: str, path: str, line: int, end_line: int, source_url: str) |
One argparse option declaration found in executable source. | #L98-L118 |
CLIOption.to_dict |
method | CLIOption.to_dict() -> dict[str, object] |
Return a JSON-serializable representation of the option. | #L115-L118 |
_tracked_python_files |
function | _tracked_python_files(root: Path, source_roots: tuple[str, ...] = ('vllm_mlx',)) -> list[Path] |
Return tracked modules under selected roots, with a filesystem fallback. | #L121-L154 |
module_name_for_path |
function | module_name_for_path(path: Path, root: Path = REPOSITORY_ROOT) -> str |
Convert a package source path into its importable dotted module name. | #L157-L164 |
page_path_for_module |
function | page_path_for_module(path: Path, root: Path = REPOSITORY_ROOT) -> Path |
Return the generated documentation path for a package source file. | #L167-L174 |
_first_sentence |
function | _first_sentence(docstring: str) -> str |
Return a compact first sentence or line from a docstring. | #L177-L184 |
_parameter_descriptions |
function | _parameter_descriptions(docstring: str) -> dict[str, str] |
Extract Google, NumPy, and Sphinx parameter descriptions. | #L187-L266 |
_function_parameters |
function | _function_parameters(node: ast.FunctionDef \| ast.AsyncFunctionDef, docstring: str) -> tuple[Parameter, ...] |
Return the callable inputs, annotations, defaults, and descriptions. | #L269-L353 |
_function_parameters.append_parameter |
nested function | _function_parameters.append_parameter(argument: ast.arg, *, kind: str, default_node: ast.AST \| None, required: bool, prefix: str = '') -> None |
Nested Function _function_parameters.append_parameter calls _short_expression, descriptions.get, parameters.append, Parameter; returns None. |
#L282-L314 |
_class_parameters |
function | _class_parameters(node: ast.ClassDef, docstring: str) -> tuple[Parameter, ...] |
Return constructor inputs from __init__ or declarative fields. |
#L356-L408 |
_owned_nodes |
function | _owned_nodes(node: ast.AST) -> Iterable[ast.AST] |
Walk implementation nodes without attributing nested bodies to parents. | #L411-L423 |
_ordered_unique |
function | _ordered_unique(values: Iterable[str]) -> tuple[str, ...] |
Return non-empty strings once while preserving their source order. | #L426-L429 |
_short_expression |
function | _short_expression(node: ast.AST \| None, *, limit: int = 120) -> str |
Render an AST expression without allowing one fact to dominate output. | #L432-L438 |
_attribute_name |
function | _attribute_name(node: ast.Attribute) -> str |
Return tracked self or cls attribute access, if applicable. |
#L441-L452 |
_implementation_facts |
function | _implementation_facts(node: ast.ClassDef \| ast.FunctionDef \| ast.AsyncFunctionDef, *, kind: str, qualname: str) -> dict[str, object] |
Extract conservative behavioral facts from one definition's own body. | #L455-L548 |
_function_signature |
function | _function_signature(node: ast.FunctionDef \| ast.AsyncFunctionDef) -> str |
Render a stable function signature without importing its module. | #L551-L556 |
_class_signature |
function | _class_signature(node: ast.ClassDef) -> str |
Render a class declaration and its bases from the AST. | #L559-L565 |
_defined_member_names |
function | _defined_member_names(tree: ast.Module) -> tuple[str, ...] |
Return names defined directly by a module in source order. | #L568-L584 |
scan_python_file |
function | scan_python_file(path: Path, root: Path = REPOSITORY_ROOT) -> Module |
Parse one Python file into module and symbol documentation metadata. | #L587-L712 |
build_inventory |
function | build_inventory(root: Path = REPOSITORY_ROOT, source_roots: tuple[str, ...] = ('vllm_mlx',)) -> list[Module] |
Build static source inventory for the selected repository roots. | #L715-L724 |
build_repository_inventory |
function | build_repository_inventory(root: Path = REPOSITORY_ROOT) -> list[Module] |
Inventory runtime, documentation tools, and executable examples. | #L727-L730 |
_literal_or_source |
function | _literal_or_source(node: ast.AST \| None, default: str = '') -> str |
Render a simple literal cleanly and preserve expressions as source. | #L733-L744 |
scan_cli_options |
function | scan_cli_options(paths: Iterable[Path], root: Path = REPOSITORY_ROOT) -> list[CLIOption] |
Extract every argparse add_argument call from selected source files. |
#L747-L817 |
build_cli_inventory |
function | build_cli_inventory(root: Path = REPOSITORY_ROOT) -> list[CLIOption] |
Build the complete argparse option inventory for executable source. | #L820-L824 |
_escape_table_cell |
function | _escape_table_cell(value: str) -> str |
Escape text for a compact Markdown table cell. | #L827-L830 |
render_callable_signature |
function | render_callable_signature(symbol: Symbol, *, qualified: bool = False) -> str |
Render a reader-facing signature without implicit self or cls. |
#L833-L866 |
_symbol_details_url |
function | _symbol_details_url(module: Module, symbol: Symbol) -> str |
Return the generated details URL or source fallback for one symbol. | #L869-L877 |
render_contract_details |
function | render_contract_details(module: Module) -> str |
Render explicit inputs and behavior for every definition in a module. | #L880-L959 |
render_source_map |
function | render_source_map(module: Module) -> str |
Render a line-precise source table for every definition in a module. | #L962-L981 |
render_symbol_index |
function | render_symbol_index(modules: list[Module]) -> str |
Render a filterable index of every runtime class and callable. | #L984-L1039 |
render_module_page |
function | render_module_page(module: Module) -> str |
Render the generated MkDocs page for one Python module. | #L1042-L1086 |
render_module_for_llms |
function | render_module_for_llms(module: Module) -> str |
Render a self-contained plain-Markdown API record for language models. | #L1089-L1144 |
render_cli_reference |
function | render_cli_reference(options: list[CLIOption]) -> str |
Render every discovered argparse option as a line-precise reference. | #L1147-L1182 |