Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions python/tskit/combinatorics.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ def all_trees(num_leaves, span=1):

:param int num_leaves: The number of leaves of the tree to generate.
:param float span: The genomic span of each returned tree.
:rtype: tskit.Tree
:return: An iterator yielding a :class:`tskit.Tree` for each labelled tree.
:rtype: :class:`collections.abc.Iterator`
"""
for rank_tree in RankTree.all_labelled_trees(num_leaves):
yield rank_tree.to_tsk_tree(span=span)
Expand All @@ -679,7 +680,8 @@ def all_tree_shapes(num_leaves, span=1):

:param int num_leaves: The number of leaves of the tree to generate.
:param float span: The genomic span of each returned tree.
:rtype: tskit.Tree
:return: An iterator yielding a :class:`tskit.Tree` for each shape.
:rtype: :class:`collections.abc.Iterator`
"""
for rank_tree in RankTree.all_unlabelled_trees(num_leaves):
default_labelling = rank_tree.label_unrank(0)
Expand All @@ -695,7 +697,8 @@ def all_tree_labellings(tree, span=1):
:param tskit.Tree tree: The tree used to generate
labelled trees of the same shape.
:param float span: The genomic span of each returned tree.
:rtype: tskit.Tree
:return: An iterator yielding a :class:`tskit.Tree` for each labelling.
:rtype: :class:`collections.abc.Iterator`
"""
rank_tree = RankTree.from_tsk_tree(tree)
for labelling in RankTree.all_labellings(rank_tree):
Expand Down
9 changes: 5 additions & 4 deletions python/tskit/trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -5220,8 +5220,8 @@ def trees(
those subtending meaningful topology, set this to 2. This value
is only relevant when trees have multiple roots.
:param bool sample_counts: Deprecated since 0.2.4.
:return: An iterator over the Trees in this tree sequence.
:rtype: collections.abc.Iterable, :class:`Tree`
:return: An iterator over the :class:`Tree` objects in this tree sequence.
:rtype: :class:`collections.abc.Iterator`
"""
# tracked_leaves, leaf_counts and leaf_lists are deprecated aliases
# for tracked_samples, sample_counts and sample_lists respectively.
Expand Down Expand Up @@ -5253,12 +5253,13 @@ def coiterate(self, other, **kwargs):
:meth:`.trees` method when constructing the returned trees.

:return: An iterator returning successive tuples of the form
``(interval, tree_self, tree_other)``. For example, the first item returned
``(interval, tree_self, tree_other)``, with an :class:`Interval` and
two :class:`Tree` objects. For example, the first item returned
will consist of an tuple of the initial interval, the first tree of the
current tree sequence, and the first tree of the ``other`` tree sequence;
the ``.left`` attribute of the initial interval will be 0 and the ``.right``
attribute will be the smallest non-zero breakpoint of the 2 tree sequences.
:rtype: iter(:class:`Interval`, :class:`Tree`, :class:`Tree`)
:rtype: :class:`collections.abc.Iterator`

"""
if self.sequence_length != other.sequence_length:
Expand Down