Skip to content
This repository

i658 #660

Merged
merged 1 commit into from over 2 years ago

2 participants

Min RK Fernando Perez
Min RK
Owner

move InteractiveShellApp before TerminalIPythonApp in TerminalApp class list

This is useful because InteractiveShellApp is a parent that affects
all IPython apps, so it makes sense to come first.

The change affects auto generated ipython_config.py and the output
of ipython --help-all.

Also prevents duplicate entries for self.__class__

closes gh-658

Min RK move InteractiveShellApp before TerminalIPythonApp in TerminalApp cla…
…ss list

This is useful because InteractiveShellApp is a parent that affects
all IPython apps, so it makes sense to come first.

The change affects auto generated ipython_config.py and the output
of `ipython --help-all`.

Also prevents duplicate entries for `self.__class__`

closes gh-658
da4180d
Fernando Perez
Owner

+1, merge away. Thanks for taking care of it quickly!

Min RK minrk merged commit d932a91 into from August 01, 2011
Min RK minrk closed this August 01, 2011
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 01, 2011
Min RK move InteractiveShellApp before TerminalIPythonApp in TerminalApp cla…
…ss list

This is useful because InteractiveShellApp is a parent that affects
all IPython apps, so it makes sense to come first.

The change affects auto generated ipython_config.py and the output
of `ipython --help-all`.

Also prevents duplicate entries for `self.__class__`

closes gh-658
da4180d
This page is out of date. Refresh to see the latest.
7  IPython/config/application.py
@@ -143,9 +143,10 @@ def _flags_changed(self, name, old, new):
143 143
 
144 144
     def __init__(self, **kwargs):
145 145
         SingletonConfigurable.__init__(self, **kwargs)
146  
-        # Add my class to self.classes so my attributes appear in command line
147  
-        # options.
148  
-        self.classes.insert(0, self.__class__)
  146
+        # Ensure my class is in self.classes, so my attributes appear in command line
  147
+        # options and config files.
  148
+        if self.__class__ not in self.classes:
  149
+            self.classes.insert(0, self.__class__)
149 150
         
150 151
         self.init_logging()
151 152
 
15  IPython/frontend/terminal/ipapp.py
@@ -48,7 +48,7 @@
48 48
 from IPython.utils import warn
49 49
 from IPython.utils.path import get_ipython_dir, check_for_old_config
50 50
 from IPython.utils.traitlets import (
51  
-    Bool, Dict, CaselessStrEnum
  51
+    Bool, List, Dict, CaselessStrEnum
52 52
 )
53 53
 
54 54
 #-----------------------------------------------------------------------------
@@ -189,8 +189,17 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
189 189
 
190 190
     flags = Dict(flags)
191 191
     aliases = Dict(aliases)
192  
-    classes = [InteractiveShellApp, TerminalInteractiveShell, ProfileDir,
193  
-               PlainTextFormatter]
  192
+    classes = List()
  193
+    def _classes_default(self):
  194
+        """This has to be in a method, for TerminalIPythonApp to be available."""
  195
+        return [
  196
+            InteractiveShellApp, # ShellApp comes before TerminalApp, because
  197
+            self.__class__,      # it will also affect subclasses (e.g. QtConsole)
  198
+            TerminalInteractiveShell,
  199
+            ProfileDir,
  200
+            PlainTextFormatter,
  201
+        ]
  202
+    
194 203
     subcommands = Dict(dict(
195 204
         qtconsole=('IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp',
196 205
             """Launch the IPython Qt Console."""
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.