From d1ebf45ac6acc62dd56d6863ccf9678b78e787f8 2013-09-25 22:25:24 From: MinRK Date: 2013-09-25 22:25:24 Subject: [PATCH] update bundled profiles to use extend --- diff --git a/IPython/config/profile/cluster/ipython_config.py b/IPython/config/profile/cluster/ipython_config.py index 07df14f..eb4b3fc 100644 --- a/IPython/config/profile/cluster/ipython_config.py +++ b/IPython/config/profile/cluster/ipython_config.py @@ -9,11 +9,5 @@ lines = """ from IPython.parallel import * """ -# You have to make sure that attributes that are containers already -# exist before using them. Simple assigning a new list will override -# all previous values. -if hasattr(app, 'exec_lines'): - app.exec_lines.append(lines) -else: - app.exec_lines = [lines] +app.exec_lines.append(lines) diff --git a/IPython/config/profile/math/ipython_config.py b/IPython/config/profile/math/ipython_config.py index 2b2fe2d..39c5ca7 100644 --- a/IPython/config/profile/math/ipython_config.py +++ b/IPython/config/profile/math/ipython_config.py @@ -10,12 +10,4 @@ import cmath from math import * """ -# You have to make sure that attributes that are containers already -# exist before using them. Simple assigning a new list will override -# all previous values. - -if hasattr(app, 'exec_lines'): - app.exec_lines.append(lines) -else: - app.exec_lines = [lines] - +app.exec_lines.append(lines) diff --git a/IPython/config/profile/pysh/ipython_config.py b/IPython/config/profile/pysh/ipython_config.py index 69d262c..0f3bf6e 100644 --- a/IPython/config/profile/pysh/ipython_config.py +++ b/IPython/config/profile/pysh/ipython_config.py @@ -21,10 +21,4 @@ lines = """ %rehashx """ -# You have to make sure that attributes that are containers already -# exist before using them. Simple assigning a new list will override -# all previous values. -if hasattr(app, 'exec_lines'): - app.exec_lines.append(lines) -else: - app.exec_lines = [lines] +app.exec_lines.append(lines) diff --git a/IPython/config/profile/sympy/ipython_config.py b/IPython/config/profile/sympy/ipython_config.py index b31dae2..6004cf1 100644 --- a/IPython/config/profile/sympy/ipython_config.py +++ b/IPython/config/profile/sympy/ipython_config.py @@ -13,18 +13,8 @@ k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) """ -# You have to make sure that attributes that are containers already -# exist before using them. Simple assigning a new list will override -# all previous values. - -if hasattr(app, 'exec_lines'): - app.exec_lines.append(lines) -else: - app.exec_lines = [lines] +app.exec_lines.append(lines) # Load the sympy_printing extension to enable nice printing of sympy expr's. -if hasattr(app, 'extensions'): - app.extensions.append('sympyprinting') -else: - app.extensions = ['sympyprinting'] +app.extensions.append('sympy.interactive.ipythonprinting')