##// END OF EJS Templates
Merge pull request #1399 from asmeurer/sympyprinting...
Merge pull request #1399 from asmeurer/sympyprinting Use LaTeX to display, on output, various built-in types with the SymPy printing extension. SymPy's latex() function supports printing lists, tuples, and dicts using latex notation (it uses bmatrix, pmatrix, and Bmatrix, respectively). This provides a more unified experience with SymPy functions that return these types (such as solve()). Also display ints, longs, and floats using LaTeX, to get a more unified printing experience (so that, e.g., x/x will print the same as just 1). The string form can always be obtained by manually calling the actual print function, or 2d unicode printing using pprint(). SymPy's latex() function doesn't treat set() or frosenset() correctly presently (see http://code.google.com/p/sympy/issues /detail?id=3062), so for the present, we leave those alone.

File last commit:

r4872:34c10438
r6482:ba882bf7 merge
Show More
ipy_signals.py
61 lines | 1.6 KiB | text/x-python | PythonLexer
vivainio
Add ipy_signals for better ctrl + C processing
r477 """ Advanced signal (e.g. ctrl+C) handling for IPython
So far, this only ignores ctrl + C in IPython file a subprocess
is executing, to get closer to how a "proper" shell behaves.
Other signal processing may be implemented later on.
If _ip.options.verbose is true, show exit status if nonzero
"""
vivainio
ipy_signals win32 version
r480 import signal,os,sys
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 from IPython.core import ipapi
vivainio
Add ipy_signals for better ctrl + C processing
r477 import subprocess
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 ip = ipapi.get()
vivainio
Add ipy_signals for better ctrl + C processing
r477
vivainio
ipy_signals win32 version
r480 def new_ipsystem_posix(cmd):
vivainio
Add ipy_signals for better ctrl + C processing
r477 """ ctrl+c ignoring replacement for system() command in iplib.
Bernardo B. Marques
remove all trailling spaces
r4872
Ignore ctrl + c in IPython process during the command execution.
vivainio
Add ipy_signals for better ctrl + C processing
r477 The subprocess will still get the ctrl + c signal.
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
ipy_signals win32 version
r480 posix implementation
vivainio
Add ipy_signals for better ctrl + C processing
r477 """
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
Add ipy_signals for better ctrl + C processing
r477 p = subprocess.Popen(cmd, shell = True)
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
Add ipy_signals for better ctrl + C processing
r477 old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
pid,status = os.waitpid(p.pid,0)
signal.signal(signal.SIGINT, old_handler)
if status and ip.options.verbose:
print "[exit status: %d]" % status
Bernardo B. Marques
remove all trailling spaces
r4872
def new_ipsystem_win32(cmd):
vivainio
ipy_signals win32 version
r480 """ ctrl+c ignoring replacement for system() command in iplib.
Bernardo B. Marques
remove all trailling spaces
r4872
Ignore ctrl + c in IPython process during the command execution.
vivainio
ipy_signals win32 version
r480 The subprocess will still get the ctrl + c signal.
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
ipy_signals win32 version
r480 win32 implementation
"""
old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
status = os.system(cmd)
signal.signal(signal.SIGINT, old_handler)
if status and ip.options.verbose:
print "[exit status: %d]" % status
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
Add ipy_signals for better ctrl + C processing
r477 def init():
o = ip.options
try:
o.verbose
except AttributeError:
o.allow_new_attr (True )
o.verbose = 0
Bernardo B. Marques
remove all trailling spaces
r4872
ip.system = (sys.platform == 'win32' and new_ipsystem_win32 or
vivainio
ipy_signals win32 version
r480 new_ipsystem_posix)
Bernardo B. Marques
remove all trailling spaces
r4872
vivainio
Add ipy_signals for better ctrl + C processing
r477 init()