[yt-svn] commit/yt: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Mon Nov 14 15:13:00 PST 2011


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/14494e4be073/
changeset:   14494e4be073
branch:      yt
user:        MatthewTurk
date:        2011-11-15 00:06:34
summary:     Fixing banner display in iyt for 0.11.
affected #:  1 file

diff -r b6202dc21ecc0cce6bc33d3f365bf2a36f7279e5 -r 14494e4be07347bc95be0d3c735b01c303bdc278 scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -7,7 +7,9 @@
 
 doc = """\
 
-Welcome to yt!
+==================
+| Welcome to yt! |
+==================
 
 """
 
@@ -41,7 +43,8 @@
     ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
 elif api_version == "0.11":
     from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
-    ip_shell = TerminalInteractiveShell(user_ns=namespace)
+    ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
+                    display_banner = True)
     if "DISPLAY" in os.environ: ip_shell.enable_pylab(import_all=False)
 else:
     raise RuntimeError



https://bitbucket.org/yt_analysis/yt/changeset/1a28da97864f/
changeset:   1a28da97864f
branch:      yt
user:        MatthewTurk
date:        2011-11-15 00:12:00
summary:     Merging
affected #:  2 files

diff -r 14494e4be07347bc95be0d3c735b01c303bdc278 -r 1a28da97864f5ecfd09e2c842ceb63232bc78894 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -255,16 +255,32 @@
     *num_up* refers to how many frames of the stack get stripped off, and
     defaults to 1 so that this function itself is stripped off.
     """
-    from IPython.Shell import IPShellEmbed
+
+    import IPython
+    if IPython.__version__.startswith("0.10"):
+       api_version = '0.10'
+    elif IPython.__version__.startswith("0.11"):
+       api_version = '0.11'
+
     stack = inspect.stack()
     frame = inspect.stack()[num_up]
     loc = frame[0].f_locals.copy()
     glo = frame[0].f_globals
     dd = dict(fname = frame[3], filename = frame[1],
               lineno = frame[2])
-    ipshell = IPShellEmbed()
-    ipshell(header = __header % dd,
-            local_ns = loc, global_ns = glo)
+    if api_version == '0.10':
+        ipshell = IPython.Shell.IPShellEmbed()
+        ipshell(header = __header % dd,
+                local_ns = loc, global_ns = glo)
+    else:
+        from IPython.config.loader import Config
+        cfg = Config()
+        cfg.InteractiveShellEmbed.local_ns = loc
+        cfg.InteractiveShellEmbed.global_ns = glo
+        IPython.embed(config=cfg, banner2 = __header % dd)
+        from IPython.frontend.terminal.embed import InteractiveShellEmbed
+        ipshell = InteractiveShellEmbed(config=cfg)
+
     del ipshell
 
 


diff -r 14494e4be07347bc95be0d3c735b01c303bdc278 -r 1a28da97864f5ecfd09e2c842ceb63232bc78894 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -466,14 +466,29 @@
             print "Could not load file."
             sys.exit()
         import yt.mods
-        from IPython.Shell import IPShellEmbed
+
+        import IPython
+        if IPython.__version__.startswith("0.10"):
+            api_version = '0.10'
+        elif IPython.__version__.startswith("0.11"):
+            api_version = '0.11'
+
         local_ns = yt.mods.__dict__.copy()
         local_ns['pf'] = pf
-        shell = IPShellEmbed()
-        shell(local_ns = local_ns,
-              header =
-            "\nHi there!  Welcome to yt.\n\nWe've loaded your parameter file as 'pf'.  Enjoy!"
-             )
+
+        if api_version == '0.10':
+            shell = IPython.Shell.IPShellEmbed()
+            shell(local_ns = local_ns,
+                  header =
+                  "\nHi there!  Welcome to yt.\n\nWe've loaded your parameter file as 'pf'.  Enjoy!"
+                  )
+        else:
+            from IPython.config.loader import Config
+            cfg = Config()
+            cfg.InteractiveShellEmbed.local_ns = local_ns
+            IPython.embed(config=cfg)
+            from IPython.frontend.terminal.embed import InteractiveShellEmbed
+            ipshell = InteractiveShellEmbed(config=cfg)
 
     @add_cmd_options(['outputfn','bn','thresh','dm_only','skip'])
     @check_args

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list