Commits

Volker Braun committed a4426a9

sage-5.10.rc1

  • Participants
  • Parent commits 43349a1

Comments (0)

Files changed (33)

File 14571_inputenc.patch

-# HG changeset patch
-# User Volker Braun <vbraun@stp.dias.ie>
-# Date 1368194204 -3600
-# Node ID 2c4d57eb0571ffd465edb46d43c05592bcee957f
-# Parent  367ea017e5aeebde9531da37f7f949c17001fe67
-Do not use the deprecated utf8x (not in TeXlive 2012 any more)
-
-diff --git a/doc/common/conf.py b/doc/common/conf.py
---- a/doc/common/conf.py
-+++ b/doc/common/conf.py
-@@ -266,20 +266,6 @@
- # See http://sphinx.pocoo.org/config.html#confval-latex_elements
- latex_elements = {}
- 
--# Extended UTF-8 scheme
--latex_elements['inputenc'] = '\\usepackage[utf8x]{inputenc}'
--
--# Prevent Sphinx from by default inserting the following LaTeX
--# declaration into the preamble of a .tex file:
--#
--# \DeclareUnicodeCharacter{00A0}{\nobreakspace}
--#
--# This happens in the file src/sphinx/writers/latex.py in the sphinx
--# spkg.  This declaration is known to result in a failure to build the
--# PDF version of a document in the Sage standard documentation. See
--# ticket #8183 for further information on this issue.
--latex_elements['utf8extra'] = ''
--
- # The paper size ('letterpaper' or 'a4paper').
- #latex_elements['papersize'] = 'letterpaper'
- 
-@@ -299,7 +285,13 @@
- #latex_use_parts = False
- 
- # Additional stuff for the LaTeX preamble.
--latex_elements['preamble'] = '\usepackage{amsmath}\n\usepackage{amssymb}\n'
-+latex_elements['preamble'] = r"""
-+\usepackage{amsmath}
-+\usepackage{amssymb}
-+\usepackage{textcomp}
-+\DeclareUnicodeCharacter{01CE}{\capitalcaron a}
-+\DeclareUnicodeCharacter{0428}{cyrillic Sha}
-+"""
- 
- # Documents to append as an appendix to all manuals.
- #latex_appendices = []

File 14675_convert_relations.patch

+# HG changeset patch
+# User Miguel Marco <mmarco@unizar.es>
+# Date 1370123892 -7200
+# Node ID 7c96167d6f4c42f067dd7e5aa8b645b0750df8a9
+# Parent  9b3e6b467313a8df84543e4cbc882580a9fc0678
+Trac Ticket #14675, convert relations to the free group at quotienting
+
+diff --git a/sage/groups/free_group.py b/sage/groups/free_group.py
+--- a/sage/groups/free_group.py
++++ b/sage/groups/free_group.py
+@@ -617,8 +617,20 @@
+ 
+             sage: F /  [a*b^2*a, b^3]
+             Finitely presented group < a, b | a*b^2*a, b^3 >
++            
++        Relations are converted to the free group, even if they are not
++        elements of it (if possible) ::
++        
++            sage: F1.<a,b,c,d>=FreeGroup()
++            sage: F2.<a,b>=FreeGroup()                                                                                                                                                                                       
++            sage: r=a*b/a                                                                                                                                                                                                    
++            sage: r.parent()                                                                                                                                                                                                 
++            Free Group on generators {a, b}
++            sage: F1/[r]                                                                                                                                                                                                     
++            Finitely presented group < a, b, c, d | a*b*a^-1 >
++
+         """
+         from sage.groups.finitely_presented import FinitelyPresentedGroup
+-        return FinitelyPresentedGroup(self, tuple(relations))
++        return FinitelyPresentedGroup(self, tuple(map(self, relations) ) )
+ 
+     __div__ = quotient

File docbuild_fix.patch

-# HG changeset patch
-# Parent 42ce250238af69aeeb1e3987ec718b53f4087e47
-
-diff --git a/doc/common/sage_autodoc.py b/doc/common/sage_autodoc.py
---- a/doc/common/sage_autodoc.py
-+++ b/doc/common/sage_autodoc.py
-@@ -658,6 +658,7 @@
-         except Exception as err:
-             self.directive.warn('error while formatting signature for '
-                                 '%s: %s' % (self.fullname, err))
-+            raise
-             sig = ''
- 
-         # generate the directive header and options, if applicable
+trac_14232_ppl_doctest_fixes.patch
 trac_14266_ascii_art_13_05_15_EliX-jbp.patch
 trac_14266-ascii_art-review-ts.patch
 trac_14266_terminal_width.patch
 trac_14469_repr_graphics.patch
 trac_13084_ppl_lattice_polygon.patch
 trac_13084_toric_weierstrass.patch
-trac_7477_setup_doc_load.patch
-trac_7477_code.patch
+trac_13084_ppl_cleanup-fc.patch
+trac_13084_weierstrass_cleanup-fc.patch
+trac_13084_misc.patch
+trac_13458_toric_Weierstrass_covering.patch
 trac_6100-basis_homology-ts.patch
-trac_symbolic_bessel_v5.patch
-trac_symbolic_bessel_doctests.patch
-trac_symbolic_bessel_deprecation.patch
 trac_14523_improve_attach.patch
-trac_14649_cython_debug.patch
 trac_14640_refactor_plot_expose.patch
 trac_14640-refactor_plot_expose-review-ts.patch
 trac_14014_libgap_cyclotomic_matrix.patch
 trac_14014_iterator.patch
 trac_14014_misc.patch
 trac_14014-review-ts.patch
+14675_convert_relations.patch
+trac_14674_cleanup_decorator_fc.patch
+trac_14664-type1-fonts.patch
+trac_14682_doctest_fixes.patch
+trac_14015-affine_groups-ts.patch
+trac_14669.patch
+trac_12559_tour_chinese.patch
+trac_14703_infinite_fp_group_check.patch
+trac_14668_bitsets.patch
+trac14524-immutability_decorators.patch
+trac14535-immutable_graphs_vb.patch
 trac_14652_lazify_imports.patch
 trac_14634_fix_includes.patch
-14571_inputenc.patch
 trac_14627_signed_mod_int.patch
-docbuild_fix.patch
-trac_13458_toric_Weierstrass_covering.patch
 trac_3416_elliptic_curve_from_cubic_vb.patch
 trac_3416_jacobians.patch
 trac_3416_fixes.patch
-trac_14587_m2.patch
-trac_14587_doctests.patch
 trac_13736-content-take2.patch
 trac_13736-unit_primpart.patch
-trac_14039_doctest_fixes.patch
-trac_14232_ppl_doctest_fixes.patch
 ppl_reflexive_polytope.patch
 debug_memory_leak.patch
 trac_12892_orbit_closure_morphism.patch
 trac_12900_Demazure_roots.patch
 trac_xxxx_fiber_divisor_graph.patch
 trac_14357_lazy_everywhere.patch
-trac_14015_affine_group.patch
 trac_x_matrix_groups.patch
 trac_xxxx_fan_refinement.patch
 trac_xxxx_effective_cone.patch

File trac14524-immutability_decorators.patch

+# HG changeset patch
+# User Simon King <simon.king@uni-jena.de>
+# Date 1367824644 -7200
+# Node ID c2c82f01b133adc84830765b2bb7499223c95b30
+# Parent  1ddd56f1ce4b9722752064741003a9a540d74abc
+#14524: Decorator for methods requiring mutability or immutability
+
+diff --git a/sage/misc/decorators.py b/sage/misc/decorators.py
+--- a/sage/misc/decorators.py
++++ b/sage/misc/decorators.py
+@@ -92,7 +92,7 @@
+           '        return ret\n'], ...)
+ 
+     Demonstrate that sage_wraps works for non-function callables
+-    (Trac 9919)::
++    (:trac:`9919`)::
+ 
+         sage: def square_for_met(f):
+         ...     @sage_wraps(f)
+@@ -110,7 +110,7 @@
+         sage: t.g.__doc__
+         'My little method'
+ 
+-    The bug described in #11734 is fixed::
++    The bug described in :trac:`11734` is fixed::
+ 
+         sage: def square(f):
+         ...     @sage_wraps(f)
+@@ -121,6 +121,7 @@
+         sage: g = square(f)
+         sage: g(3) # this line used to fail for some people if these command were manually entered on the sage prompt
+         81
++
+     """
+     #TRAC 9919: Workaround for bug in @update_wrapper when used with
+     #non-function callables.
+diff --git a/sage/structure/mutability.pxd b/sage/structure/mutability.pxd
+--- a/sage/structure/mutability.pxd
++++ b/sage/structure/mutability.pxd
+@@ -13,5 +13,5 @@
+ ##########################################################################
+ 
+ cdef class Mutability:
+-    cdef bint _is_immutable
++    cdef public bint _is_immutable
+     cdef _require_mutable_cdef(self)
+diff --git a/sage/structure/mutability.pyx b/sage/structure/mutability.pyx
+--- a/sage/structure/mutability.pyx
++++ b/sage/structure/mutability.pyx
+@@ -71,3 +71,98 @@
+     def __reduce__(self):
+         return Mutability, (self._is_immutable, )
+     
++#################################################################################
++## Method decorators for mutating methods resp. methods that assume immutability
++from sage.misc.decorators import sage_wraps
++
++def require_mutable(f):
++    """
++    A decorator that requires mutability for a method to be called.
++
++    EXAMPLES::
++
++        sage: from sage.structure.mutability import require_mutable, require_immutable
++        sage: class A:
++        ...    def __init__(self, val):
++        ...        self._m = val
++        ...    @require_mutable
++        ...    def change(self, new_val):
++        ...        'change self'
++        ...        self._m = new_val
++        ...    @require_immutable
++        ...    def __hash__(self):
++        ...        'implement hash'
++        ...        return hash(self._m)
++        sage: a = A(5)
++        sage: a.change(6)
++        sage: hash(a)
++        Traceback (most recent call last):
++        ...
++        ValueError: <type 'instance'> instance is mutable, <function __hash__ at ...> must not be called
++        sage: a._is_immutable = True
++        sage: hash(a)
++        6
++        sage: a.change(7)   # indirect doctest
++        Traceback (most recent call last):
++        ...
++        ValueError: <type 'instance'> instance is immutable, <function change at ...> must not be called
++        sage: from sage.misc.sageinspect import sage_getdoc
++        sage: print sage_getdoc(a.change)
++        change self
++
++    AUTHORS:
++
++    - Simon King <simon.king@uni-jena.de>
++    """
++    @sage_wraps(f)
++    def new_f(self, *args,**kwds):
++        if getattr(self,'_is_immutable',False):
++            raise ValueError("%s instance is immutable, %s must not be called"%(type(self), repr(f)))
++        return f(self, *args,**kwds)
++    return new_f
++
++def require_immutable(f):
++    """
++    A decorator that requires mutability for a method to be called.
++
++    EXAMPLES::
++
++        sage: from sage.structure.mutability import require_mutable, require_immutable
++        sage: class A:
++        ...    def __init__(self, val):
++        ...        self._m = val
++        ...    @require_mutable
++        ...    def change(self, new_val):
++        ...        'change self'
++        ...        self._m = new_val
++        ...    @require_immutable
++        ...    def __hash__(self):
++        ...        'implement hash'
++        ...        return hash(self._m)
++        sage: a = A(5)
++        sage: a.change(6)
++        sage: hash(a)   # indirect doctest
++        Traceback (most recent call last):
++        ...
++        ValueError: <type 'instance'> instance is mutable, <function __hash__ at ...> must not be called
++        sage: a._is_immutable = True
++        sage: hash(a)
++        6
++        sage: a.change(7)
++        Traceback (most recent call last):
++        ...
++        ValueError: <type 'instance'> instance is immutable, <function change at ...> must not be called
++        sage: from sage.misc.sageinspect import sage_getdoc
++        sage: print sage_getdoc(a.__hash__)
++        implement hash
++
++    AUTHORS:
++
++    - Simon King <simon.king@uni-jena.de>
++    """
++    @sage_wraps(f)
++    def new_f(self, *args,**kwds):
++        if not getattr(self,'_is_immutable',False):
++            raise ValueError("%s instance is mutable, %s must not be called"%(type(self), repr(f)))
++        return f(self, *args,**kwds)
++    return new_f

File trac14535-immutable_graphs_vb.patch

+# HG changeset patch
+# User Simon King <simon.king@uni-jena.de>
+# Date 1367834112 -7200
+# Node ID f860e66db9cfcf8e519c09f7e108436280943ff8
+# Parent 07f31db75d320c41d6f8883c872723a20906f2e8
+Mutability for graphs
+
+diff --git a/sage/combinat/posets/hasse_diagram.py b/sage/combinat/posets/hasse_diagram.py
+--- a/sage/combinat/posets/hasse_diagram.py
++++ b/sage/combinat/posets/hasse_diagram.py
+@@ -46,14 +46,27 @@
+         Hasse diagram of a poset containing 4 elements
+         sage: TestSuite(H).run()
+     """
++    def __init__(self, *args, **kwds):
++        """
++        Hasse diagrams are immutable digraphs, which is made sure here.
+ 
+-    # Hasse diagrams are immutable. This temporary hack enables the
+-    # __hash__ method of DiGraph
+-    _immutable = True
++        EXAMPLES::
++
++            sage: from sage.combinat.posets.hasse_diagram import HasseDiagram
++            sage: H = HasseDiagram({0:[1,2],1:[3],2:[3],3:[]})
++            sage: D = {H:1}  # indirect doctest
++            sage: D
++            {Hasse diagram of a poset containing 4 elements: 1}
++
++        """
++        DiGraph.__init__(self, *args, **kwds)
++        # Hasse diagrams are immutable.
++        self.set_immutable()
+ 
+     def _repr_(self):
+         r"""
+         TESTS::
++
+             sage: from sage.combinat.posets.hasse_diagram import HasseDiagram
+             sage: H = HasseDiagram({0:[1,2],1:[3],2:[3],3:[]})
+             sage: H._repr_()
+diff --git a/sage/geometry/polyhedron/base.py b/sage/geometry/polyhedron/base.py
+--- a/sage/geometry/polyhedron/base.py
++++ b/sage/geometry/polyhedron/base.py
+@@ -3077,7 +3077,9 @@
+             sage: s4.is_eulerian()
+             True
+         """
+-        return Graph(self.vertex_adjacency_matrix(), loops=True)
++        G = Graph(self.vertex_adjacency_matrix(), loops=True)
++        G.set_immutable()
++        return G
+ 
+     graph = vertex_graph
+ 
+diff --git a/sage/graphs/bipartite_graph.py b/sage/graphs/bipartite_graph.py
+--- a/sage/graphs/bipartite_graph.py
++++ b/sage/graphs/bipartite_graph.py
+@@ -33,6 +33,7 @@
+ #*****************************************************************************
+ 
+ from graph import Graph
++from sage.structure.mutability import require_mutable
+ 
+ class BipartiteGraph(Graph):
+     r"""
+@@ -420,6 +421,7 @@
+         else:
+             return "".join(["Bipartite ", s])
+ 
++    @require_mutable
+     def add_vertex(self, name=None, left=False, right=False):
+         """
+         Creates an isolated vertex. If the vertex already exists, then
+@@ -515,6 +517,7 @@
+ 
+         return retval
+ 
++    @require_mutable
+     def add_vertices(self, vertices, left=False, right=False):
+         """
+         Add vertices to the bipartite graph from an iterable container of
+@@ -608,6 +611,7 @@
+ 
+         return
+ 
++    @require_mutable
+     def delete_vertex(self, vertex, in_order=False):
+         """
+         Deletes vertex, removing all incident edges. Deleting a non-existent
+@@ -677,6 +681,7 @@
+                 raise RuntimeError(
+                     "Vertex (%s) not found in partitions" % vertex)
+ 
++    @require_mutable
+     def delete_vertices(self, vertices):
+         """
+         Remove vertices from the bipartite graph taken from an iterable
+@@ -721,6 +726,7 @@
+                     raise RuntimeError(
+                         "Vertex (%s) not found in partitions" % vertex)
+ 
++    @require_mutable
+     def add_edge(self, u, v=None, label=None):
+         """
+         Adds an edge from ``u`` and ``v``.
+diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
+--- a/sage/graphs/generic_graph.py
++++ b/sage/graphs/generic_graph.py
+@@ -308,6 +308,7 @@
+ from sage.rings.rational import Rational
+ from generic_graph_pyx import GenericGraph_pyx, spring_layout_fast
+ from sage.graphs.dot2tex_utils import assert_have_dot2tex
++from sage.structure.mutability import require_mutable
+ 
+ class GenericGraph(GenericGraph_pyx):
+     """
+@@ -460,22 +461,6 @@
+                         return False
+             return True
+ 
+-    def __hash__(self):
+-        """
+-        Since graphs are mutable, they should not be hashable, so we return
+-        a type error.
+-        
+-        EXAMPLES::
+-        
+-            sage: hash(Graph())
+-            Traceback (most recent call last):
+-            ...
+-            TypeError: graphs are mutable, and thus not hashable
+-        """
+-        if getattr(self, "_immutable", False):
+-            return hash((tuple(self.vertices()), tuple(self.edges())))
+-        raise TypeError("graphs are mutable, and thus not hashable")
+-        
+     def __mul__(self, n):
+         """
+         Returns the sum of a graph with itself n times.
+@@ -784,6 +769,7 @@
+                     setattr(G, attr, copy(old_attr))
+ 
+         G._weighted = self._weighted
++        G._is_immutable = False
+         return G
+ 
+     copy = __copy__
+@@ -7449,7 +7435,7 @@
+     
+ 
+     ### Vertex handlers
+-
++    @require_mutable
+     def add_vertex(self, name=None):
+         """
+         Creates an isolated vertex. If the vertex already exists, then
+@@ -7485,6 +7471,7 @@
+         """
+         return self._backend.add_vertex(name)
+ 
++    @require_mutable
+     def add_vertices(self, vertices):
+         """
+         Add vertices to the (di)graph from an iterable container of
+@@ -7522,6 +7509,7 @@
+         """
+         return self._backend.add_vertices(vertices)
+ 
++    @require_mutable
+     def delete_vertex(self, vertex, in_order=False):
+         """
+         Deletes vertex, removing all incident edges. Deleting a
+@@ -7584,6 +7572,7 @@
+         
+         self._backend.del_vertex(vertex)
+ 
++    @require_mutable
+     def delete_vertices(self, vertices):
+         """
+         Remove vertices from the (di)graph taken from an iterable container
+@@ -8149,7 +8138,7 @@
+ 
+ 
+     ### Edge handlers
+-    
++    @require_mutable
+     def add_edge(self, u, v=None, label=None):
+         """
+         Adds an edge from u and v.
+@@ -8403,6 +8392,7 @@
+         for e in edges:
+             self.subdivide_edge(e, k)
+ 
++    @require_mutable
+     def delete_edge(self, u, v=None, label=None):
+         r"""
+         Delete the edge from u to v, returning silently if vertices or edge
+@@ -8555,6 +8545,7 @@
+         else:
+             self.delete_edge(u, v)
+ 
++    @require_mutable
+     def set_edge_label(self, u, v, l):
+         """
+         Set the edge label of a given edge.
+diff --git a/sage/graphs/generic_graph_pyx.pxd b/sage/graphs/generic_graph_pyx.pxd
+--- a/sage/graphs/generic_graph_pyx.pxd
++++ b/sage/graphs/generic_graph_pyx.pxd
+@@ -5,9 +5,7 @@
+ cdef run_spring(int, int, double*, int*, int, bint)
+ 
+ cdef class GenericGraph_pyx(SageObject):
+-    pass
+-
+-
++    cdef public bint _is_immutable
+ 
+ cdef class SubgraphSearch:
+     cdef int ng
+diff --git a/sage/graphs/generic_graph_pyx.pyx b/sage/graphs/generic_graph_pyx.pyx
+--- a/sage/graphs/generic_graph_pyx.pyx
++++ b/sage/graphs/generic_graph_pyx.pyx
+@@ -29,7 +29,78 @@
+     double sqrt(double)
+ 
+ cdef class GenericGraph_pyx(SageObject):
+-    pass
++
++    def set_immutable(self):
++        """
++        Make sure that this graph can't be changed.
++
++        EXAMPLES::
++
++            sage: G = Graph()
++            sage: G.is_mutable()
++            True
++            sage: G.add_edge((1,2), label='alpha')
++            sage: G.set_immutable()
++            sage: G.add_edge((3,1), label='beta')
++            Traceback (most recent call last):
++            ...
++            ValueError: <class 'sage.graphs.graph.Graph'> instance is 
++            immutable, <function add_edge at ...> must not be called
++        """
++        self._is_immutable = True
++
++    def is_immutable(self):
++        """
++        Test whether this graph is immutable.
++
++        EXAMPLES::
++
++            sage: G = Graph()
++            sage: G.is_immutable()
++            False
++            sage: G.add_edge((1,2), label='alpha')
++            sage: G.set_immutable()
++            sage: G.is_immutable()
++            True
++        """
++        return self._is_immutable
++
++    def is_mutable(self):
++        """
++        Test whether this graph can be changed.
++
++        EXAMPLES::
++
++            sage: G = Graph()
++            sage: G.is_mutable()
++            True
++            sage: G.add_edge((1,2), label='alpha')
++            sage: G.set_immutable()
++            sage: G.is_mutable()
++            False
++        """
++        return not self._is_immutable
++
++    def __hash__(self):
++        """
++        Since graphs are mutable, they should not be hashable, so we return
++        a type error.
++        
++        EXAMPLES::
++        
++            sage: G = Graph()
++            sage: hash(G)
++            Traceback (most recent call last):
++            ...
++            TypeError: This graph is mutable, and thus not hashable
++            sage: G.set_immutable()
++            sage: hash(G)
++            107815166986306181
++
++        """
++        if self._is_immutable:
++            return hash((tuple(self.vertices()), tuple(self.edges())))
++        raise TypeError, "This graph is mutable, and thus not hashable"
+ 
+ def spring_layout_fast_split(G, **options):
+     """