Ticket #8326: trac_8326-sphinx_posets.patch

File trac_8326-sphinx_posets.patch, 2.0 KB (added by mpatel, 10 years ago)

Work around Sphinx poset warnings. sage repo.

  • sage/combinat/posets/poset_examples.py

    # HG changeset patch
    # User Mitesh Patel <qed777@gmail.com>
    # Date 1266818812 28800
    # Node ID 530e9a36c95a9bde2eb84bf1110366ac02d49c0e
    # Parent  01baeb94ad88583b52a6eb67297daf8790ca2561
    #8326: Work around Sphinx poset warnings
    
    diff --git a/sage/combinat/posets/poset_examples.py b/sage/combinat/posets/poset_examples.py
    a b Some examples of posets and lattices. 
    1717#                  http://www.gnu.org/licenses/
    1818#*****************************************************************************
    1919
    20 from random import random
     20import random
    2121from sage.combinat.permutation import Permutations, Permutation
    2222from sage.combinat.posets.posets import Poset, Posets_all, FinitePosets_n
    2323from sage.combinat.posets.lattices import LatticePoset
    class PosetsGenerator(object): 
    225225        D.add_vertices(range(n))
    226226        for i in range(n):
    227227            for j in range(n):
    228                 if random() < p:
     228                if random.random() < p:
    229229                    D.add_edge(i,j)
    230230                    if not D.is_directed_acyclic():
    231231                        D.delete_edge(i,j)
  • sage/combinat/posets/posets.py

    diff --git a/sage/combinat/posets/posets.py b/sage/combinat/posets/posets.py
    a b from sage.rings.integer import Integer 
    2424from sage.graphs.all import DiGraph
    2525from sage.combinat.posets.hasse_diagram import HasseDiagram
    2626from sage.combinat.posets.elements import *
    27 from random import random
     27import random
    2828from sage.combinat.combinat import CombinatorialClass, InfiniteAbstractCombinatorialClass
    2929
    3030def Poset(data=None, element_labels=None, cover_relations=False):
    class FinitePoset(ParentWithBase): 
    13641364        elements = []
    13651365        p = float(p)
    13661366        for v in self:
    1367             if random() <= p:
     1367            if random.random() <= p:
    13681368                elements.append(v)
    13691369        return self.subposet(elements)
    13701370