Skip to content

Commit

Permalink
Correct doc instances of "raises"
Browse files Browse the repository at this point in the history
As per sphinx docs
  • Loading branch information
hyanwong committed Jul 28, 2023
1 parent ab5ef8f commit 2703fc1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/tskit/intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions python/tskit/provenance.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
17 changes: 8 additions & 9 deletions python/tskit/trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2703fc1

Please sign in to comment.