vprusso/toqito

docs: add missing Raises: sections to function docstrings

Fermée

#1 888 ouverte le 25 juil. 2026

 (1 commentaire) (0 réaction) (0 personne assignée)Python (154 forks)github user discovery
documentationgood first issue

Métriques du dépôt

Stars
 (277 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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.

Guide contributeur