Sage Crashed when opening from a terminal at a directory. Sage
configuration is a fresh copy compiled from source (version 7.6) with no
configuration. I have only run tests using sage --testall. Sage only
crashes in this particular directory which has my python modules and also
happens to be a git repo. I have tried in other git repos and directories
but it works fine.
I have attached the crash report.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
***************************************************************************
IPython post-mortem report
{'commit_hash': u'5c9c918',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path':
'/home/kronos/sage-7.6/local/lib/python2.7/site-packages/IPython',
'ipython_version': '5.1.0',
'os_name': 'posix',
'platform': 'Linux-4.10.0-22-generic-x86_64-with-debian-stretch-sid',
'sys_executable': '/home/kronos/sage-7.6/local/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.7.13 (default, Jun 18 2017, 01:22:09) \n[GCC 5.4.0]'}
***************************************************************************
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
---------------------------------------------------------------------------
AttributeError Python 2.7.13: /home/kronos/sage-7.6/local/bin/python
Sun Jun 18 16:16:17 2017
A problem occurred executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/home/kronos/sage-7.6/src/bin/sage-ipython in <module>()
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """
4 Sage IPython startup script.
5 """
6
7 from sage.repl.interpreter import SageTerminalApp
8
9 app = SageTerminalApp.instance()
---> 10 app.initialize()
global app.initialize = <bound method SageTerminalApp.initialize of
<sage.repl.interpreter.SageTerminalApp object at 0x7f017ea15210>>
11 app.start()
<decorator-gen-109> in initialize(self=<sage.repl.interpreter.SageTerminalApp
object>, argv=None)
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/traitlets/config/application.pyc
in catch_config_error(method=<function initialize>,
app=<sage.repl.interpreter.SageTerminalApp object>, *args=(None,), **kwargs={})
72 TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR = False
73 else:
74 raise ValueError("Unsupported value for environment variable:
'TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR' is set to '%s' which is none of
{'0', '1', 'false', 'true', ''}."% _envvar )
75
76
77 @decorator
78 def catch_config_error(method, app, *args, **kwargs):
79 """Method decorator for catching invalid config
(Trait/ArgumentErrors) during init.
80
81 On a TraitError (generally caused by bad config), this will print
the trait's
82 message, and exit the app.
83
84 For use on init methods, to prevent invoking excepthook on invalid
input.
85 """
86 try:
---> 87 return method(app, *args, **kwargs)
method = <function initialize at 0x7f017712ede8>
app = <sage.repl.interpreter.SageTerminalApp object at 0x7f017ea15210>
args = (None,)
kwargs = {}
88 except (TraitError, ArgumentError) as e:
89 app.print_help()
90 app.log.fatal("Bad config encountered during initialization:")
91 app.log.fatal(str(e))
92 app.log.debug("Config at the time: %s", app.config)
93 app.exit(1)
94
95
96 class ApplicationError(Exception):
97 pass
98
99
100 class LevelFormatter(logging.Formatter):
101 """Formatter with additional `highlevel` record
102
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc
in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
294
295 return super(TerminalIPythonApp, self).parse_command_line(argv)
296
297 @catch_config_error
298 def initialize(self, argv=None):
299 """Do actions after construct, but before starting the app."""
300 super(TerminalIPythonApp, self).initialize(argv)
301 if self.subapp is not None:
302 # don't bother initializing further, starting subapp
303 return
304 # print self.extra_args
305 if self.extra_args and not self.something_to_run:
306 self.file_to_run = self.extra_args[0]
307 self.init_path()
308 # create the shell
--> 309 self.init_shell()
self.init_shell = <bound method SageTerminalApp.init_shell of
<sage.repl.interpreter.SageTerminalApp object at 0x7f017ea15210>>
310 # and draw the banner
311 self.init_banner()
312 # Now a variety of things that happen after the banner is
printed.
313 self.init_gui_pylab()
314 self.init_extensions()
315 self.init_code()
316
317 def init_shell(self):
318 """initialize the InteractiveShell instance"""
319 # Create an InteractiveShell instance.
320 # shell.display_banner should always be False for the terminal
321 # based app, because we call shell.show_banner() by hand below
322 # so the banner shows *before* all extension loading stuff.
323 self.shell = TerminalInteractiveShell.instance(parent=self,
324 profile_dir=self.profile_dir,
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/repl/interpreter.pyc
in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
747 self.shell.has_sage_extensions = SAGE_EXTENSION in
self.extensions
748
749 # Load the %lprun extension if available
750 try:
751 import line_profiler
752 except ImportError:
753 pass
754 else:
755 self.extensions.append('line_profiler')
756
757 if self.shell.has_sage_extensions:
758 self.extensions.remove(SAGE_EXTENSION)
759
760 # load sage extension here to get a crash if
761 # something is wrong with the sage library
--> 762 self.shell.extension_manager.load_extension(SAGE_EXTENSION)
self.shell.extension_manager.load_extension = <bound method
ExtensionManager.load_extension of <IPython.core.extensions.ExtensionManager
object at 0x7f0175f52410>>
global SAGE_EXTENSION = 'sage'
763
764
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/IPython/core/extensions.pyc
in load_extension(self=<IPython.core.extensions.ExtensionManager object>,
module_str='sage')
70
71 Returns the string "already loaded" if the extension is already
loaded,
72 "no load function" if the module doesn't have a
load_ipython_extension
73 function, or None if it succeeded.
74 """
75 if module_str in self.loaded:
76 return "already loaded"
77
78 from IPython.utils.syspathcontext import prepended_to_syspath
79
80 with self.shell.builtin_trap:
81 if module_str not in sys.modules:
82 with prepended_to_syspath(self.ipython_extension_dir):
83 __import__(module_str)
84 mod = sys.modules[module_str]
---> 85 if self._call_load_ipython_extension(mod):
self._call_load_ipython_extension = <bound method
ExtensionManager._call_load_ipython_extension of
<IPython.core.extensions.ExtensionManager object at 0x7f0175f52410>>
mod = <module 'sage' from
'/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/__init__.pyc'>
86 self.loaded.add(module_str)
87 else:
88 return "no load function"
89
90 def unload_extension(self, module_str):
91 """Unload an IPython extension by its module name.
92
93 This function looks up the extension's name in ``sys.modules``
and
94 simply calls ``mod.unload_ipython_extension(self)``.
95
96 Returns the string "no unload function" if the extension
doesn't define
97 a function to unload itself, "not loaded" if the extension
isn't loaded,
98 otherwise None.
99 """
100 if module_str not in self.loaded:
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/IPython/core/extensions.pyc
in _call_load_ipython_extension(self=<IPython.core.extensions.ExtensionManager
object>, mod=<module 'sage' from
'/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/__init__.pyc'>)
117 """
118 from IPython.utils.syspathcontext import prepended_to_syspath
119
120 if (module_str in self.loaded) and (module_str in sys.modules):
121 self.unload_extension(module_str)
122 mod = sys.modules[module_str]
123 with prepended_to_syspath(self.ipython_extension_dir):
124 reload(mod)
125 if self._call_load_ipython_extension(mod):
126 self.loaded.add(module_str)
127 else:
128 self.load_extension(module_str)
129
130 def _call_load_ipython_extension(self, mod):
131 if hasattr(mod, 'load_ipython_extension'):
--> 132 mod.load_ipython_extension(self.shell)
mod.load_ipython_extension = <function load_ipython_extension at
0x7f017ea077d0>
self.shell = <sage.repl.interpreter.SageTerminalInteractiveShell object
at 0x7f01770d9110>
133 return True
134
135 def _call_unload_ipython_extension(self, mod):
136 if hasattr(mod, 'unload_ipython_extension'):
137 mod.unload_ipython_extension(self.shell)
138 return True
139
140 def install_extension(self, url, filename=None):
141 """Download and install an IPython extension.
142
143 If filename is given, the file will be so named (inside the
extension
144 directory). Otherwise, the name from the URL will be used. The
file must
145 have a .py or .zip extension; otherwise, a ValueError will be
raised.
146
147 Returns the full path to the installed file.
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/__init__.pyc in
load_ipython_extension(*args=(<sage.repl.interpreter.SageTerminalInteractiveShell
object>,))
1 __all__ = ['all']
2
3 # IPython calls this when starting up
4 def load_ipython_extension(*args):
5 import sage.repl.ipython_extension
----> 6 sage.repl.ipython_extension.load_ipython_extension(*args)
sage.repl.ipython_extension.load_ipython_extension = <function
load_ipython_extension at 0x7f017b274140>
args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at
0x7f01770d9110>,)
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/repl/ipython_extension.pyc
in wrapper(*args=(<sage.repl.interpreter.SageTerminalInteractiveShell
object>,), **kwargs={})
490 ....: if work:
491 ....: return 'foo worked'
492 ....: raise RuntimeError("foo didn't work")
493 sage: foo(False)
494 Traceback (most recent call last):
495 ...
496 RuntimeError: foo didn't work
497 sage: foo(True)
498 'foo worked'
499 sage: foo(False)
500 sage: foo(True)
501 """
502 @wraps(func)
503 def wrapper(*args, **kwargs):
504 if not wrapper.has_run:
--> 505 result = func(*args, **kwargs)
result = undefined
global func = undefined
args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at
0x7f01770d9110>,)
kwargs = {}
506 wrapper.has_run = True
507 return result
508 wrapper.has_run = False
509 return wrapper
510
511
512 @run_once
513 def load_ipython_extension(ip):
514 """
515 Load the extension in IPython.
516 """
517 # this modifies ip
518 SageCustomizations(shell=ip)
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/repl/ipython_extension.pyc
in
load_ipython_extension(ip=<sage.repl.interpreter.SageTerminalInteractiveShell
object>)
503 def wrapper(*args, **kwargs):
504 if not wrapper.has_run:
505 result = func(*args, **kwargs)
506 wrapper.has_run = True
507 return result
508 wrapper.has_run = False
509 return wrapper
510
511
512 @run_once
513 def load_ipython_extension(ip):
514 """
515 Load the extension in IPython.
516 """
517 # this modifies ip
--> 518 SageCustomizations(shell=ip)
global SageCustomizations = <class
'sage.repl.ipython_extension.SageCustomizations'>
global shell = undefined
ip = <sage.repl.interpreter.SageTerminalInteractiveShell object at
0x7f01770d9110>
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/repl/ipython_extension.pyc
in __init__(self=<sage.repl.ipython_extension.SageCustomizations object>,
shell=<sage.repl.interpreter.SageTerminalInteractiveShell object>)
361 def __init__(self, shell=None):
362 """
363 Initialize the Sage plugin.
364 """
365 self.shell = shell
366
367 self.auto_magics = SageMagics(shell)
368 self.shell.register_magics(self.auto_magics)
369
370 import sage.misc.edit_module as edit_module
371 self.shell.set_hook('editor', edit_module.edit_devel)
372
373 self.init_inspector()
374 self.init_line_transforms()
375
--> 376 import sage.all # until sage's import hell is fixed
sage.all = undefined
377
378 self.shell.verbose_quit = True
379 self.set_quit_hook()
380
381 self.register_interface_magics()
382
383 if SAGE_IMPORTALL == 'yes':
384 self.init_environment()
385
386 def register_interface_magics(self):
387 """
388 Register magics for each of the Sage interfaces
389 """
390 from sage.repl.interface_magic import InterfaceMagic
391 InterfaceMagic.register_all(self.shell)
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/all.py in
<module>()
98 from sage.libs.all import *
99 from sage.data_structures.all import *
100 from sage.doctest.all import *
101
102 from sage.structure.all import *
103 from sage.rings.all import *
104 from sage.arith.all import *
105 from sage.matrix.all import *
106
107 from sage.symbolic.all import *
108 from sage.modules.all import *
109 from sage.monoids.all import *
110 from sage.algebras.all import *
111 from sage.modular.all import *
112 from sage.sat.all import *
--> 113 from sage.schemes.all import *
global sage.schemes.all = undefined
114 from sage.graphs.all import *
115 from sage.groups.all import *
116 from sage.databases.all import *
117 from sage.categories.all import *
118 from sage.sets.all import *
119 from sage.probability.all import *
120 from sage.interfaces.all import *
121
122 from sage.functions.all import *
123 from sage.calculus.all import *
124
125 import sage.tests.all as tests
126
127 from sage.crypto.all import *
128 import sage.crypto.mq as mq
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/all.py in
<module>()
11 #
12 # Distributed under the terms of the GNU General Public License (GPL)
13 #
14 # This code is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # The full text of the GPL is available at:
20 #
21 # http://www.gnu.org/licenses/
22
#*****************************************************************************
23
24 from .jacobians.all import *
25
---> 26 from .hyperelliptic_curves.all import *
global hyperelliptic_curves.all = undefined
27
28 from .curves.all import *
29
30 from .plane_conics.all import *
31
32 from .elliptic_curves.all import *
33
34 from .plane_quartics.all import *
35
36 from .generic.all import *
37
38 from .toric.all import *
39
40 from .affine.all import *
41
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/hyperelliptic_curves/__init__.py
in <module>()
1 from __future__ import absolute_import
----> 2 from . import all
global all = undefined
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/hyperelliptic_curves/all.py
in <module>()
1 from __future__ import absolute_import
----> 2 from .constructor import HyperellipticCurve
global constructor = undefined
global HyperellipticCurve = undefined
3 from .kummer_surface import KummerSurface
4 from .invariants import (igusa_clebsch_invariants,
5 absolute_igusa_invariants_kohel,
6 absolute_igusa_invariants_wamelen,
7 clebsch_invariants)
8 from .mestre import (Mestre_conic, HyperellipticCurve_from_invariants)
9 from . import monsky_washnitzer
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/hyperelliptic_curves/constructor.py
in <module>()
1 """
2 Hyperelliptic curve constructor
3 """
4 from __future__ import absolute_import
5
6
#*****************************************************************************
7 # Copyright (C) 2006 David Kohel <[email protected]>
8 # Distributed under the terms of the GNU General Public License (GPL)
9 # http://www.gnu.org/licenses/
10
#*****************************************************************************
11
---> 12 from sage.schemes.projective.projective_space import ProjectiveSpace
global sage.schemes.projective.projective_space = undefined
global ProjectiveSpace = undefined
13
14 from .hyperelliptic_generic import HyperellipticCurve_generic
15 from .hyperelliptic_finite_field import HyperellipticCurve_finite_field
16 from .hyperelliptic_rational_field import
HyperellipticCurve_rational_field
17 from .hyperelliptic_padic_field import HyperellipticCurve_padic_field
18 from .hyperelliptic_g2_generic import HyperellipticCurve_g2_generic
19 from .hyperelliptic_g2_finite_field import
HyperellipticCurve_g2_finite_field
20 from .hyperelliptic_g2_rational_field import
HyperellipticCurve_g2_rational_field
21 from .hyperelliptic_g2_padic_field import
HyperellipticCurve_g2_padic_field
22
23 from sage.rings.padics.all import is_pAdicField
24
25 from sage.rings.rational_field import is_RationalField
26 from sage.rings.finite_rings.finite_field_constructor import
is_FiniteField
27 from sage.rings.polynomial.polynomial_element import is_Polynomial
28
29
30 def HyperellipticCurve(f, h=0, names=None, PP=None,
check_squarefree=True):
31 r"""
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/projective/projective_space.py
in <module>()
103 from sage.structure.category_object import normalize_names
104 from sage.arith.all import gcd, binomial
105 from sage.combinat.integer_vector import IntegerVectors
106 from sage.combinat.permutation import Permutation
107 from sage.combinat.tuple import Tuples
108 from sage.combinat.tuple import UnorderedTuples
109 from sage.matrix.constructor import matrix
110 from sage.modules.free_module_element import prepare
111
112 from sage.schemes.generic.ambient_space import AmbientSpace
113 from sage.schemes.projective.projective_homset import
(SchemeHomset_points_projective_ring,
114
SchemeHomset_points_projective_field)
115 from sage.schemes.projective.projective_point import
(SchemeMorphism_point_projective_ring,
116
SchemeMorphism_point_projective_field,
117
SchemeMorphism_point_projective_finite_field)
--> 118 from sage.schemes.projective.projective_morphism import
(SchemeMorphism_polynomial_projective_space,
global sage.schemes.projective.projective_morphism = undefined
global SchemeMorphism_polynomial_projective_space = undefined
global SchemeMorphism_polynomial_projective_space_field = undefined
global SchemeMorphism_polynomial_projective_space_finite_field =
undefined
119
SchemeMorphism_polynomial_projective_space_field,
120
SchemeMorphism_polynomial_projective_space_finite_field)
121
122 def is_ProjectiveSpace(x):
123 r"""
124 Return True if ``x`` is a projective space.
125
126 In other words, if ``x`` is an ambient space `\mathbb{P}^n_R`,
127 where `R` is a ring and `n\geq 0` is an integer.
128
129 EXAMPLES::
130
131 sage: from sage.schemes.projective.projective_space import
is_ProjectiveSpace
132 sage: is_ProjectiveSpace(ProjectiveSpace(5, names='x'))
133 True
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/schemes/projective/projective_morphism.py
in <module>()
33 # Copyright (C) 2006 David Kohel <[email protected]>
34 # Copyright (C) 2006 William Stein <[email protected]>
35 #
36 # This program is free software: you can redistribute it and/or modify
37 # it under the terms of the GNU General Public License as published by
38 # the Free Software Foundation, either version 2 of the License, or
39 # (at your option) any later version.
40 # http://www.gnu.org/licenses/
41
#*****************************************************************************
42 from __future__ import print_function
43 from __future__ import absolute_import
44
45 from sage.calculus.functions import jacobian
46 from sage.categories.number_fields import NumberFields
47 from sage.categories.homset import Hom, End
---> 48 from sage.combinat.sf.sf import SymmetricFunctions
global sage.combinat.sf.sf = undefined
global SymmetricFunctions = undefined
49 from sage.functions.all import sqrt
50 from sage.libs.pari.all import PariError
51 from sage.matrix.constructor import matrix, identity_matrix
52 from sage.misc.all import prod
53 from sage.misc.cachefunc import cached_method
54 from sage.misc.misc import subsets
55 from sage.misc.mrange import xmrange
56 from sage.modules.free_module_element import vector
57 from sage.rings.all import Integer, CIF
58 from sage.arith.all import gcd, lcm, next_prime, binomial, primes,
moebius
59 from sage.rings.complex_field import ComplexField_class,ComplexField
60 from sage.rings.complex_interval_field import ComplexIntervalField_class
61 from sage.categories.finite_fields import FiniteFields
62 from sage.rings.finite_rings.finite_field_constructor import GF,
is_PrimeFiniteField
63 from sage.rings.finite_rings.integer_mod_ring import Zmod
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/combinat/sf/sf.py
in <module>()
13 #
14 # This code is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # The full text of the GPL is available at:
20 #
21 # http://www.gnu.org/licenses/
22
#*****************************************************************************
23 from sage.structure.parent import Parent
24 from sage.structure.unique_representation import UniqueRepresentation
25 from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
26 from sage.categories.fields import Fields
27 from sage.categories.rings import Rings
---> 28 from sage.combinat.partition import Partitions
global sage.combinat.partition = undefined
global Partitions = undefined
29 from sage.combinat.free_module import CombinatorialFreeModule
30 from sage.rings.rational_field import QQ
31
32 from . import schur
33 from . import monomial
34 from . import powersum
35 from . import elementary
36 from . import homogeneous
37 from . import hall_littlewood
38 from . import jack
39 from . import macdonald
40 from . import llt
41
42 class SymmetricFunctions(UniqueRepresentation, Parent):
43 r"""
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/combinat/partition.py
in <module>()
311 from sage.rings.infinity import infinity
312
313 from .combinat import CombinatorialClass, CombinatorialElement
314 from . import tableau
315 from . import permutation
316 from . import composition
317 from sage.combinat.partitions import number_of_partitions as
bober_number_of_partitions
318 from sage.combinat.partitions import ZS1_iterator, ZS1_iterator_nk
319 from sage.combinat.integer_vector import IntegerVectors
320 from sage.combinat.integer_lists import IntegerListsLex
321 from sage.combinat.root_system.weyl_group import WeylGroup
322 from sage.combinat.combinatorial_map import combinatorial_map
323 from sage.groups.perm_gps.permgroup import PermutationGroup
324 from sage.graphs.dot2tex_utils import have_dot2tex
325
--> 326 class Partition(CombinatorialElement):
global Partition = undefined
global CombinatorialElement = None
327 r"""
328 A partition `p` of a nonnegative integer `n` is a
329 non-increasing list of positive integers (the *parts* of the
330 partition) with total sum `n`.
331
332 A partition is often represented as a diagram consisting of
**cells**,
333 or **boxes**, placed in rows on top of each other such that the
number of
334 cells in the `i^{th}` row, reading from top to bottom, is the
`i^{th}`
335 part of the partition. The rows are left-justified (and become
shorter
336 and shorter the farther down one goes). This diagram is called the
337 **Young diagram** of the partition, or more precisely its Young
diagram
338 in English notation. (French and Russian notations are variations
on this
339 representation.)
340
341 The coordinate system related to a partition applies from the top
/home/kronos/sage-7.6/local/lib/python2.7/site-packages/sage/combinat/partition.py
in Partition()
4577 1
4578 sage: Partition([2]).plancherel_measure()
4579 1/2
4580 sage: [mu.plancherel_measure() for mu in Partitions(3)]
4581 [1/6, 2/3, 1/6]
4582 sage: Partition([5,4]).plancherel_measure()
4583 7/1440
4584
4585 TESTS::
4586
4587 sage: all(sum(mu.plancherel_measure() for mu in
Partitions(n))==1 for n in range(10))
4588 True
4589 """
4590 return self.dimension()**2/factorial(self.size())
4591
-> 4592 def outline(self, variable=var("x")):
global outline = undefined
global self = undefined
global variable = undefined
global var = None
4593 r"""
4594 Return the outline of the partition ``self``.
4595
4596 This is a piecewise linear function, normalized so that the area
4597 under the partition ``[1]`` is 2.
4598
4599 INPUT:
4600
4601 - variable -- a variable (default: ``'x'`` in the symbolic ring)
4602
4603 EXAMPLES::
4604
4605 sage: [Partition([5,4]).outline()(x=i) for i in
range(-10,11)]
4606 [10, 9, 8, 7, 6, 5, 6, 5, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8,
9, 10]
4607
/home/kronos/sage-7.6/src/sage/symbolic/ring.pyx in sage.symbolic.ring.var
(/home/kronos/sage-7.6/src/build/cythonized/sage/symbolic/ring.cpp:13168)()
1203
1204 TESTS:
1205
1206 These examples test that variables can only be made from valid
1207 identifiers. See :trac:`7496` (and :trac:`9724`) for details::
1208
1209 sage: var(' ')
1210 Traceback (most recent call last):
1211 ...
1212 ValueError: You need to specify the name of the new variable.
1213 sage: var('3')
1214 Traceback (most recent call last):
1215 ...
1216 ValueError: The name "3" is not a valid Python identifier.
1217 """
-> 1218 return SR.var(name, **kwds)
global SR.var = <built-in method var of sage.symbolic.ring.SymbolicRing
object at 0x7f00d2bc4570>
global name = undefined
global kwds = undefined
1219
1220 def is_SymbolicVariable(x):
1221 """
1222 Returns True if x is a variable.
1223
1224 EXAMPLES::
1225
1226 sage: from sage.symbolic.ring import is_SymbolicVariable
1227 sage: is_SymbolicVariable(x)
1228 True
1229 sage: is_SymbolicVariable(x+2)
1230 False
1231
1232 TESTS::
1233
/home/kronos/sage-7.6/src/sage/symbolic/ring.pyx in
sage.symbolic.ring.SymbolicRing.var
(/home/kronos/sage-7.6/src/build/cythonized/sage/symbolic/ring.cpp:9804)()
760 if is_Expression(name):
761 return name
762 if not isinstance(name, (basestring,list,tuple)):
763 name = repr(name)
764
765 if isinstance(name, (list,tuple)):
766 names_list = [s.strip() for s in name]
767 elif ',' in name:
768 names_list = [s.strip() for s in name.split(',' )]
769 elif ' ' in name:
770 names_list = [s.strip() for s in name.split()]
771 else:
772 names_list = [name]
773
774 for s in names_list:
--> 775 if not isidentifier(s):
global isidentifier = <built-in function isidentifier>
global s = undefined
776 raise ValueError('The name "'+s+'" is not a valid
Python identifier.')
777
778 if len(names_list) == 0:
779 raise ValueError('You need to specify the name of the new
variable.')
780 if len(names_list) == 1:
781 formatted_latex_name = None
782 if latex_name is not None:
783 formatted_latex_name = '{{{0}}}'.format(latex_name)
784 return self.symbol(name, latex_name=formatted_latex_name,
domain=domain)
785 if len(names_list) > 1:
786 if latex_name:
787 raise ValueError("cannot specify latex_name for
multiple symbol names")
788 return tuple([self.symbol(s, domain=domain) for s in
names_list])
789
790 def _repr_element_(self, Expression x):
/home/kronos/sage-7.6/src/sage/symbolic/ring.pyx in
sage.symbolic.ring.isidentifier
(/home/kronos/sage-7.6/src/build/cythonized/sage/symbolic/ring.cpp:13448)()
1260 False
1261 sage: isidentifier('ceci_n_est_pas_une_pipe')
1262 True
1263 sage: isidentifier('1 + x')
1264 False
1265 sage: isidentifier('2good')
1266 False
1267 sage: isidentifier('good2')
1268 True
1269 sage: isidentifier('lambda s:s+1')
1270 False
1271 """
1272 import parser
1273 try:
1274 code = parser.expr(x).compile()
-> 1275 except (MemoryError, OverflowError, SyntaxError, SystemError,
parser.ParserError), msg:
global MemoryError = undefined
global OverflowError = undefined
global SyntaxError = undefined
global SystemError = undefined
global parser.ParserError = undefined
global msg = undefined
1276 return False
1277 return len(code.co_names) == 1 and code.co_names[0] == x
AttributeError: 'module' object has no attribute 'ParserError'
***************************************************************************
History of session input:
*** Last line of input (may not be in above history):