From 2703fc19e484759866729f89d1ccd19c9ee1308f Mon Sep 17 00:00:00 2001 From: Yan Wong Date: Fri, 28 Jul 2023 10:25:16 +0100 Subject: [PATCH] Correct doc instances of "raises" As per sphinx docs --- python/tskit/intervals.py | 2 +- python/tskit/provenance.py | 4 ++-- python/tskit/trees.py | 17 ++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/python/tskit/intervals.py b/python/tskit/intervals.py index ef371531e0..0c78c50b5b 100644 --- a/python/tskit/intervals.py +++ b/python/tskit/intervals.py @@ -265,7 +265,7 @@ def find_index(self, x: float) -> int: :param float x: The position to search. :return: The index of the interval containing this point. :rtype: int - :raises: KeyError if the position is not contained in any of the intervals. + :raises KeyError: if the position is not contained in any of the intervals. """ if x < 0 or x >= self.sequence_length: raise KeyError(f"Position {x} out of bounds") diff --git a/python/tskit/provenance.py b/python/tskit/provenance.py index 82fb19518a..bc88e29f1a 100644 --- a/python/tskit/provenance.py +++ b/python/tskit/provenance.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2018-2020 Tskit Developers +# Copyright (c) 2018-2023 Tskit Developers # Copyright (c) 2016-2017 University of Oxford # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -117,7 +117,7 @@ def validate_provenance(provenance): :param dict provenance: The dictionary representing a JSON document to be validated against the schema. - :raises: :class:`tskit.ProvenanceValidationError` + :raises ProvenanceValidationError: if the schema is not valid. """ schema = get_schema() try: diff --git a/python/tskit/trees.py b/python/tskit/trees.py index 6c2fbb05a5..177f357306 100644 --- a/python/tskit/trees.py +++ b/python/tskit/trees.py @@ -878,7 +878,7 @@ def unrank(num_leaves, rank, *, span=1, branch_length=1) -> Tree: from which the tree is taken will have its :attr:`~tskit.TreeSequence.sequence_length` equal to ``span``. :param: float branch_length: The minimum length of a branch in this tree. - :raises: ValueError: If the given rank is out of bounds for trees + :raises ValueError: If the given rank is out of bounds for trees with ``num_leaves`` leaves. """ rank_tree = combinatorics.RankTree.unrank(num_leaves, rank) @@ -1600,7 +1600,7 @@ def root(self): :return: The root node. :rtype: int - :raises: :class:`ValueError` if this tree contains more than one root. + :raises ValueError: if this tree contains more than one root. """ if self.has_multiple_roots: raise ValueError("More than one root exists. Use tree.roots instead") @@ -5211,10 +5211,10 @@ def haplotypes( *Deprecated in 0.3.0. Use ``isolated_as_missing``, but inverting value. Will be removed in a future version* :rtype: collections.abc.Iterable - :raises: TypeError if the ``missing_data_character`` or any of the alleles + :raises TypeError: if the ``missing_data_character`` or any of the alleles at a site are not a single ascii character. - :raises: ValueError - if the ``missing_data_character`` exists in one of the alleles + :raises ValueError: if the ``missing_data_character`` exists in one of the + alleles """ if impute_missing_data is not None: warnings.warn( @@ -5521,10 +5521,9 @@ def alignments( :return: An iterator over the alignment strings for specified samples in this tree sequence, in the order given in ``samples``. :rtype: collections.abc.Iterable - :raises: ValueError - if any genome coordinate in this tree sequence is not discrete, - or if the ``reference_sequence`` is not of the correct length. - :raises: TypeError if any of the alleles at a site are not a + :raises ValueError: if any genome coordinate in this tree sequence is not + discrete, or if the ``reference_sequence`` is not of the correct length. + :raises TypeError: if any of the alleles at a site are not a single ascii character. """ if not self.discrete_genome: