Volker Braun avatar Volker Braun committed aef7063

updated to sage-5.9.beta3

Comments (0)

Files changed (7)

14370_ipython_nocolors_v2.patch

-# HG changeset patch
-# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
-# Date 1364425365 25200
-# Node ID c6325005a42361e89c58d17a9515eec68e092def
-# Parent  e9d7892a23ebeb4ec48fb3270bd0913229ea328f
-Disable IPython colors in doctests; unset TERM when doctesting the doctester
-
-diff --git a/sage/doctest/forker.py b/sage/doctest/forker.py
---- a/sage/doctest/forker.py
-+++ b/sage/doctest/forker.py
-@@ -78,6 +78,10 @@
-     import sage.misc.displayhook
-     sys.displayhook = sage.misc.displayhook.DisplayHook(sys.displayhook)
- 
-+    # Disable IPython colors during doctests
-+    from sage.misc.interpreter import DEFAULT_SAGE_CONFIG
-+    DEFAULT_SAGE_CONFIG['TerminalInteractiveShell']['colors'] = 'NoColor'
-+
-     # We import readline before forking, otherwise Pdb doesn't work
-     # os OS X: http://trac.sagemath.org/sage_trac/ticket/14289
-     import readline
-diff --git a/sage/doctest/test.py b/sage/doctest/test.py
---- a/sage/doctest/test.py
-+++ b/sage/doctest/test.py
-@@ -11,10 +11,19 @@
-     sage: import time
-     sage: from sage.env import SAGE_SRC
-     sage: tests_dir = os.path.join(SAGE_SRC, 'sage', 'doctest', 'tests')
-+    sage: tests_env = dict(os.environ)
-+
-+Unset :envvar:`TERM` when running doctests, see :trac:`14370`::
-+
-+    sage: try:
-+    ....:     del tests_env['TERM']
-+    ....: except KeyError:
-+    ....:     pass
-+    sage: kwds = {'cwd': tests_dir, 'env':tests_env}
- 
- Check that :trac:`2235` has been fixed::
- 
--    sage: subprocess.call(["sage", "-t", "longtime.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "longtime.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t longtime.rst
-@@ -24,7 +33,7 @@
-     ----------------------------------------------------------------------
-     ...
-     0
--    sage: subprocess.call(["sage", "-t", "-l", "longtime.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "-l", "longtime.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t --long longtime.rst
-@@ -37,7 +46,7 @@
- 
- Test the ``--initial`` option::
- 
--    sage: subprocess.call(["sage", "-t", "-i", "initial.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "-i", "initial.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t initial.rst
-@@ -67,9 +76,10 @@
- 
- Test a timeout using the ``SAGE_TIMEOUT`` environment variable::
- 
--    sage: env = dict(os.environ)
--    sage: env['SAGE_TIMEOUT'] = "3"
--    sage: subprocess.call(["sage", "-t", "99seconds.rst"], cwd=tests_dir, env=env)  # long time
-+    sage: from copy import deepcopy
-+    sage: kwds2 = deepcopy(kwds)
-+    sage: kwds2['env']['SAGE_TIMEOUT'] = "3"
-+    sage: subprocess.call(["sage", "-t", "99seconds.rst"], **kwds2)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t 99seconds.rst
-@@ -85,7 +95,7 @@
- 
- Test handling of ``KeyboardInterrupt``s in doctests::
- 
--    sage: subprocess.call(["sage", "-t", "keyboardinterrupt.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "keyboardinterrupt.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t keyboardinterrupt.rst
-@@ -107,7 +117,7 @@
- 
- Interrupt the doctester::
- 
--    sage: subprocess.call(["sage", "-t", "interrupt.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "interrupt.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t interrupt.rst
-@@ -123,10 +133,11 @@
- doesn't hurt::
- 
-     sage: F = tmp_filename()
--    sage: env = dict(os.environ)
--    sage: env['DOCTEST_TEST_PID_FILE'] = F  # Doctester will write its PID in this file
-+    sage: from copy import deepcopy
-+    sage: kwds2 = deepcopy(kwds)
-+    sage: kwds2['env']['DOCTEST_TEST_PID_FILE'] = F  # Doctester will write its PID in this file
-     sage: subprocess.call(["sage", "-tp", "1000000", "--timeout=120",  # long time
--    ....:     "99seconds.rst", "interrupt_diehard.rst"], cwd=tests_dir, env=env)
-+    ....:     "99seconds.rst", "interrupt_diehard.rst"], **kwds2)
-     Running doctests...
-     Doctesting 2 files using 1000000 threads.
-     Killing test 99seconds.rst
-@@ -152,7 +163,7 @@
- 
- Test a doctest failing with ``abort()``::
- 
--    sage: subprocess.call(["sage", "-t", "abort.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "abort.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t abort.rst
-@@ -176,7 +187,7 @@
- 
- A different kind of crash::
- 
--    sage: subprocess.call(["sage", "-t", "fail_and_die.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "fail_and_die.rst"], **kwds)  # long time
-     Running doctests...
-     Doctesting 1 file.
-     sage -t fail_and_die.rst
-@@ -200,7 +211,7 @@
- 
- Test running under gdb, without and with a timeout::
- 
--    sage: subprocess.call(["sage", "-t", "--gdb", "1second.rst"], cwd=tests_dir, stdin=open(os.devnull))  # long time, optional: gdb
-+    sage: subprocess.call(["sage", "-t", "--gdb", "1second.rst"], stdin=open(os.devnull), **kwds)  # long time, optional: gdb
-     exec gdb ...
-     Running doctests...
-     Doctesting 1 file.
-@@ -211,7 +222,7 @@
-     ----------------------------------------------------------------------
-     ...
-     0
--    sage: subprocess.call(["sage", "-t", "--gdb", "-T" "5", "99seconds.rst"], cwd=tests_dir, stdin=open(os.devnull))  # long time, optional: gdb
-+    sage: subprocess.call(["sage", "-t", "--gdb", "-T" "5", "99seconds.rst"], stdin=open(os.devnull), **kwds)  # long time, optional: gdb
-     exec gdb ...
-     Running doctests...
-     Doctesting 1 file.
-@@ -220,7 +231,7 @@
- 
- Test the ``--show-skipped`` option::
- 
--    sage: subprocess.call(["sage", "-t", "--show-skipped", "show_skipped.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "--show-skipped", "show_skipped.rst"], **kwds)  # long time
-     Running doctests ...
-     Doctesting 1 file.
-     sage -t show_skipped.rst
-@@ -238,7 +249,7 @@
- 
- Optional tests are run correctly::
- 
--    sage: subprocess.call(["sage", "-t", "--long", "--show-skipped", "--optional=sage,gap", "show_skipped.rst"], cwd=tests_dir)  # long time
-+    sage: subprocess.call(["sage", "-t", "--long", "--show-skipped", "--optional=sage,gap", "show_skipped.rst"], **kwds)  # long time
-     Running doctests ...
-     Doctesting 1 file.
-     sage -t --long show_skipped.rst
-diff --git a/sage/misc/interpreter.py b/sage/misc/interpreter.py
---- a/sage/misc/interpreter.py
-+++ b/sage/misc/interpreter.py
-@@ -559,6 +559,10 @@
-     :class:`InterfaceShellTransformer` to transform the input into the
-     appropriate ``interface.eval(...)`` input.
- 
-+    INPUT:
-+
-+    - ``interface`` -- A Sage ``PExpect`` interface instance.
-+
-     EXAMPLES::
- 
-         sage: from sage.misc.interpreter import interface_shell_embed

14370_run_doctests_fix.patch

-# HG changeset patch
-# Parent 010330a94f0321abb9f7952342d71b1e13d605c5
-
-Also unset color in the ipython config during run_doctest (for spawned
-subshells)
-
-diff --git a/sage/doctest/control.py b/sage/doctest/control.py
---- a/sage/doctest/control.py
-+++ b/sage/doctest/control.py
-@@ -900,11 +900,15 @@
-     if not save_dtmode:
-         IP = get_ipython()
-         old_color = IP.colors
--        IP.run_line_magic('colors','NoColor')
-+        IP.run_line_magic('colors', 'NoColor')
-+        old_config_color = IP.config.TerminalInteractiveShell.colors
-+        IP.config.TerminalInteractiveShell.colors = 'NoColor'
- 
-     try:
-         DC.run()
-     finally:
-         sage.plot.plot.DOCTEST_MODE = save_dtmode
-         if not save_dtmode:
--            IP.run_line_magic('colors',old_color)
-+            IP.run_line_magic('colors', old_color)
-+            IP.config.TerminalInteractiveShell.colors = old_config_color
-+
+trac_14409_geometry_sage_input.patch
 trac_13194_polytope_fan_construct.patch
 trac_14394_face_fan_bug.patch
 trac_14394_reviewer.patch
-trac_14375_ansi_escapes_indication.patch
+trac_14375_ansi_escapes_indication.2.patch
 trac_14187_lazy_import_test.patch
 trac_14014_libgap_cyclotomic_matrix.patch
 trac_14014_deletions.patch
 trac_3416_jacobians.patch
 trac_3416_fixes.patch
 trac_13826_star_imports_race.patch
-14370_ipython_nocolors_v2.patch
-14370_run_doctests_fix.patch
-trac_x_fan_sage_input.patch
 trac_14201_ppl_doctest_fixes.patch
 trac_14015_affine_group.patch
 trac_x_matrix_groups.patch

trac_14375_ansi_escapes_indication.2.patch

+# HG changeset patch
+# User Volker Braun <vbraun@stp.dias.ie>
+# Date 1364338386 -3600
+# Node ID 408b9532187cb64af222f3be6299bed2d28b4687
+# Parent d36b7ed7a101997566257ac68a02393c6c2a2076
+Mention in got<->want diff that there are ansi escape sequences
+
+diff --git a/sage/doctest/parsing.py b/sage/doctest/parsing.py
+--- a/sage/doctest/parsing.py
++++ b/sage/doctest/parsing.py
+@@ -33,6 +33,18 @@
+ backslash_replacer = re.compile(r"""(\s*)sage:(.*)\\\ *
+ \ *(((\.){4}:)|((\.){3}))?\ *""")
+ 
++
++# This is the correct pattern to match ISO/IEC 6429 ANSI escape sequences:
++#
++#ansi_escape_sequence = re.compile(r'(\x1b[@-Z\\-~]|\x1b\[.*?[@-~]|\x9b.*?[@-~])')
++#
++# We use this incorrect version to avoid accidental matches for \x9b
++# in UTF-8 bytestrings, even though there are none in the Sage
++# library. Once we have a unicode-aware doctest framework, we should
++# use the correct pattern including \x9b
++ansi_escape_sequence = re.compile(r'(\x1b[@-Z\\-~]|\x1b\[.*?[@-~])')
++
++
+ def parse_optional_tags(string):
+     """
+     Returns a set consisting of the optional tags from the following
+@@ -579,6 +591,36 @@
+         sage: OC.check_output(ex.want, 'x + 0.8935153492877', optflag)
+         False
+     """
++    def human_readable_escape_sequences(self, string):
++        """
++        Make ANSI escape sequences human readable.
++    
++        EXAMPLES::
++
++            sage: print 'This ist \x1b[1mbold\x1b[0m text'
++            This ist <CSI-1m>bold<CSI-0m> text
++
++        TESTS::
++        
++            sage: from sage.doctest.parsing import SageOutputChecker
++            sage: OC = SageOutputChecker()
++            sage: teststr = '-'.join([
++            ...       'bold\x1b[1m', 
++            ...       'newlinemode\x9b20h', 
++            ...       'red\x1b[31m',
++            ...       'oscmd\x1ba'])
++            sage: OC.human_readable_escape_sequences(teststr)
++            'bold<CSI-1m>-newlinemode\x9b20h-red<CSI-31m>-oscmd<ESC-a>'
++        """
++        def human_readable(match):
++            ansi_escape = match.group(1)
++            assert len(ansi_escape) >= 2
++            if len(ansi_escape) == 2:
++                return '<ESC-'+ansi_escape[1]+'>'
++            else:
++                return '<CSI-'+ansi_escape.lstrip('\x1b[\x9b')+'>'
++        return ansi_escape_sequence.subn(human_readable, string)[0]
++
+     def check_output(self, want, got, optionflags):
+         """
+         Checks to see if the output matches the desired output.
+@@ -674,6 +716,7 @@
+             sage: print "1.000009"   # abs tol 1e-5
+             1.0
+         """
++        got = self.human_readable_escape_sequences(got)
+         if isinstance(want, MarkedOutput):
+             if want.random:
+                 return True
+@@ -817,6 +860,7 @@
+             Tolerance exceeded: infinity > 1e-01
+ 
+         """
++        got = self.human_readable_escape_sequences(got)
+         want = example.want
+         diff = doctest.OutputChecker.output_difference(self, example, got, optionflags)
+         if isinstance(want, MarkedOutput) and (want.tol or want.abs_tol or want.rel_tol):

trac_14375_ansi_escapes_indication.patch

-# HG changeset patch
-# User Volker Braun <vbraun@stp.dias.ie>
-# Date 1364338386 -3600
-# Node ID 408b9532187cb64af222f3be6299bed2d28b4687
-# Parent 809286ab516ede21c45f34f3696da756329a2c77
-Mention in got<->want diff that there are ansi escape sequences
-
-diff --git a/sage/doctest/parsing.py b/sage/doctest/parsing.py
---- a/sage/doctest/parsing.py
-+++ b/sage/doctest/parsing.py
-@@ -32,6 +32,7 @@
- tolerance_pattern = re.compile(r'\b((?:abs(?:olute)?)|(?:rel(?:ative)?))? *?tol(?:erance)?\b( +[0-9.e+-]+)?')
- backslash_replacer = re.compile(r"""(\s*)sage:(.*)\\\ *
- \ *(((\.){4}:)|((\.){3}))?\ *""")
-+ansi_escape_sequence = re.compile(r'(\x1b[@-Z\\-~]|\x1b\[.*?[@-~]|\x9b.*?[@-~])')
- 
- def parse_optional_tags(string):
-     """
-@@ -572,6 +573,36 @@
-         sage: OC.check_output(ex.want, 'x + 0.8935153492877', optflag)
-         False
-     """
-+    def human_readable_escape_sequences(self, string):
-+        """
-+        Make ANSI escape sequences human readable.
-+    
-+        EXAMPLES::
-+
-+            sage: print 'This ist \x1b[1mbold\x1b[0m text'
-+            This ist <CSI-1m>bold<CSI-0m> text
-+
-+        TESTS::
-+        
-+            sage: from sage.doctest.parsing import SageOutputChecker
-+            sage: OC = SageOutputChecker()
-+            sage: teststr = '-'.join([
-+            ...       'bold\x1b[1m', 
-+            ...       'newlinemode\x9b20h', 
-+            ...       'red\x1b[31m',
-+            ...       'oscmd\x1ba'])
-+            sage: OC.human_readable_escape_sequences(teststr)
-+            'bold<CSI-1m>-newlinemode<CSI-20h>-red<CSI-31m>-oscmd<ESC-a>'
-+        """
-+        def human_readable(match):
-+            ansi_escape = match.group(1)
-+            assert len(ansi_escape) >= 2
-+            if len(ansi_escape) == 2:
-+                return '<ESC-'+ansi_escape[1]+'>'
-+            else:
-+                return '<CSI-'+ansi_escape.lstrip('\x1b[\x9b')+'>'
-+        return ansi_escape_sequence.subn(human_readable, string)[0]
-+
-     def check_output(self, want, got, optionflags):
-         """
-         Checks to see if the output matches the desired output.
-@@ -667,6 +698,7 @@
-             sage: print "1.000009"   # abs tol 1e-5
-             1.0
-         """
-+        got = self.human_readable_escape_sequences(got)
-         if isinstance(want, MarkedOutput):
-             if want.random:
-                 return True
-@@ -810,6 +842,7 @@
-             Tolerance exceeded: infinity > 1e-01
- 
-         """
-+        got = self.human_readable_escape_sequences(got)
-         want = example.want
-         diff = doctest.OutputChecker.output_difference(self, example, got, optionflags)
-         if isinstance(want, MarkedOutput) and (want.tol or want.abs_tol or want.rel_tol):

trac_14409_geometry_sage_input.patch

+# HG changeset patch
+# Parent aa1ed8fd83e0ad4cfad16c339843aaafba4a9991
+
+Support sage_input() for some common geometry objects
+
+diff --git a/sage/geometry/cone.py b/sage/geometry/cone.py
+--- a/sage/geometry/cone.py
++++ b/sage/geometry/cone.py
+@@ -1366,6 +1366,20 @@
+             self._PPL_C_Polyhedron = PPL
+             self._PPL_C_Polyhedron.set_immutable()
+ 
++    def _sage_input_(self, sib, coerced):
++        """
++        Return Sage command to reconstruct ``self``.
++
++        See :mod:`sage.misc.sage_input` for details.
++
++        EXAMPLES::
++
++            sage: cone = Cone([(1,0), (1,1)])
++            sage: sage_input(cone)
++            Cone([(1, 0), (1, 1)])
++        """
++        return sib.name('Cone')([sib(tuple(r)) for r in self.rays()])
++
+     def _PPL_cone(self):
+         r"""
+         Returns the Parma Polyhedra Library (PPL) representation of the cone.
+diff --git a/sage/geometry/fan.py b/sage/geometry/fan.py
+--- a/sage/geometry/fan.py
++++ b/sage/geometry/fan.py
+@@ -1069,6 +1069,22 @@
+         if virtual_rays is not None:
+             self._virtual_rays = PointCollection(virtual_rays, self.lattice())
+ 
++    def _sage_input_(self, sib, coerced):
++        """
++        Return Sage command to reconstruct ``self``.
++        
++        See :mod:`sage.misc.sage_input` for details.
++
++        EXAMPLES::
++
++            sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(-1,-1)])])
++            sage: sage_input(fan)
++            Fan(cones=[[0, 1], [2]], rays=[(1, 0), (1, 1), (-1, -1)])
++       """
++        cones = [map(ZZ, c.ambient_ray_indices()) for c in self.generating_cones()]
++        rays = [sib(tuple(r)) for r in self.rays()]
++        return sib.name('Fan')(cones=cones, rays=rays)
++
+     def __call__(self, dim=None, codim=None):
+         r"""
+         Return the specified cones of ``self``.
+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
+@@ -121,6 +121,27 @@
+         else:
+             self._init_empty_polyhedron()
+ 
++    def _sage_input_(self, sib, coerced):
++        """
++        Return Sage command to reconstruct ``self``.
++        
++        See :mod:`sage.misc.sage_input` for details.
++
++        EXAMPLES::
++
++            sage: P = Polyhedron([(1,0), (0,1)], rays=[(1,1)])
++            sage: sage_input(P)
++            Polyhedron(base_ring=ZZ, rays=[(1, 1)], vertices=[(0, 1), (1, 0)])
++       """
++        kwds = dict()
++        kwds['base_ring'] = sib(self.base_ring())
++        if self.n_vertices() > 0:
++            kwds['vertices'] = [sib(tuple(v)) for v in self.vertices()]
++        if self.n_rays() > 0:
++            kwds['rays'] = [sib(tuple(r)) for r in self.rays()]
++        if self.n_lines() > 0:
++            kwds['lines'] = [sib(tuple(l)) for l in self.lines()]
++        return sib.name('Polyhedron')(**kwds)
+ 
+     def _init_from_Vrepresentation(self, vertices, rays, lines, **kwds):
+         """

trac_x_fan_sage_input.patch

-# HG changeset patch
-# Parent 73e2049f64202d0f800c9a4dc6e5369926d55f3d
-
-diff --git a/sage/geometry/cone.py b/sage/geometry/cone.py
---- a/sage/geometry/cone.py
-+++ b/sage/geometry/cone.py
-@@ -1366,6 +1366,20 @@
-             self._PPL_C_Polyhedron = PPL
-             self._PPL_C_Polyhedron.set_immutable()
- 
-+    def _sage_input_(self, sib, coerced):
-+        """
-+        Return Sage command to reconstruct ``self``.
-+
-+        See :mod:`sage.misc.sage_input` for details.
-+
-+        EXAMPLES::
-+
-+            sage: cone = Cone([(1,0), (1,1)])
-+            sage: sage_input(cone)
-+            Cone([(1, 0), (1, 1)])
-+        """
-+        return sib.name('Cone')([sib(tuple(r)) for r in self.rays()])
-+
-     def _PPL_cone(self):
-         r"""
-         Returns the Parma Polyhedra Library (PPL) representation of the cone.
-diff --git a/sage/geometry/fan.py b/sage/geometry/fan.py
---- a/sage/geometry/fan.py
-+++ b/sage/geometry/fan.py
-@@ -1144,6 +1144,22 @@
-         if virtual_rays is not None:
-             self._virtual_rays = PointCollection(virtual_rays, self.lattice())
- 
-+    def _sage_input_(self, sib, coerced):
-+        """
-+        Return Sage command to reconstruct ``self``.
-+        
-+        See :mod:`sage.misc.sage_input` for details.
-+
-+        EXAMPLES::
-+
-+            sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(-1,-1)])])
-+            sage: sage_input(fan)
-+            Fan(cones=[[0, 1], [2]], rays=[(1, 0), (1, 1), (-1, -1)])
-+       """
-+        cones = [map(ZZ, c.ambient_ray_indices()) for c in self.generating_cones()]
-+        rays = [sib(tuple(r)) for r in self.rays()]
-+        return sib.name('Fan')(cones=cones, rays=rays)
-+
-     def __call__(self, dim=None, codim=None):
-         r"""
-         Return the specified cones of ``self``.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.