diff --git a/python/tskit/combinatorics.py b/python/tskit/combinatorics.py index a1eba56e06..03ca06020f 100644 --- a/python/tskit/combinatorics.py +++ b/python/tskit/combinatorics.py @@ -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) @@ -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) @@ -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): diff --git a/python/tskit/trees.py b/python/tskit/trees.py index 168cead7e0..e8191dcd85 100644 --- a/python/tskit/trees.py +++ b/python/tskit/trees.py @@ -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. @@ -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: