Find out if an attribute of a class or module is annotated.
11. Reference - Rendering Showcase¶
This chapter is primarily a reference showcase for the Sphinx rendering
layer. The Waterloo project itself is best understood as a toolkit
consisting of waterlint, the Pygments lexer, the MCP server,
and the Visual Studio Code extension.
Most users will not import the internal docitem*.py modules
directly in their own projects. Those modules are implementation details
of the toolkit and are documented here mainly so the rendered API can be
inspected in a structured form.
11.1. Module docitem¶
Preamble |
normative sections
|
Contract |
general
|
Definitions |
Identifier A string that matches the regular expression Qualified_Identifier A string that matches the regular expression |
Public functions |
is_obj_module, is_obj_class, is_obj_function, is_obj_method_like, is_attr_annotated, is_attr_final, get_obj_name, get_obj_path, get_obj_annotations, resolve_object, get_status, get_profile, get_num_indent, parse_indent_docstring, get_tree_of_section, get_tree_of_subsection, get_scopes_of_tree_var, to_string_tree, validate_docstring_method, validate_docstring_inherited_method, validate_docstring_class, validate_docstring_module, validate_docstring, validate_class_class_coverage, validate_class_method_coverage, validate_class_constant_coverage, validate_class_variable_coverage, validate_class_coverage, validate_module_class_coverage, validate_module_function_coverage, validate_module_type_coverage, validate_module_constant_coverage, validate_module_variable_coverage, validate_module_coverage, gen_documentable_objects, make_docitem_tree |
Function overview |
Find out if an attribute of a class or module is annotated as ‘Final’.
Resolve an object by its Qualified_Identifier
Extract documented object status from docitem tree
Extract documented profile from docitem tree
Count number of leading indent units of a string.
The fundamental parsing function which creates docstring trees from Waterloo docstrings.
Get tree assigned to a section label from a docstring tree.
Get tree assigned to a subsection label from a docstring tree.
Get scopes and explicit-scope flag from a docstring tree.
Render docstring to string
Validator for method and function docstrings
Validator for inherited method docstrings
Validator for class docstrings
Validator for module docstrings
Validator for docstrings for generic objects.
Validate mutual coverage of nested classes and class docstring entries.
Validate mutual coverage of methods and class docstring entries.
Verify constant existence and ‘Final’ annotation.
Verify variable existence.
Verify existence (and mutual coverage were applicable) of methods mentioned in the class docstring.
Validate mutual coverage of classes and module docstring entries.
Validate mutual coverage of functions and module docstring entries.
Verify existence of types mentioned in the module docstring.
Verify constant existence and ‘Final’ annotation.
Verify variable existence.
Verify existence (and mutual coverage were applicable) of classes, functions, types, constants mentioned in the module docstring.
Iterate over objects which may have a docstring.
Generate a docitem tree from a docstring. |
Public classes |
tracer, docitem_base, docitem_list_base, docitem_map_base, docitem_free_text_entry_base, docitem_list_of_symbols_base, docitem_profile, docitem_normative_sections, docitem_status, docitem_preamble, docitem_constructor, docitem_general, docitem_invariants, docitem_requires, docitem_ensures, docitem_base_to_inherit_from, docitem_traits, docitem_contract_module, docitem_contract_class, docitem_contract_method, docitem_contract_inherited_method, docitem_derived_from, docitem_factory_functions, docitem_factory, docitem_class_overview_entry, docitem_class_overview, docitem_public_types_entry, docitem_public_types, docitem_public_assignables_entry, docitem_public_assignables_base, docitem_method_overview_entry, docitem_method_overview, docitem_function_overview_entry, docitem_function_overview, docitem_returns, docitem_parameters_entry, docitem_parameters, docitem_raises_entry, docitem_raises, docitem_definitions_entry, docitem_definitions, docitem_terminology_entry, docitem_terminology, docitem_notes_entry, docitem_notes, docitem_description, docitem_see_also, docitem_docstring_base, docitem_docstring_module, docitem_docstring_class, docitem_docstring_method, docitem_docstring_inherited_method, Scope, Flavour, Format, Status |
Class overview |
Context and helper for exceptions and warnings.
The base class for all docitem classes which form the docstring tree.
The base class for docitem classes managing a list of strings.
The base class for docitem classes managing a map from strings to docitem nodes
The base class for nodes which consist of free-text string.
The base class for nodes which contein a list of identifiers.
Node class for section profile
Node class for subsection normative_sections
Node class for subsection status
Node class for section Preamble
Node class for subsection constructor
Node class for subsection general
Node class for subsection invariants
Node class for subsection requires
Node class for subsection ensures
Node class for subsection base
Node class for subsection traits
Node class for section Contract, profile
Node class for section Contract, profile
Node class for section Contract, profile
Node class for section Contract, profile
Node class for section Derived_from.
Node class for entries in section Factory.
Node class for section Factory.
Node class for entries in section Class_overview.
Node class for section Class_overview.
Node class for entries in section Public_types.
Node class for section Public_types.
Node class for entries in section Public_constants and Public_variables.
Node base class for sections Public_constants and Public_variables.
Node class for entries in section Method_overview.
Node class for section Method_overview.
Node class for entries in section Function_overview.
Node class for section Function_overview.
Node class for section Returns.
Node class for a parameter description
Node class for section Parameters
Node class for entries in section Raises.
Node class for section Raises
Node class for entries in section Definitions.
Node class for section Definitions
Node class for entries in section Terminology.
Node class for section Terminology
Node class for entries in section Notes.
Node class for section Notes
Node class for section Description.
Node class for section See_also
Base class for docstring nodes
Node class for a module docstring
Node class for a class docstring
Node class for a function or method docstring
Node class for an inherited method docstring |
Public types |
The type alias for docstring trees.
Type for objects that can have a docstring.
The string literals representing values in the Preamble.profile subsection.
Type alias for a set of scopes. |
Public constants |
Regular expression for identifiers:
Regular expression for qualified identifiers:
The set of normative keywords.
A canonical order for sections and subsection in order to reduce permutative noise for LLMs.
Map string representations of scopes to symbolic/numeric values.
Map string representations of flavours to symbolic/numeric values.
Map string representations of output formats to symbolic/numeric values.
Map string representations of Contract.status values to symbolic values. |
| «Module» | sdv.doc.waterloo.docitem |
|---|
11.1.1. Fundamental helpers¶
11.1.1.1. get_obj_name¶
Signature |
sdv.doc.waterloo.docitem_helper.get_obj_name(
obj: object
) -> str
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object to inspect. |
Returns |
The resolved name according to the defined hierarchy. |
Raises |
<empty> |
Notes |
Last review 2026-06-22 Limitations This helper is best-effort and object-local. It does not reconstruct containment context for nested instances. Behavior for property-like descriptors such as |
See also |
|
| «Function» | get_obj_name – from docitem_helper |
|---|
11.1.1.2. get_obj_fully_qualified_name¶
Signature |
sdv.doc.waterloo.docitem_helper.get_obj_fully_qualified_name(
obj: object
) -> str
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object to inspect. |
Returns |
Best-effort fully qualified object name. |
Raises |
<empty> |
Notes |
Last review 2026-06-23 Limitations Behavior for property-like descriptors such as |
| «Function» | get_obj_fully_qualified_name – from docitem_helper |
|---|
11.1.1.3. get_obj_path¶
Signature |
sdv.doc.waterloo.docitem_helper.get_obj_path(
obj: object
) -> str | None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The object whose defining module path is requested. |
Returns |
Absolute path string or |
Raises |
<empty> |
Notes |
Last review 2026-02-05 |
| «Function» | get_obj_path – from docitem_helper |
|---|
11.1.1.4. get_obj_docstring¶
Signature |
sdv.doc.waterloo.docitem_helper.get_obj_docstring(
obj: object
) -> str
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Any python object that might carry a docstring. |
Returns |
Must return the best available docstring text, or the empty string if none exists. |
Raises |
<empty> |
Notes |
Last review 2026-05-15 General The object-level cache avoids repeating the wrapper walk for the same object. |
| «Function» | get_obj_docstring – from docitem_helper |
|---|
11.1.1.5. get_obj_annotations¶
Signature |
sdv.doc.waterloo.docitem_helper.get_obj_annotations(
obj: object
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The object to be inspected. |
Returns |
A |
Raises |
|
Notes |
Result The returned object mostly results from |
| «Function» | get_obj_annotations – from docitem_helper |
|---|
11.1.1.6. is_obj_module¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_module(
obj: object
) -> TypeIs[ModuleType]
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object to inspect. |
Returns |
|
Raises |
|
Notes |
Purpose Uniform wrapper, allows us to add debugging output or hooks in case of trouble. |
| «Function» | is_obj_module – from docitem_helper |
|---|
11.1.1.7. is_obj_class¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_class(
obj: object
) -> TypeIs[type[object]]
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object to inspect. |
Returns |
|
Raises |
|
Notes |
Purpose Uniform wrapper, allows us to add debugging output or hooks in case of trouble. |
| «Function» | is_obj_class – from docitem_helper |
|---|
11.1.1.8. is_obj_function¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_function(
obj: object
) -> TypeIs[Callable[…, Any]]
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object to inspect. |
Returns |
|
Raises |
|
Notes |
Purpose Uniform wrapper, allows us to add debugging output or hooks in case of trouble. |
| «Function» | is_obj_function – from docitem_helper |
|---|
11.1.1.9. is_obj_method_like¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_method_like(
obj: object
) -> TypeIs[Callable[…, Any]]
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Object to inspect. |
Returns |
|
Raises |
<empty> |
| «Function» | is_obj_method_like – from docitem_helper |
|---|
11.1.1.10. is_obj_documentable¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_documentable(
obj: object
) -> TypeIs[Documentable]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The object to examine. |
Returns |
|
Raises |
<empty> |
Notes |
Last review 2026-06-22 Documentable vs. non-documentable objects Only modules, classes, and functions are considered documentable for Waterloo docstring generation and validation. Accordingly, sections like Public_types, Public_constants, and Public_variables in module and class docstrings document named values that are not documentable objects themselves. |
| «Function» | is_obj_documentable – from docitem_helper |
|---|
11.1.1.11. is_obj_named_value¶
Signature |
sdv.doc.waterloo.docitem_helper.is_obj_named_value(
obj: object
) -> TypeIs[Callable[…, Any]]
|
Preamble |
normative sections
scope
|
Contract |
general
requires
|
Parameters |
The object to inspect. |
Returns |
|
Raises |
|
Notes |
Purpose Uniform wrapper, allows us to add debugging output or hooks in case of trouble. |
| «Function» | is_obj_named_value – from docitem_helper |
|---|
11.1.1.12. get_func_obj_from_callable¶
Signature |
sdv.doc.waterloo.docitem_helper.get_func_obj_from_callable(
obj: object
) -> Callable[…, Any] | None
|
Preamble |
normative sections
scope
status
|
Contract |
general
|
Parameters |
The object to analyze. |
Returns |
The function object (or built-in) assigned to |
Raises |
<empty> |
Notes |
API The signature is stable, but we might add cases to the implementation. |
| «Function» | get_func_obj_from_callable – from docitem_helper |
|---|
11.1.2. Typechecking helpers¶
11.1.2.1. is_attr_annotated¶
Signature |
sdv.doc.waterloo.docitem_helper.is_attr_annotated(
obj: AnnotatableObject
attr: str
) -> bool
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The annotatable object to inspect, for example a module, class, function, or method.
The attribute or annotation name to be tested. For functions and methods this includes parameter names and the return annotation. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | is_attr_annotated – from docitem_helper |
|---|
11.1.2.2. is_attr_final¶
Signature |
sdv.doc.waterloo.docitem_helper.is_attr_final(
obj: AnnotatableObject
attr: str
) -> bool
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The class or module containing the attribute.
The name of the attribute to be tested. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | is_attr_final – from docitem_helper |
|---|
11.1.3. Tokenizer functions¶
11.1.3.1. get_num_indent¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.get_num_indent(
tr: tracer
line: str
indent_scheme: int
) -> int
|
Preamble |
normative sections
status
|
Definitions |
TAB A scheme that demands indentation by means of an integer number of tab characters (ASCII SPC4 A scheme that demands indentation by means of an integer multiple of four space characters (ASCII |
Contract |
general
|
Parameters |
Tracer for better error messages
A single line string.
A symbolic value representing one of the two possible indentation schemes TAB or SPC4. |
Returns |
Must return the number of indentations found at the beginning of the string in units as described by the indentation scheme passed. |
Raises |
|
| «Function» | get_num_indent – from docitem_tokenizer |
|---|
11.1.3.2. parse_indent_docstring¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.parse_indent_docstring(
tr: tracer
text: str
session: DocSession
) -> DocstringTree
|
Preamble |
normative sections
|
Definitions |
DocstringTree A value matching the following type: |
Contract |
general
|
Description |
This section is normative. The state engine consists of the following components: 1. A DocstringTree (initial state: 2. A stack the elements of which point to 3. An integer variable For each incoming line, processed sequentially, the following happens: If the indentation level remains unchanged, the line is appended to the substree represented by the top element of |
Parameters |
Tracer for better error messages
A multiline docstring with possibly indented lines.
A |
Returns |
Must return the DocstringTree described as |
Raises |
|
| «Function» | parse_indent_docstring – from docitem_tokenizer |
|---|
11.1.3.3. resolve_object¶
Signature |
sdv.doc.waterloo.docitem_validator.resolve_object(
ref: str
current_obj: object
) -> tuple[object, str]
|
Preamble |
normative sections
|
Definitions |
Identifier A string matching the regular expression ``[a-zA-Z_][a-zA-Z0-9_]*``. Qualified_Identifier A string formed by concatenating one or more Identifiers with “.” as separator. Public_object An object that is importable as a module attribute or as an attribute of an object reachable from an importable module. Resolved_reference A pair (obj, qname) where qname is a candidate reference string that was successfully resolved and obj is the resulting Python object. |
Contract |
general
|
Parameters |
Reference string to resolve. It may be an Identifier (unqualified) or a Qualified Identifier (contains “.”).
Context object that determines which qualified candidates are tried for an unqualified ref. |
Returns |
Must return a Resolved_reference. |
Raises |
|
| «Function» | resolve_object – from docitem_validator |
|---|
11.1.4. AST properties¶
11.1.4.1. get_status¶
Signature |
sdv.doc.waterloo.docitem_validator.get_status(
tr: tracer
obj: object
top: docitem_docstring_base
) -> str
|
Preamble |
normative sections
status
|
Contract |
general
|
Parameters |
Tracer
The object to be inspected
The AST from parsing the object docstring. |
Returns |
The documented object status or its default. |
Raises |
<empty> |
Notes |
Status Function may be renamed soon. |
| «Function» | get_status – from docitem_validator |
|---|
11.1.5. Per-object validators¶
11.1.5.1. validate_docstring_method¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_docstring_method(
tr: tracer
obj: Callable[…, Any]
top: docitem_docstring_method
node_contract: docitem_map_base
node_normative_sections: docitem_list_base
session: DocSession
) -> None
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The callable object to validate against.
The docitem tree to validate.
The node for section Contract already parsed by the caller.
The node for section Preamble.normative_sections already parsed by the caller.
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Usage This function is typically not called directly. Please call |
| «Function» | validate_docstring_method – from docitem_validator |
|---|
11.1.5.2. validate_docstring_class¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_docstring_class(
tr: tracer
obj: object
top: docitem_docstring_class
node_contract: docitem_map_base
node_normative_sections: docitem_list_base
session: DocSession
) -> None
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The callable object to validate against.
The docitem tree to validate.
The node for section Contract already parsed by the caller.
The node for section Preamble.normative_sections already parsed by the caller.
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Usage This function is typically not called directly. Please call Last review 2026-01-23 |
| «Function» | validate_docstring_class – from docitem_validator |
|---|
11.1.5.3. validate_docstring_module¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_docstring_module(
tr: tracer
obj: object
top: docitem_docstring_module
node_contract: docitem_map_base
node_normative_sections: docitem_list_base
session: DocSession
) -> None
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The callable object to validate against.
The docitem tree to validate.
The node for section Contract already parsed by the caller.
The node for section Preamble.normative_sections already parsed by the caller.
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Usage This function is typically not called directly. Please call Last review 2026-01-23 |
| «Function» | validate_docstring_module – from docitem_validator |
|---|
11.1.5.4. validate_docstring¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_docstring(
tr: tracer
obj: object
top: docitem_docstring_base | None
session: DocSession
) -> docitem_docstring_base
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The object to validate against (module, class or callable).
The docitem tree to validate.
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Usage This function should be pretty easy to use, if you leave out parameter |
See also |
|
| «Function» | validate_docstring – from docitem_validator |
|---|
11.1.6. Coverage validators¶
11.1.6.1. validate_class_class_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_class_class_coverage(
tr: tracer
obj: type[object]
doc_class: docitem_docstring_class
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The class object to be validated.
Already parsed class docstring tree for
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | validate_class_class_coverage – from docitem_validator |
|---|
11.1.6.2. validate_class_method_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_class_method_coverage(
tr: tracer
obj: type[object]
doc_class: docitem_docstring_class
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The class object to be validated.
Already parsed class docstring tree for
The validation session shared across recursive validations. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | validate_class_method_coverage – from docitem_validator |
|---|
11.1.6.3. validate_class_constant_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_class_constant_coverage(
tr: tracer
obj: type[object]
doc_class: docitem_docstring_class
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The class object to be validated.
Already parsed class docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
| «Function» | validate_class_constant_coverage – from docitem_validator |
|---|
11.1.6.4. validate_class_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_class_coverage(
tr: tracer
obj: type[object]
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The class object to be validated. |
Returns |
Must return |
Raises |
|
Notes |
todo Missing: class-type-coverage. |
| «Function» | validate_class_coverage – from docitem_validator |
|---|
11.1.6.5. validate_module_class_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_class_coverage(
tr: tracer
obj: ModuleType
doc_module: docitem_docstring_module
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated.
Already parsed module docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | validate_module_class_coverage – from docitem_validator |
|---|
11.1.6.6. validate_module_function_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_function_coverage(
tr: tracer
obj: ModuleType
doc_module: docitem_docstring_module
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated.
Already parsed module docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-02-04 |
| «Function» | validate_module_function_coverage – from docitem_validator |
|---|
11.1.6.7. validate_module_type_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_type_coverage(
tr: tracer
obj: ModuleType
doc_module: docitem_docstring_module
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated.
Already parsed module docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
| «Function» | validate_module_type_coverage – from docitem_validator |
|---|
11.1.6.8. validate_module_constant_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_constant_coverage(
tr: tracer
obj: ModuleType
doc_module: docitem_docstring_module
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated.
Already parsed module docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
| «Function» | validate_module_constant_coverage – from docitem_validator |
|---|
11.1.6.9. validate_module_variable_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_variable_coverage(
tr: tracer
obj: ModuleType
doc_module: docitem_docstring_module
session: DocSession
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated.
Already parsed module docstring tree for
Validation session for tracking state across validations. |
Returns |
Must return |
Raises |
|
| «Function» | validate_module_variable_coverage – from docitem_validator |
|---|
11.1.6.10. validate_module_coverage¶
Signature |
sdv.doc.waterloo.docitem_validator.validate_module_coverage(
tr: tracer
obj: ModuleType
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings.
The module object to be validated. |
Returns |
Must return |
Raises |
|
| «Function» | validate_module_coverage – from docitem_validator |
|---|
11.1.7. Additional helpers¶
11.1.7.1. gen_documentable_objects¶
Signature |
sdv.doc.waterloo.docitem_helper.gen_documentable_objects(
obj: Documentable
config: ConfigTraversal = ConfigTraversal()
) -> Generator[Documentable, None, None]
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
The object (module, class, function, method) to examine.
Controls acceptance or refusal of objects during traversal. |
Returns |
Must return a Generator which yields objects from tree traversal of |
Raises |
<empty> |
| «Function» | gen_documentable_objects – from docitem_helper |
|---|
Example
import sdv.doc.waterloo.docitem as wtrl
import importlib
import sys
def main(mod_name: str) -> None:
# Configure traversal
cfg = wtrl.ConfigTraversal()
# Allow recursive traversal
cfg.enable_include_imported()
# Open module
mod = importlib.import_module(mod_name)
# Iterate over documentable objects
objs = wtrl.gen_documentable_objects(mod,cfg)
for obj in objs:
print(wtrl.get_obj_name(obj))
if __name__ == "__main__":
main("pytest_good_inheritance")
11.1.7.2. get_tree_of_section¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.get_tree_of_section(
tr: tracer
tree: DocstringTree
sec: str
) -> DocstringSubtree
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings
The docitem tree to be examined
The section label to search for. |
Returns |
Must return the subtree of the found section. |
Raises |
|
| «Function» | get_tree_of_section – from docitem_tokenizer |
|---|
11.1.7.3. get_tree_of_subsection¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.get_tree_of_subsection(
tr: tracer
tree: DocstringTree
sec: str
subsec: str
) -> DocstringSubtree
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings
The docitem tree to be examined
The section label to search for.
The subsection label to search for. |
Returns |
Must return the subtree of the found subsection. |
Raises |
|
| «Function» | get_tree_of_subsection – from docitem_tokenizer |
|---|
11.1.7.4. get_scopes_of_tree¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.get_scopes_of_tree(
tr: tracer
tree: DocstringTree
) -> Scopes
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Tracer for providing context and collecting warnings
The docitem tree to be examined |
Returns |
Must return the set of scopes found, or the default., which is a set containing a single element |
Raises |
|
| «Function» | get_scopes_of_tree – from docitem_tokenizer |
|---|
11.1.7.5. to_string_tree¶
Signature |
sdv.doc.waterloo.docitem_tokenizer.to_string_tree(
tree: DocstringSubtree
indent_scheme: int = 0
indent: int = 0
) -> str
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The docstring tre to render
The indentation scheme to use, must be one of {
Current indent level (recursive function). May be used for providing an overall indentation by the caller. |
Returns |
Must return the rendered string. |
Raises |
<empty> |
Description |
This function is helpful for idempotence tests. It is invoked e.g. in `waterlint extract` in order to extract sections or subsections from a docstring. |
| «Function» | to_string_tree – from docitem_tokenizer |
|---|
11.1.7.6. build_anchor¶
Signature |
sdv.doc.waterloo.docitem_helper.build_anchor(
obj: object
kind: AnchorKind_t | None = None
) -> str
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Object for which the anchor shall be generated.
Optional explicit kind tag. |
Returns |
Deterministic anchor string suitable for doc-internal links. |
Raises |
<empty> |
Notes |
Last review 2026-06-22 |
| «Function» | build_anchor – from docitem_helper |
|---|
11.1.8. Diagnostics helpers¶
11.1.8.1. explain_try_self_for_section¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.explain_try_self_for_section(
label: str
profile: str
) -> str
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label to explain.
The docstring profile to use as the explain context. |
Returns |
The canonical |
Raises |
<empty> |
See also |
|
| «Function» | explain_try_self_for_section – from docitem_diagnostics |
|---|
11.1.8.2. explain_try_self_for_subsection¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.explain_try_self_for_subsection(
label: str
profile: str
) -> str
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The fully qualified subsection label to explain.
The docstring profile to use as the explain context. |
Returns |
The canonical |
Raises |
<empty> |
See also |
|
| «Function» | explain_try_self_for_subsection – from docitem_diagnostics |
|---|
11.1.8.3. render_allowed_identifier¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_allowed_identifier(
label: str
identifiers: Iterable[str]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The allowed identifier values. |
Returns |
A compact list of lines that states the allowed identifier values in one line. |
Raises |
<empty> |
| «Function» | render_allowed_identifier – from docitem_diagnostics |
|---|
11.1.8.4. render_allowed_identifiers¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_allowed_identifiers(
label: str
identifiers: Iterable[str]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The allowed identifier values. |
Returns |
A compact list of lines that states the allowed identifier values in one line. |
Raises |
<empty> |
| «Function» | render_allowed_identifiers – from docitem_diagnostics |
|---|
11.1.8.5. render_base_method_docstring_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_base_method_docstring_details(
base_name: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The base method name found in Contract.base.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_base_method_docstring_details – from docitem_diagnostics |
|---|
11.1.8.6. render_base_method_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_base_method_reference_details(
current_entries: Iterable[str]
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The current raw entries found in Contract.base.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_base_method_reference_details – from docitem_diagnostics |
|---|
11.1.8.7. render_constant_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_constant_reference_details(
label: str
const_name: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The constant entry name found in the subsection.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_constant_reference_details – from docitem_diagnostics |
|---|
11.1.8.8. render_deduplicated_identifiers¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_deduplicated_identifiers(
label: str
identifiers: Iterable[str]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The identifier values with duplicates removed while preserving the first occurrence order. |
Returns |
A compact list of lines that states the deduplicated identifier values in one line. |
Raises |
<empty> |
| «Function» | render_deduplicated_identifiers – from docitem_diagnostics |
|---|
11.1.8.9. render_definition_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_definition_reference_details(
references: str | Iterable[str]
profile: str
missing_definitions: bool
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The term reference or term references found in the docstring body.
The docstring profile used for the
Whether the Definitions section itself is missing. |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_definition_reference_details – from docitem_diagnostics |
|---|
11.1.8.10. render_exactly_one_identifier_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_exactly_one_identifier_details(
label: str
current_entries: Iterable[str]
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The qualified subsection label to render in the snippets and hint.
The current raw entries from the subsection.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_exactly_one_identifier_details – from docitem_diagnostics |
|---|
11.1.8.11. render_expected_identifier¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_expected_identifier(
label: str
expected_kind: Literal[‘identifier’, ‘qualified identifier’]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
Use identifier or qualified identifier to describe the expected syntax class. |
Returns |
A compact list of lines that states the expected syntax in the Waterloo snippet format. |
Raises |
<empty> |
| «Function» | render_expected_identifier – from docitem_diagnostics |
|---|
11.1.8.12. render_expected_snippet¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_expected_snippet(
section_label: str | None
subsections: Iterable[str] | None = None
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label to render.
The subsection labels to render under the section label. |
Returns |
The canonical expected section snippet as a list of lines. |
Raises |
<empty> |
| «Function» | render_expected_snippet – from docitem_diagnostics |
|---|
11.1.8.13. render_identifier_lines¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_identifier_lines(
label: str
identifiers: Iterable[str]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The identifier values exactly as found. |
Returns |
A compact list of lines that states the identifier values in one line without semantic normalization. |
Raises |
<empty> |
| «Function» | render_identifier_lines – from docitem_diagnostics |
|---|
11.1.8.14. render_inherited_definition_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_inherited_definition_details(
current_inherited_terms: Iterable[str]
profile: str
expected_text: str
use_section_hint: bool = False
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The inherited definition terms found in the current object.
The docstring profile used for the
The minimal correction or instruction to show in the expected snippet.
Whether the hint should point to the section-level |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_inherited_definition_details – from docitem_diagnostics |
|---|
11.1.8.15. render_listed_object_missing_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_listed_object_missing_details(
label: str
member_name: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label to render.
The listed entry name that has no matching object.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_listed_object_missing_details – from docitem_diagnostics |
|---|
11.1.8.16. render_missing_entry_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_missing_entry_details(
container_label: str
current_entries: Iterable[str]
missing_entry: str
profile: str
top_level: bool = False
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label that contains the missing entry.
The currently present entry labels in the container.
The entry label that should be added.
The docstring profile used for the
Use a top-level list rendering when the container itself is the document root rather than a nested section. |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_missing_entry_details – from docitem_diagnostics |
|---|
11.1.8.17. render_name_object_consistency_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_name_object_consistency_details(
label: str
current_entries: Iterable[str]
profile: str
overview_item: str | None = None
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label to render.
The current raw entries from the section.
The docstring profile used for the hint.
If provided, render an overview entry instead of a flat identifier list. |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_name_object_consistency_details – from docitem_diagnostics |
|---|
11.1.8.18. render_named_value_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_named_value_reference_details(
label: str
name: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The variable entry name found in the subsection.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_named_value_reference_details – from docitem_diagnostics |
|---|
11.1.8.19. render_normative_section_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_normative_section_details(
section_label: str
normative_sections: Iterable[str]
profile: str
action: Literal[‘add’, ‘remove’]
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label that should be added to or removed from the normative section set.
The current normative section labels.
The docstring profile used for the
Either |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_normative_section_details – from docitem_diagnostics |
|---|
11.1.8.20. render_normativity_keyword_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_normativity_keyword_details(
section_label: str
entry_name: str
current_lines: Iterable[str]
suggestion: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The overview section label, such as Class_overview.
The entry label that violates the rule.
The raw lines found in the entry.
A brief informative replacement suggestion for the entry.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_normativity_keyword_details – from docitem_diagnostics |
|---|
11.1.8.21. render_overview_missing_member_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_overview_missing_member_details(
overview_label: str
public_label: str
current_entries: Iterable[str]
missing_name: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The overview section label, such as Class_overview.
The matching public section label, such as Public_classes.
The current raw entries from the overview section.
The entry name that is missing from the public section.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_overview_missing_member_details – from docitem_diagnostics |
|---|
11.1.8.22. render_overview_requires_section_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_overview_requires_section_details(
overview_label: str
required_section: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The overview section label, such as Class_overview.
The normative section that must be added, such as Public_classes.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_overview_requires_section_details – from docitem_diagnostics |
|---|
11.1.8.23. render_parameter_signature_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_parameter_signature_details(
section_label: str
current_entries: Iterable[str]
expected_entries: Iterable[str]
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The label to render in the snippets.
The current raw parameter entries.
The corrected parameter entries to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_parameter_signature_details – from docitem_diagnostics |
|---|
11.1.8.24. render_profile_mismatch_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_profile_mismatch_details(
object_name: str
object_kind: str
current_profile: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The documented object name.
The detected object kind such as module, class, function or method-like.
The profile found in the docstring.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the hint. |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_profile_mismatch_details – from docitem_diagnostics |
|---|
11.1.8.25. render_scope_relation_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_scope_relation_details(
containing_kind: str
containing_scopes: Scopes
is_containing_scope_explicit: bool
contained_kind: str
contained_scopes: Scopes
is_contained_scope_explicit: bool
section_label: str
reference: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The kind of the containing object, such as module or class.
The scopes of the containing object.
Whether the containing object declared its scope explicitly.
The kind of the contained object, such as function, class, or method.
The scopes of the contained object.
Whether the contained object declared its scope explicitly.
The section label to render.
The offending reference as found in the source section.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_scope_relation_details – from docitem_diagnostics |
|---|
11.1.8.26. render_see_also_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_see_also_reference_details(
reference: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The raw reference text as found in the See_also section.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_see_also_reference_details – from docitem_diagnostics |
|---|
11.1.8.27. render_source_snippet¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_source_snippet(
section_label: str | None
subsections: Iterable[str] | None = None
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The section label to render.
The subsection labels to render under the section label. If omitted, the canonical order for the section is used when available. |
Returns |
A compact list of lines that renders the section label followed by subsection placeholders. |
Raises |
<empty> |
| «Function» | render_source_snippet – from docitem_diagnostics |
|---|
11.1.8.28. render_suggestion¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_suggestion(
label: str | None
suggestion: str
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
requires
|
Parameters |
The section or subsection label (as qualified name) to render. An empty label means the suggestion is not bound to a specific section or subsection.
A brief suggestion of what the section or subsection could be or contain. |
Returns |
A compact list of lines that states the suggested section or subsection in one line. |
Raises |
<empty> |
| «Function» | render_suggestion – from docitem_diagnostics |
|---|
11.1.8.29. render_type_reference_details¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_type_reference_details(
label: str
type_name: str
expected_text: str
profile: str
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The type entry name found in the subsection.
The minimal correction or instruction to show in the expected snippet.
The docstring profile used for the |
Returns |
A details dictionary with |
Raises |
<empty> |
| «Function» | render_type_reference_details – from docitem_diagnostics |
|---|
11.1.8.30. render_unique_identifiers¶
Signature |
sdv.doc.waterloo.docitem_diagnostics.render_unique_identifiers(
label: str
identifiers: Iterable[str]
) -> list[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The subsection label to render.
The canonical identifier values. |
Returns |
A compact list of lines that states the canonical identifier values and mentions uniqueness. |
Raises |
<empty> |
| «Function» | render_unique_identifiers – from docitem_diagnostics |
|---|
11.1.9. Enum classes¶
11.1.9.1. sdv.doc.waterloo.docitem_helper.Scope¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
|
Derived from |
|
Public constants |
Selects the public API.
Selects the API for developers of plugin and extensions.
Selects the API for core developers. |
Notes |
Purpose The scope is an optional parameter for rendering functions. It allows to restrict the set of rendered objects to a well-defined audience. Values The class only ensures the partial order but does not ensure particular values for the constants. |
| «Class» | Scope – from docitem_helper |
|---|
11.1.9.2. sdv.doc.waterloo.docitem_helper.Flavour¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
|
Derived from |
|
Public constants |
Example: | + Must + |
Example:
Example: |
| «Class» | Flavour – from docitem_helper |
|---|
11.1.9.3. sdv.doc.waterloo.docitem_helper.Format¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
|
Derived from |
|
Public constants |
Javascript Object Notation
Markdown. |
| «Class» | Format – from docitem_helper |
|---|
11.1.9.4. sdv.doc.waterloo.docitem_helper.Status¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
|
Derived from |
|
Public constants |
See rule STA-004.
See rule STA-004.
See rule STA-004.
See rule STA-004.
See rule STA-004. |
Notes |
LoII This docstring violates LoII in order to preserve SSoT, see Public_constants. |
| «Class» | Status – from docitem_helper |
|---|
11.1.10. Helper classes¶
11.1.10.1. tracer¶
Preamble |
normative sections
|
Terminology |
rules on fail Low-level functions may find a parsing or validation warning or error, but have no clue which rule has been violated. The rules on fail mechanism allows the caller to pass the set of rules in question. The tracer provides a stack and api for these rule sets. |
Contract |
general
constructor
|
Public types |
Type Alias for List[str] A list of strings built per context manager during parsing and validation. Entries can be module, class or function names, or labels. |
Public classes |
|
Class overview |
An enum with values DEBUG, INFO, WARNING, ERROR for filtering the output of the tracer. |
Public methods |
|
Method overview |
Build a JSON-serializable |
Notes |
Last review 2026-06-21 Parameter ‘details’ The details payload is important for the MCP server, because it gives the LLM enough debugging context to interpret tracer output and decide how to react to it. It usually is a dict with keys “found”, “expected”, and “hint”; “hint” typically contains a waterlint call for retrieving more information about the affected section or subsection. |
| «Class» | tracer – from docitem_helper |
|---|
Nested classes in tracer
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
| «Class» | tracer.Severity – from docitem_helper |
|---|
Public Methods in class tracer
Signature |
sdv.doc.waterloo.docitem_helper.tracer.build_json(
severity: Severity
schema_version: str | None = None
waterloo_version: str | None = None
id_prefix: str | None = None
include_debug: bool = True
) -> dict[str, Any]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Only include entries with this severity level or higher. Levels are ordered as DEBUG < INFO < WARNING < ERROR.
Specify the WTRL Tracer JSON Schema version to declare in the output. Defaults to the current version if not provided. This does not affect the structure of the output, which always follows the current schema. Including the schema version allows consumers to validate against the correct schema and maintain compatibility as the schema evolves.
Optionally include the version of the Waterloo tool that generated the tracer data.
Optionally include a prefix for the `$id` field in the output JSON.
Optionally include debug notes in the output JSON. |
Returns |
A JSON-serializable |
Raises |
<empty> |
| «Method» | tracer.build_json – from docitem_helper |
|---|
Signature |
sdv.doc.waterloo.docitem_helper.tracer.str_by_severity(
severity: Severity
) -> str
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
Only include entries with this severity level or higher. Levels are ordered as DEBUG < INFO < WARNING < ERROR. |
Returns |
A string representation of the tracer’s content, including entries up to the specified severity level, formatted for human readability. |
Raises |
<empty> |
Notes |
Called by This method is invoked by the __str__ method, which defaults to showing all entries (DEBUG level), so generally you simply call :wtrl_func:`str`(tracer_instance) to get the full content or :wtrl_func:`print`(tracer_instance) to display it. |
| «Method» | tracer.str_by_severity – from docitem_helper |
|---|
11.1.10.2. ConfigTraversal¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
|
Notes |
Experimental This class will likely be expanded in the future, and we are postponing the normative documentation for now. Configure Use Future Possible extensions include acceptance/refusal by regular expressions. Example |
| «Class» | ConfigTraversal – from docitem_helper |
|---|
11.1.11. Base classes¶
11.1.11.1. docitem_base¶
Preamble |
normative sections
|
Terminology |
child item A string or an instance of a docitem class. |
Contract |
general
constructor
traits
|
Derived from |
<empty>
|
Public methods |
|
Method overview |
Parse a docstring subtree and create child nodes accordingly.
Return an iterable over the child items. |
| «Class» | docitem_base – from docitem_base |
|---|
Public Methods in class docitem_base
Signature |
sdv.doc.waterloo.docitem_base.docitem_base.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Description |
This docstring is located in the base class of all docitem node classes. The method is not implemented here and will raise an exception if it is invoked without a corresponding implementation in a derived class. |
Contract |
general
requires
|
Parameters |
The tracer for collecting diagnostics.
A subtree of the tree matching this instance. |
Returns |
|
Raises |
|
| «Method» | docitem_base.parse – from docitem_base |
|---|
Signature |
sdv.doc.waterloo.docitem_base.docitem_base.items(
) -> Iterable[str]
|
Preamble |
normative sections
|
Contract |
general ensures
|
Parameters |
<empty> |
Returns |
Must return an iterable over the child items. |
Raises |
|
| «Method» | docitem_base.items – from docitem_base |
|---|
11.1.11.2. docitem_list_base¶
Preamble |
normative sections
|
Contract |
general
constructor
traits
|
Derived from |
|
Public methods |
|
Method overview |
Access to the string list |
| «Class» | docitem_list_base – from docitem_base |
|---|
Public Methods in class docitem_list_base
Signature |
sdv.doc.waterloo.docitem_base.docitem_list_base.items(
) -> List[str]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
Must return the forementioned container of strings. |
Raises |
<empty> |
Description |
|
| «Method» | docitem_list_base.items – from docitem_base |
|---|
11.1.11.3. docitem_map_base¶
Preamble |
normative sections
|
Contract |
general
constructor
traits
|
Derived from |
|
Public methods |
|
Method overview |
Access to the item-node map |
| «Class» | docitem_map_base – from docitem_base |
|---|
Public Methods in class docitem_map_base
Signature |
sdv.doc.waterloo.docitem_base.docitem_map_base.items(
) -> Dict[str, docitem_base]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
Must return an iterable over the child items. |
Raises |
<empty> |
| «Method» | docitem_map_base.items – from docitem_base |
|---|
11.1.11.4. docitem_docstring_base¶
Preamble |
normative sections
scope
|
Contract |
general
constructor
traits
|
Derived from |
|
Public methods |
|
Method overview |
Parse a docstring tree. |
| «Class» | docitem_docstring_base – from docitem_docstring |
|---|
Public Methods in class docitem_docstring_base
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_base.parse(
tr: tracer
tree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring tree |
Returns |
Must return |
Raises |
|
| «Method» | docitem_docstring_base.parse – from docitem_docstring |
|---|
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_base.scopes(
) -> Scopes
|
Preamble |
normative sections
scope
|
Contract |
general
requires
|
Parameters |
<empty> |
Returns |
A set of enum values representing the scopes of the documented object. |
Raises |
|
| «Method» | docitem_docstring_base.scopes – from docitem_docstring |
|---|
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_base.is_visible(
sc_query: Scopes
) -> bool
|
Preamble |
normative sections
scope
|
Contract |
general
requires
|
Parameters |
The set of scopes to test visibility against. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_docstring_base.is_visible – from docitem_docstring |
|---|
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_base.can_see(
sc_query: Scopes
) -> bool
|
Preamble |
normative sections
|
Contract |
general
requires
|
Parameters |
The set of scope values of the referenced object. |
Returns |
|
Raises |
|
| «Method» | docitem_docstring_base.can_see – from docitem_docstring |
|---|
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_base.is_scope_compatible(
obj_trg: docitem_docstring_base
) -> bool
|
Preamble |
normative sections
scope
|
Contract |
general
requires
|
Parameters |
The embedded, referenced or otherwise dependent object. |
Returns |
|
Raises |
|
| «Method» | docitem_docstring_base.is_scope_compatible – from docitem_docstring |
|---|
11.1.11.5. docitem_free_text_entry_base¶
Preamble |
normative sections
|
Contract |
general
constructor
traits
|
Derived from |
|
Public methods |
|
Method overview |
Parse free-form text lines. |
| «Class» | docitem_free_text_entry_base – from docitem_base |
|---|
Public Methods in class docitem_free_text_entry_base
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.11.6. docitem_list_of_symbols_base¶
Preamble |
normative sections
|
Definitions |
:wtrl_dfn:`Identifier` |
Contract |
general
constructor
traits
|
Public classes |
|
Class overview |
Enum type for selecting the regex to match against. |
Public methods |
|
Method overview |
Parse a list of symbols. |
| «Class» | docitem_list_of_symbols_base – from docitem_base |
|---|
Nested classes in docitem_list_of_symbols_base
Preamble |
normative sections
|
Definitions |
:wtrl_dfn:`Identifier`, :wtrl_dfn:`Qualified_Identifier` |
Contract |
general
constructor
|
Public constants |
Must represent the pattern of an Identifier.
Must represent the pattern of a Qualified_Identifier. |
| «Class» | docitem_list_of_symbols_base.ValuePattern – from docitem_base |
|---|
Public Methods in class docitem_list_of_symbols_base
Signature |
sdv.doc.waterloo.docitem_base.docitem_list_of_symbols_base._parse(
tr: tracer
refs: DocstringSubtree
pattern: ValuePattern
) -> None
|
Preamble |
normative sections
|
Definitions |
:wtrl_dfn:`Identifier`, :wtrl_dfn:`Qualified_Identifier` |
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse.
Specifies the pattern to match strings against, |
Returns |
Must return |
Raises |
|
See also |
sdv.doc.waterloo.docitem_helper.RE_IDENTIFIER, sdv.doc.waterloo.docitem_helper.RE_QUALIFIED_IDENTIFIER |
| «Method» | docitem_list_of_symbols_base._parse – from docitem_base |
|---|
11.1.12. Preamble node classes¶
11.1.12.1. docitem_profile¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a profile section. |
| «Class» | docitem_profile – from docitem_preamble |
|---|
Public Methods in class docitem_profile
Signature |
sdv.doc.waterloo.docitem_preamble.docitem_profile.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_profile.parse – from docitem_preamble |
|---|
11.1.12.2. docitem_normative_sections¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Inherited method |
| «Class» | docitem_normative_sections – from docitem_preamble |
|---|
Public Methods in class docitem_normative_sections
Signature |
sdv.doc.waterloo.docitem_preamble.docitem_normative_sections.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
base |
| «Inherited_method» | docitem_normative_sections.parse – from docitem_preamble |
|---|
11.1.12.3. docitem_status¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a status section. |
| «Class» | docitem_status – from docitem_preamble |
|---|
Public Methods in class docitem_status
Signature |
sdv.doc.waterloo.docitem_preamble.docitem_status.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_status.parse – from docitem_preamble |
|---|
11.1.12.4. docitem_scope¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Inherited method |
| «Class» | docitem_scope – from docitem_preamble |
|---|
Public Methods in class docitem_scope
Signature |
sdv.doc.waterloo.docitem_preamble.docitem_scope.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
base |
| «Inherited_method» | docitem_scope.parse – from docitem_preamble |
|---|
11.1.12.5. docitem_preamble¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a Preamble section. |
| «Class» | docitem_preamble – from docitem_preamble |
|---|
Public Methods in class docitem_preamble
Signature |
sdv.doc.waterloo.docitem_preamble.docitem_preamble.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_preamble.parse – from docitem_preamble |
|---|
11.1.13. Contract node classes¶
11.1.13.1. docitem_constructor¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a constructor section. |
| «Class» | docitem_constructor – from docitem_contract |
|---|
Public Methods in class docitem_constructor
Signature |
sdv.doc.waterloo.docitem_contract.docitem_constructor.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of strings. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_constructor.parse – from docitem_contract |
|---|
11.1.13.2. docitem_general¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a general section. |
| «Class» | docitem_general – from docitem_contract |
|---|
Public Methods in class docitem_general
Signature |
sdv.doc.waterloo.docitem_contract.docitem_general.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of strings. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_general.parse – from docitem_contract |
|---|
11.1.13.3. docitem_invariants¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a invariants section. |
| «Class» | docitem_invariants – from docitem_contract |
|---|
Public Methods in class docitem_invariants
Signature |
sdv.doc.waterloo.docitem_contract.docitem_invariants.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of strings. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_invariants.parse – from docitem_contract |
|---|
11.1.13.4. docitem_requires¶
Preamble |
normative sections
|
Description |
This node represents the requires subsection of Contract. The subsection is intended to describe conditions the caller must satisfy before calling the documented function or method. The contents are treated as free-form text and are preserved verbatim for rendering and reporting. |
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a requires section. |
| «Class» | docitem_requires – from docitem_contract |
|---|
Public Methods in class docitem_requires
Signature |
sdv.doc.waterloo.docitem_contract.docitem_requires.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of strings. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_requires.parse – from docitem_contract |
|---|
11.1.13.5. docitem_ensures¶
Preamble |
normative sections
|
Description |
This node represents the ensures subsection of Contract. The subsection is intended to describe guarantees that hold after a successful call of the documented function or method. The contents are treated as free-form text and are preserved verbatim for rendering and reporting. |
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse an ensures section. |
| «Class» | docitem_ensures – from docitem_contract |
|---|
Public Methods in class docitem_ensures
Signature |
sdv.doc.waterloo.docitem_contract.docitem_ensures.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of strings. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_ensures.parse – from docitem_contract |
|---|
11.1.13.6. docitem_traits¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Inherited method |
| «Class» | docitem_traits – from docitem_contract |
|---|
Public Methods in class docitem_traits
Signature |
sdv.doc.waterloo.docitem_contract.docitem_traits.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
base |
| «Inherited_method» | docitem_traits.parse – from docitem_contract |
|---|
11.1.13.7. docitem_contract_module¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a Contract section for profile |
| «Class» | docitem_contract_module – from docitem_contract |
|---|
Public Methods in class docitem_contract_module
Signature |
sdv.doc.waterloo.docitem_contract.docitem_contract_module.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a set of concatenated sections. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_contract_module.parse – from docitem_contract |
|---|
11.1.13.8. docitem_contract_class¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a contract section for profile |
| «Class» | docitem_contract_class – from docitem_contract |
|---|
Public Methods in class docitem_contract_class
Signature |
sdv.doc.waterloo.docitem_contract.docitem_contract_class.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a set of concatenated sections. |
Returns |
Must return |
Raises |
|
Notes |
Last review 2026-07-16 |
| «Method» | docitem_contract_class.parse – from docitem_contract |
|---|
11.1.13.9. docitem_contract_method¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a contract section for profile |
| «Class» | docitem_contract_method – from docitem_contract |
|---|
Public Methods in class docitem_contract_method
Signature |
sdv.doc.waterloo.docitem_contract.docitem_contract_method.parse(
tr: tracer
subtree: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a set of concatenated sections. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_contract_method.parse – from docitem_contract |
|---|
11.1.13.10. docitem_class_overview_entry¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a list of text lines describing the public class. |
| «Class» | docitem_class_overview_entry – from docitem_sections |
|---|
Public Methods in class docitem_class_overview_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15. Other sections node classes¶
11.1.15.1. docitem_returns¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Public methods |
|
Method overview |
Parse a list of return descriptions. |
| «Class» | docitem_returns – from docitem_sections |
|---|
Public Methods in class docitem_returns
Signature |
sdv.doc.waterloo.docitem_sections.docitem_returns.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
A free-form text describing the return value. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_returns.parse – from docitem_sections |
|---|
11.1.15.2. docitem_parameters_entry¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of a parameter entry. |
| «Class» | docitem_parameters_entry – from docitem_sections |
|---|
Public Methods in class docitem_parameters_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.3. docitem_parameters¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a list of parameters |
| «Class» | docitem_parameters – from docitem_sections |
|---|
Public Methods in class docitem_parameters
Signature |
sdv.doc.waterloo.docitem_sections.docitem_parameters.parse(
tr: tracer
entries: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Terminology |
Parameter entry Describes a docstring subtree consisting of a string valued identifier and a list of free-form description lines: |
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
A docstring subtree representing a list of parameter entries. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_parameters.parse – from docitem_sections |
|---|
11.1.15.4. docitem_raises_entry¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of an exception entry. |
| «Class» | docitem_raises_entry – from docitem_sections |
|---|
Public Methods in class docitem_raises_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.5. docitem_raises¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a list of exceptions |
| «Class» | docitem_raises – from docitem_sections |
|---|
Public Methods in class docitem_raises
Signature |
sdv.doc.waterloo.docitem_sections.docitem_raises.parse(
tr: tracer
entries: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Terminology |
Exception entry Describes a docstring subtree consisting of a string valued qualified identifier and a list of free-form description lines: |
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
A sequence of exception entries, |
Returns |
Must return |
Raises |
|
| «Method» | docitem_raises.parse – from docitem_sections |
|---|
11.1.15.6. docitem_derived_from¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a Derived_from section. |
| «Class» | docitem_derived_from – from docitem_sections |
|---|
Public Methods in class docitem_derived_from
Signature |
sdv.doc.waterloo.docitem_sections.docitem_derived_from.parse(
tr: tracer
bases: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
base |
| «Inherited_method» | docitem_derived_from.parse – from docitem_sections |
|---|
11.1.15.7. docitem_factory_functions¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a list of text lines describing the factory function. |
| «Class» | docitem_factory_functions – from docitem_sections |
|---|
Public Methods in class docitem_factory_functions
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.8. docitem_factory¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a Factory. |
| «Class» | docitem_factory – from docitem_sections |
|---|
Public Methods in class docitem_factory
Signature |
sdv.doc.waterloo.docitem_sections.docitem_factory.parse(
tr: tracer
functions: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of factory function sections. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_factory.parse – from docitem_sections |
|---|
11.1.15.9. docitem_definitions_entry¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of an definition entry. |
| «Class» | docitem_definitions_entry – from docitem_sections |
|---|
Public Methods in class docitem_definitions_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.10. docitem_inherited_defitems¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of an inherited defitem. |
| «Class» | docitem_inherited_defitems – from docitem_sections |
|---|
Public Methods in class docitem_inherited_defitems
11.1.15.11. docitem_definitions¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Public methods |
|
Method overview |
Parse a sequence of definition entries |
| «Class» | docitem_definitions – from docitem_sections |
|---|
Public Methods in class docitem_definitions
Signature |
sdv.doc.waterloo.docitem_sections.docitem_definitions.parse(
tr: tracer
entries: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
A sequence of definition entries. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_definitions.parse – from docitem_sections |
|---|
11.1.15.12. docitem_terminology_entry¶
Preamble |
normative sections
|
Terminology |
Terminology entry Describes a docstring subtree consisting of a string valued qualified identifier and a list of free-form description lines: |
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of an terminology entry. |
| «Class» | docitem_terminology_entry – from docitem_sections |
|---|
Public Methods in class docitem_terminology_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.13. docitem_terminology¶
Preamble |
normative sections
|
Description |
A Terminology section describes natural language expressions informatively. As opposed to a Definitions section, it is never normative and does not contain normativity keywords. |
Contract |
general
constructor
|
Public methods |
|
Method overview |
Parse a sequence of terminology entries |
| «Class» | docitem_terminology – from docitem_sections |
|---|
Public Methods in class docitem_terminology
Signature |
sdv.doc.waterloo.docitem_sections.docitem_terminology.parse(
tr: tracer
entries: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
A sequence of terminology entries. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_terminology.parse – from docitem_sections |
|---|
11.1.15.14. docitem_description¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Description |
A free-form section which informatively describes the purpose of a module, class or callable. |
Derived from |
|
Public methods |
|
Method overview |
Parse a list of description lines. |
| «Class» | docitem_description – from docitem_sections |
|---|
Public Methods in class docitem_description
Signature |
sdv.doc.waterloo.docitem_sections.docitem_description.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The description lines. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_description.parse – from docitem_sections |
|---|
11.1.15.15. docitem_notes_entry¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse a list of text lines of the note. |
| «Class» | docitem_notes_entry – from docitem_sections |
|---|
Public Methods in class docitem_notes_entry
Signature |
sdv.doc.waterloo.docitem_base.docitem_free_text_entry_base.parse(
tr: tracer
lines: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a list of free-form strings representing the content of any of the sections listet in section Contract.General. |
Returns |
Must return |
Raises |
|
| «Method» | docitem_free_text_entry_base.parse – from docitem_base |
|---|
11.1.15.16. docitem_notes¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Parse the content of a section Notes. |
| «Class» | docitem_notes – from docitem_sections |
|---|
Public Methods in class docitem_notes
Signature |
sdv.doc.waterloo.docitem_sections.docitem_notes.parse(
tr: tracer
entries: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Terminology |
Labelled note A labelled note in this context is a pair |
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring subtree to parse, a sequence of labelled notes, like [ |
Returns |
Must return |
Raises |
|
| «Method» | docitem_notes.parse – from docitem_sections |
|---|
11.1.15.17. docitem_see_also¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Derived from |
|
Public methods |
|
Method overview |
Inherited method |
| «Class» | docitem_see_also – from docitem_sections |
|---|
Public Methods in class docitem_see_also
Signature |
sdv.doc.waterloo.docitem_sections.docitem_see_also.parse(
tr: tracer
refs: DocstringSubtree
) -> None
|
Preamble |
normative sections
|
Contract |
general
base |
| «Inherited_method» | docitem_see_also.parse – from docitem_sections |
|---|
11.1.16. Top-level node classes¶
11.1.16.1. docitem_docstring_module¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Factory |
|
Derived from |
|
Public methods |
|
Method overview |
Return the forementioned map from label to constructor. |
| «Class» | docitem_docstring_module – from docitem_docstring |
|---|
Public Methods in class docitem_docstring_module
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_module.dispatch_map(
) -> Dict[str, Type[docitem_base]]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
The dict as described in Contract. |
Raises |
<empty> |
| «Method» | docitem_docstring_module.dispatch_map – from docitem_docstring |
|---|
11.1.16.2. docitem_docstring_class¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Factory |
|
Derived from |
|
Public methods |
|
Method overview |
Return the forementioned map from label to constructor. |
| «Class» | docitem_docstring_class – from docitem_docstring |
|---|
Public Methods in class docitem_docstring_class
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_class.dispatch_map(
) -> Dict[str, Type[docitem_base]]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
The dict as described in Contract. |
Raises |
<empty> |
| «Method» | docitem_docstring_class.dispatch_map – from docitem_docstring |
|---|
11.1.16.3. docitem_docstring_method¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Factory |
|
Derived from |
|
Public methods |
|
Method overview |
Return the forementioned map from label to constructor. |
| «Class» | docitem_docstring_method – from docitem_docstring |
|---|
Public Methods in class docitem_docstring_method
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_method.dispatch_map(
) -> Dict[str, Type[docitem_base]]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
The dict as described in Contract. |
Raises |
<empty> |
| «Method» | docitem_docstring_method.dispatch_map – from docitem_docstring |
|---|
11.1.16.4. docitem_docstring_inherited_method¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Factory |
|
Derived from |
|
Public methods |
|
Method overview |
Return the forementioned map from label to constructor. |
| «Class» | docitem_docstring_inherited_method – from docitem_docstring |
|---|
Public Methods in class docitem_docstring_inherited_method
Signature |
sdv.doc.waterloo.docitem_docstring.docitem_docstring_inherited_method.dispatch_map(
) -> Dict[str, Type[docitem_base]]
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
<empty> |
Returns |
The dict as described in Contract. |
Raises |
<empty> |
| «Method» | docitem_docstring_inherited_method.dispatch_map – from docitem_docstring |
|---|
11.1.17. Factories¶
11.1.17.1. make_docitem_tree¶
Signature |
sdv.doc.waterloo.docitem_docstring.make_docitem_tree(
tr: tracer
doc_txt: str
) -> docitem_docstring_base
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The tracer for collecting diagnostics.
The docstring to parse |
Returns |
Must return the docitem node instance containing the AST |
Raises |
|
Notes |
Last review 2026-01-22 |
| «Function» | make_docitem_tree – from docitem_docstring |
|---|
11.2. Module docitem_convert¶
Preamble |
normative sections
scope
|
Contract |
general
|
Public functions |
to_node_legend_json, to_node_docstring_tree_json, to_node_signature_json, to_string_md, build_node_json |
Public types |
Type Alias for Dict[str, ForwardRef(‘WtrlJsonNode_t’)] | List[ForwardRef(‘WtrlJsonNode_t’)] | str | int | float | bool | None Type for JSON nodes. This type must be public because |
| «Module» | sdv.doc.waterloo.docitem_convert |
|---|
11.2.1. Converter functions¶
11.2.1.1. to_node_legend_json¶
Signature |
sdv.doc.waterloo.docitem_convert.to_node_legend_json(
) -> Dict[str, WtrlJsonNode_t]
|
Preamble |
normative sections
scope
status
|
Contract |
general
|
Parameters |
<empty> |
Returns |
Mapping of role-name -> human-readable description. |
Raises |
<empty> |
| «Function» | to_node_legend_json – from docitem_convert |
|---|
11.2.1.2. to_node_docstring_tree_json¶
Signature |
sdv.doc.waterloo.docitem_convert.to_node_docstring_tree_json(
tree: DocstringTree
flavour: Flavour
) -> WtrlJsonNode_t
|
Preamble |
normative sections
scope
status
|
Contract |
general
requires
|
Notes |
Details The docstring tree is rendered exactly as nested JSON arrays; no additional restructuring is performed. |
Parameters |
The tree to render as string.
The style to render Normativity Keywords in |
Returns |
The JSON node |
Raises |
|
See also |
sdv.doc.waterloo.docitem.Flavour, sdv.doc.waterloo.docitem.Format |
| «Function» | to_node_docstring_tree_json – from docitem_convert |
|---|
11.2.1.3. to_node_signature_json¶
Signature |
sdv.doc.waterloo.docitem_convert.to_node_signature_json(
obj: object
) -> dict[str, WtrlJsonNode_t]
|
Preamble |
normative sections
scope
status
|
Contract |
general
|
Parameters |
The callable whose signature is to be inspected and rendered. |
Returns |
The generated JSON node |
Raises |
|
Notes |
Standard values for “kind” Derived from |
| «Function» | to_node_signature_json – from docitem_convert |
|---|
11.2.1.4. build_node_json¶
Signature |
sdv.doc.waterloo.docitem_convert.build_node_json(
node_docstring: docitem_docstring_base
flavour: Flavour
) -> WtrlJsonNode_t
|
Preamble |
normative sections
scope
status
|
Contract |
general
requires
|
Parameters |
The AST node
Normativity Keyword style. |
Returns |
The JSON node, a |
Raises |
|
| «Function» | build_node_json – from docitem_convert |
|---|
11.2.1.5. to_string_md¶
Signature |
sdv.doc.waterloo.docitem_convert.to_string_md(
tree: DocstringTree
flavour: Flavour = <Flavour.MARKDOWN: 2>
headings: bool = True
) -> str
|
Preamble |
normative sections
scope
status
|
Contract |
general
requires
|
Parameters |
The docstring tree to render.
The formatting style for normativity tokens.
If |
Returns |
A Markdown string. |
Raises |
|
See also |
sdv.doc.waterloo.docitem.Flavour, sdv.doc.waterloo.docitem.Format |
| «Function» | to_string_md – from docitem_convert |
|---|
11.3. Module docitem_genutil¶
Preamble |
normative sections
scope
|
Contract |
general
|
Description |
This module is intended for IDE-extension workflows. A typical use case is a VS Code context-menu action on a |
Public functions |
parse_source_fragment, infer_docstring_profile, parse_signature_fragment, generate_minimal_docstring, generate_full_docstring, generate_minimal_docstring_from_node, generate_full_docstring_from_node |
Notes |
Important JSON templates for minimal and full docstring templates can be generated by means of |
| «Module» | sdv.doc.waterloo.docitem_genutil |
|---|
11.3.1. parse_source_fragment¶
Signature |
sdv.doc.waterloo.docitem_genutil.parse_source_fragment(
profile: Profile
source_fragment: str
) -> ast.AST | None
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Profile used for node-type validation.
Source fragment containing a class/function/method header (or small stub). Ignored if |
Returns |
|
Raises |
|
| «Function» | parse_source_fragment – from docitem_genutil |
|---|
11.3.2. infer_docstring_profile¶
Signature |
sdv.doc.waterloo.docitem_genutil.infer_docstring_profile(
obj: object
) -> Profile
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Object to inspect. |
Returns |
|
Raises |
|
Notes |
Result The |
| «Function» | infer_docstring_profile – from docitem_genutil |
|---|
11.3.3. generate_minimal_docstring¶
Signature |
sdv.doc.waterloo.docitem_genutil.generate_minimal_docstring(
obj: object
profile: Profile | None = None
) -> str
|
Preamble |
normative sections
status
scope
|
Contract |
general
ensures
|
Parameters |
Object for which the docstring template is generated.
Optional explicit profile (`module`, `class`, `function`, `method`). If |
Returns |
Generated minimal docstring template. |
Raises |
|
| «Function» | generate_minimal_docstring – from docitem_genutil |
|---|
11.3.4. generate_full_docstring¶
Signature |
sdv.doc.waterloo.docitem_genutil.generate_full_docstring(
obj: object
profile: Profile | None = None
) -> str
|
Preamble |
normative sections
status
scope
|
Contract |
general
ensures
|
Parameters |
Object for which the docstring template is generated.
Optional explicit profile (`module`, `class`, `function`, `method`). If |
Returns |
Generated full docstring template. |
Raises |
|
| «Function» | generate_full_docstring – from docitem_genutil |
|---|
11.3.5. generate_minimal_docstring_from_node¶
Signature |
sdv.doc.waterloo.docitem_genutil.generate_minimal_docstring_from_node(
profile: Profile
node: ast.AST | None
) -> str
|
Preamble |
normative sections
status
scope
|
Contract |
general
|
Parameters |
Target profile (`module`, `class`, `function`, `method`).
Parsed AST node for function/method generation. May be |
Returns |
Generated minimal docstring template. |
Raises |
|
| «Function» | generate_minimal_docstring_from_node – from docitem_genutil |
|---|
11.3.6. generate_full_docstring_from_node¶
Signature |
sdv.doc.waterloo.docitem_genutil.generate_full_docstring_from_node(
profile: Profile
node: ast.AST | None
) -> str
|
Preamble |
normative sections
status
scope
|
Contract |
general
|
Parameters |
Target profile (`module`, `class`, `function`, `method`).
Parsed AST node for function/method generation. May be |
Returns |
Generated full docstring template. |
Raises |
|
| «Function» | generate_full_docstring_from_node – from docitem_genutil |
|---|
11.4. Pygments Lexer¶
Preamble |
normative sections
|
Definitions |
Pos_Role_Substring_Triple A tuple (
|
Contract |
general
|
Public classes |
|
Public constants |
A regular expression pattern that matches section names allowed or mandatory in the “normative_sections” subsection of the Preamble. This expression is governed by the normative rules and must be kept up to date. Mandatory : CON-002, CON-005, CON-020, CON-034, CPCL-002, CPCON-002, CPMT-002, CPTYP-002, CPVAR-002, DEF-002, DER-004, FAC-009, MPCL-002, MPCON-002, MPFN-002, MPTYP-002, MPVAR-002, PAR-002, RAI-002, RET-002. Accepted : DESC-002, SEE-011. Refused : NOTE-002, PRE-002, TERM-002. |
| «Module» | python_waterloo_lexer |
|---|
11.4.1. PythonWaterlooLexer¶
Preamble |
normative sections
|
Contract |
general
constructor
|
Public methods |
highlight_docstring, highlight_line, looks_like_waterloo_docstring, has_mixed_indentation, analyse_text, get_tokens_unprocessed |
| «Class» | PythonWaterlooLexer – from python_waterloo_lexer |
|---|
Public Methods in class PythonWaterlooLexer
Signature |
python_waterloo_lexer.PythonWaterlooLexer.highlight_docstring(
base: int
text: str
) -> Iterable[tuple[int, object, str]]
|
Preamble |
normative sections
|
Definitions |
:wtrl_dfn:`Pos_Role_Substring_Triple` |
Contract |
general
|
Parameters |
The base index for token positions in the original text.
The docstring text to analyze and tokenize. |
Returns |
An iterable of Pos_Role_Substring_Triple tuples for the given docstring. |
Raises |
|
| «Method» | PythonWaterlooLexer.highlight_docstring – from python_waterloo_lexer |
|---|
Signature |
python_waterloo_lexer.PythonWaterlooLexer.highlight_line(
base: int
line: str
) -> Iterable[tuple[int, object, str]]
|
Preamble |
normative sections
|
Definitions |
:wtrl_dfn:`Pos_Role_Substring_Triple` |
Contract |
general
|
Parameters |
The base index for token positions in the original text.
The line of text to analyze and tokenize. |
Returns |
An iterable of Pos_Role_Substring_Triple tuples for the given line. |
Raises |
|
| «Method» | PythonWaterlooLexer.highlight_line – from python_waterloo_lexer |
|---|
Signature |
@staticmethod
python_waterloo_lexer.PythonWaterlooLexer.looks_like_waterloo_docstring(
text: str
) -> bool
|
Preamble |
normative sections
scope
|
Description |
This method performs a heuristic analysis of the input text to determine if it resembles a Waterloo-docstring. For a full and exact validation use the tool |
Contract |
general
|
Parameters |
The string to analyze |
Returns |
|
Raises |
|
| «Method» | PythonWaterlooLexer.looks_like_waterloo_docstring – from python_waterloo_lexer |
|---|
Signature |
@staticmethod
python_waterloo_lexer.PythonWaterlooLexer.has_mixed_indentation(
text: str
) -> bool
|
Preamble |
normative sections
|
Contract |
general
|
Parameters |
The string to analyze for mixed indentation. |
Returns |
|
Raises |
|
| «Method» | PythonWaterlooLexer.has_mixed_indentation – from python_waterloo_lexer |
|---|
Signature |
pygments.util.make_analysator.<locals>.text_analyse(
text: Any
) -> Any
|
Preamble |
normative sections
|
Description |
This method is called by Pygments during lexer selection to prioritize the PythonWaterlooLexer over the standard PythonLexer. It analyzes the input text for patterns indicative of Waterloo-docstrings, such as the presence of “Preamble:” and “Contract:” sections, ensuring that files containing structured docstrings are highlighted appropriately by this specialized lexer. |
Contract |
general
|
Parameters |
The input text to analyze for Waterloo-docstring characteristics. |
Returns |
A float value: 1.0 if the text is identified as a Waterloo-docstring, 0.0 otherwise. |
Raises |
|
| «Function» | make_analysator.<locals>.text_analyse – from util |
|---|
Signature |
python_waterloo_lexer.PythonWaterlooLexer.get_tokens_unprocessed(
text: str
) -> Iterator[tuple[int, object, str]]
|
Preamble |
normative sections
scope
|
Definitions |
:wtrl_dfn:`Pos_Role_Substring_Triple` |
Description |
This is the core tokenization method that Pygments calls to obtain syntax highlighting tokens. It iterates over tokens from the parent PythonLexer and intercepts docstrings (String.Doc tokens) to apply Waterloo-specific highlighting rules. This method is the entry point for all tokenization and determines the highlighting of the entire source code. |
Contract |
general
|
Parameters |
The input text to tokenize. |
Returns |
An iterable of Pos_Role_Substring_Triple tuples. |
Raises |
|
| «Method» | PythonWaterlooLexer.get_tokens_unprocessed – from python_waterloo_lexer |
|---|
11.5. Output layer HTML5¶
Preamble |
normative sections
scope
|
Contract |
general
|
Public functions |
|
Function overview |
Main entry point for the `waterlint render-html5` subcommand. This function takes in a list of input JSON document paths, merges them, and generates a self-contained HTML5 file that presents the documented objects in a clear and navigable format. The function also handles error reporting via the provided tracer instance and supports various customization options for the output HTML.
Render a single HTML5 document from the merged JSON data.
Construct and return the argparse subparser for the render-html5 command. |
| «Module» | sdv.doc.waterloo.waterlint_render_html5 |
|---|
Signature |
sdv.doc.waterloo.waterlint_render_html5.render_html5(
args: argparse.Namespace
) -> int
|
Preamble |
normative sections
scope
|
Contract |
general
|
Parameters |
Namespace containing the parsed render-html5 command line options. must provide the attributes expected by this command:
|
Returns |
Must return 0 on success, non-zero on validation or processing errors. |
Raises |
<empty> |
| «Function» | render_html5 – from waterlint_render_html5 |
|---|