# HG changeset patch
# User Frederic Chapoton
# Date 1364758130 -7200
# Node ID 7607282f2929d85df5beabb9573ab3bdf2c9af43
# Parent 637ceed9ae5215027c8002eddeaeac542d6698c2
trac #8703 review patch, small changes
diff --git a/sage/combinat/abstract_tree.py b/sage/combinat/abstract_tree.py
--- a/sage/combinat/abstract_tree.py
+++ b/sage/combinat/abstract_tree.py
@@ -1,4 +1,5 @@
-"""
+# -*- coding: utf-8 -*-
+r"""
Abstract Recursive Trees
The purpose of this class is to help implement trees with a specific structure
@@ -59,7 +60,7 @@ incoherent with the data structure.
**Authors**
- Florent Hivert (2010-2011): initial revision
-- Frederic Chapoton (2011): contributed some methods
+- Frédéric Chapoton (2011): contributed some methods
"""
from sage.structure.list_clone import ClonableArray
@@ -425,7 +426,7 @@ class AbstractClonableTree(AbstractTree)
` also extend
:class:`sage.structure.list_clone.ClonableElement`, which requires it.
- It should be overriden in subclass is order to chech that the
+ It should be overriden in subclass in order to check that the
invariant of the kind of tree holds (eg: two children for binary
trees).
@@ -457,7 +458,7 @@ class AbstractClonableTree(AbstractTree)
EXAMPLES:
- Trying to modify a non mutable tree raise an error::
+ Trying to modify a non mutable tree raises an error::
sage: x = OrderedTree([])
sage: x[0] = OrderedTree([[]])
@@ -473,7 +474,7 @@ class AbstractClonableTree(AbstractTree)
sage: x
[[[]], [[]]]
- One can also substitute at any depths::
+ One can also substitute at any depth::
sage: y = OrderedTree(x)
sage: with x.clone() as x:
@@ -541,9 +542,9 @@ class AbstractClonableTree(AbstractTree)
- ``idx`` -- a valid path in ``self`` identifying a node
- ..note::
+ .. NOTE::
- The default implementation here assume that the container of the
+ The default implementation here assumes that the container of the
node inherits from
:class:`~sage.structure.list_clone.ClonableArray`.
@@ -600,7 +601,7 @@ class AbstractLabelledTree(AbstractTree)
``LabelledOrderedTrees()`` and ``T.parent().unlabelled_trees()`` is
``OrderedTrees()``
- * In the same vein, the class of ``T`` should contains an attribute
+ * In the same vein, the class of ``T`` should contain an attribute
``_Unlabelled`` which should be the class for the corresponding
unlabelled trees.
@@ -659,7 +660,7 @@ class AbstractLabelledTree(AbstractTree)
- ``path`` -- None (default) or a path (list or tuple of children index
in the tree)
- OUTPUT: the label of the subtree at indexed by ``path``
+ OUTPUT: the label of the subtree indexed by ``path``
EXAMPLES::
@@ -769,7 +770,7 @@ class AbstractLabelledTree(AbstractTree)
sage: LabelledBinaryTree([[],[[],[]]], label = 25).__hash__() #random
8544617749928727644
- We check that the hash value depend on the value of the labels of the
+ We check that the hash value depends on the value of the labels of the
subtrees::
sage: LBT = LabelledBinaryTree
@@ -815,7 +816,7 @@ class AbstractLabelledTree(AbstractTree)
.. WARNING::
At this time, the output makes sense only if ``self`` is a
- labelled binary tree with no repeated labels and no "None"
+ labelled binary tree with no repeated labels and no ``None``
labels.
EXAMPLES::
@@ -845,7 +846,7 @@ class AbstractLabelledClonableTree(Abstr
"""
Abstract Labelled Clonable Tree
- This class take care of modification for the label by the clone protocol.
+ This class takes care of modification for the label by the clone protocol.
.. NOTE:: Due to the limitation of Cython inheritance, one cannot inherit
here from :class:`ClonableArray`, because it would prevent us to
@@ -879,7 +880,7 @@ class AbstractLabelledClonableTree(Abstr
sage: t
3[None[], None[None[], None[]]]
- This also work for binary trees::
+ This also works for binary trees::
sage: bt = LabelledBinaryTree([[],[]])
sage: bt.set_root_label(3)
diff --git a/sage/combinat/binary_tree.py b/sage/combinat/binary_tree.py
--- a/sage/combinat/binary_tree.py
+++ b/sage/combinat/binary_tree.py
@@ -245,8 +245,8 @@ class BinaryTree(AbstractClonableTree, C
The actual canonical labelling is currently unspecified. However, it
is guaranteed to have labels in `1...n` where `n` is the number of
- node of the tree. Moreover, two (unlabelled) trees compare as equal if
- and only if they canonical labelled trees compare as equal.
+ nodes of the tree. Moreover, two (unlabelled) trees compare as equal if
+ and only if their canonical labelled trees compare as equal.
EXAMPLES::
@@ -323,7 +323,7 @@ class BinaryTree(AbstractClonableTree, C
.. NOTE:: ``self`` must be in a mutable state.
- .. seealso::
+ .. SEEALSO::
:meth:`make_node `
EXAMPLES::
@@ -406,8 +406,8 @@ class BinaryTree(AbstractClonableTree, C
The number of pairs `(t_1, t_2)` of binary trees of size `n` such that
the canopee of `t_1` is the complementary of the canopee of `t_2` is
- also the number of Baxter permutations (see [DG]_, see also sequences
- A001181 in Sloane's database). We check this in small cases::
+ also the number of Baxter permutations (see [DG]_, see
+ also :oeis:`A001181`). We check this in small cases::
sage: [len([(u,v) for u in BinaryTrees(n) for v in BinaryTrees(n)
... if map(lambda x:1-x, u.canopee()) == v.canopee()])
@@ -486,7 +486,7 @@ class BinaryTrees(UniqueRepresentation,
.. NOTE:: this in a factory class whose constructor returns instances of
subclasses.
- .. NOTE:: the fact that OrderedTrees is a class instead a simple callable
+ .. NOTE:: the fact that OrderedTrees is a class instead of a simple callable
is an implementation detail. It could be changed in the future
and one should not rely on it.
"""
@@ -693,7 +693,7 @@ class BinaryTrees_size(BinaryTrees):
def cardinality(self):
"""
- The cardinality of self
+ The cardinality of ``self``
This is a Catalan number.
@@ -794,7 +794,7 @@ class LabelledBinaryTree(AbstractLabelle
def __classcall_private__(cls, *args, **opts):
"""
Ensure that trees created by the sets and directly are the same and
- that they are instance of :class:`LabelledTree`
+ that they are instances of :class:`LabelledTree`
TESTS::
@@ -813,7 +813,7 @@ class LabelledBinaryTree(AbstractLabelle
"""
The automatic parent of the element of this class
- When calling the constructor of an element of this class, one need a
+ When calling the constructor of an element of this class, one needs a
parent. This class attribute specifies which parent is used.
EXAMPLES::
diff --git a/sage/combinat/ordered_tree.py b/sage/combinat/ordered_tree.py
--- a/sage/combinat/ordered_tree.py
+++ b/sage/combinat/ordered_tree.py
@@ -28,7 +28,7 @@ class OrderedTree(AbstractClonableTree,
An ordered tree is constructed from a node called the root on which one
has grafted a possibly empty list of trees. There is a total order on the
- children of a node which is given by the order of the element in the
+ children of a node which is given by the order of the elements in the
list. Note that there is no empty ordered tree.
INPUT:
@@ -64,7 +64,7 @@ class OrderedTree(AbstractClonableTree,
:class:`sage.structure.list_clone.ClonableList`. So that they can be
modified using the clone protocol:
- Trying to modify a non mutable tree raise an error::
+ Trying to modify a non mutable tree raises an error::
sage: tt1[1] = tt2
Traceback (most recent call last):
@@ -168,7 +168,7 @@ class OrderedTree(AbstractClonableTree,
def __classcall_private__(cls, *args, **opts):
"""
Ensure that trees created by the enumerated sets and directly
- are the same and that they are instance of :class:`OrderedTree`
+ are the same and that they are instances of :class:`OrderedTree`
TESTS::
@@ -199,7 +199,7 @@ class OrderedTree(AbstractClonableTree,
"""
The automatic parent of the element of this class
- When calling the constructor of an element of this class, one need a
+ When calling the constructor of an element of this class, one needs a
parent. This class attribute specifies which parent is used.
EXAMPLES::
@@ -289,10 +289,10 @@ class OrderedTrees(UniqueRepresentation,
sage: OrderedTrees(2)
Ordered trees of size 2
- .. NOTE:: this in a factory class whose constructor returns instances of
+ .. NOTE:: this is a factory class whose constructor returns instances of
subclasses.
- .. NOTE:: the fact that OrderedTrees is a class instead a simple callable
+ .. NOTE:: the fact that OrderedTrees is a class instead of a simple callable
is an implementation detail. It could be changed in the future
and one should not rely on it.
"""
@@ -578,7 +578,7 @@ class OrderedTrees_size(OrderedTrees):
sage: S([]) # indirect doctest
Traceback (most recent call last):
...
- ValueError: Wrong number of nodes
+ ValueError: wrong number of nodes
sage: S = OrderedTrees(1) # indirect doctest
sage: S([])
@@ -586,7 +586,7 @@ class OrderedTrees_size(OrderedTrees):
"""
res = self.element_class(self._parent_for, *args, **keywords)
if res.node_number() != self._size:
- raise ValueError, "Wrong number of nodes"
+ raise ValueError("wrong number of nodes")
return res
@@ -595,7 +595,7 @@ class LabelledOrderedTree(AbstractLabell
Labelled ordered trees
A labelled ordered tree is an ordered tree with a label attached at each
- node
+ node.
INPUT:
@@ -620,7 +620,7 @@ class LabelledOrderedTree(AbstractLabell
def __classcall_private__(cls, *args, **opts):
"""
Ensure that trees created by the sets and directly are the same and
- that they are instance of :class:`LabelledOrderedTree`
+ that they are instances of :class:`LabelledOrderedTree`
TESTS::
@@ -639,7 +639,7 @@ class LabelledOrderedTree(AbstractLabell
"""
The automatic parent of the element of this class
- When calling the constructor of an element of this class, one need a
+ When calling the constructor of an element of this class, one needs a
parent. This class attribute specifies which parent is used.
EXAMPLES::