vprusso/toqito

docs: add missing Raises: sections to function docstrings

Offen

#1.888 geöffnet am 25.07.2026

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Python (154 Forks)github user discovery
documentationgood first issue

Repository-Metriken

Stars
 (277 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Many functions raise ValueError/TypeError on bad input but do not document it in a Raises: docstring section. Adding these sections makes the API self-documenting and surfaces the conditions in the rendered docs.

What to do

For a function that raises but has no Raises: section, add one listing each exception and the condition that triggers it, in the Google style used elsewhere in the codebase:

    Raises:
        ValueError: If `dim` does not evenly divide the input.

Good targets (pick a few per PR):

  • toqito/channel_ops/kraus_to_choi.py
  • toqito/channel_props/channel_dim.py
  • toqito/channels/amplitude_damping.py, bitflip.py, phase_damping.py, ldot_channel.py
  • toqito/matrices/cyclic_permutation.py

List each raise and its condition with:

git grep -nE "raise (Value|Type)Error" toqito/<file>

Verifying

uv sync --group docs
cd docs && uv run mkdocs build

Confirm the new Raises: section renders on the function's docs page.

Contributor Guide