[Yt-svn] yt-commit r1658 - trunk/yt
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Tue Mar 9 21:05:33 PST 2010
Author: mturk
Date: Tue Mar 9 21:05:32 2010
New Revision: 1658
URL: http://yt.enzotools.org/changeset/1658
Log:
* Updating cmdln.py to the newest version
* Renaming 'commands.py' to 'command_line.py' to avoid conflicts.
* Added 'yt load' command to load up a parameter file and end up in an IPython
shell.
Added:
trunk/yt/command_line.py
- copied, changed from r1657, /trunk/yt/commands.py
Removed:
trunk/yt/commands.py
Modified:
trunk/yt/cmdln.py
Modified: trunk/yt/cmdln.py
==============================================================================
--- trunk/yt/cmdln.py (original)
+++ trunk/yt/cmdln.py Tue Mar 9 21:05:32 2010
@@ -35,7 +35,7 @@
details.
"""
-__version_info__ = (1, 1, 1)
+__version_info__ = (1, 1, 2)
__version__ = '.'.join(map(str, __version_info__))
import os
@@ -272,8 +272,8 @@
Returns the return value from the command handler.
"""
- assert (isinstance(argv, (list, tuple)),
- "'argv' is not a sequence: %r" % argv)
+ assert isinstance(argv, (list, tuple)), \
+ "'argv' is not a sequence: %r" % argv
retval = None
try:
argv = self.precmd(argv)
@@ -327,8 +327,8 @@
while not self.stop:
if self.cmdqueue:
argv = self.cmdqueue.pop(0)
- assert (isinstance(argv, (list, tuple)),
- "item on 'cmdqueue' is not a sequence: %r" % argv)
+ assert isinstance(argv, (list, tuple)), \
+ "item on 'cmdqueue' is not a sequence: %r" % argv
else:
if self.use_rawinput:
try:
Copied: trunk/yt/command_line.py (from r1657, /trunk/yt/commands.py)
==============================================================================
--- /trunk/yt/commands.py (original)
+++ trunk/yt/command_line.py Tue Mar 9 21:05:32 2010
@@ -332,6 +332,26 @@
_vcs_updater[vc_type](path)
print "Updated successfully."
+ def do_load(self, subcmd, opts, arg):
+ """
+ Load a single dataset into an IPython instance.
+
+ ${cmd_option_list}
+ """
+ try:
+ pf = _fix_pf(arg)
+ except IOError:
+ print "Could not load file."
+ import yt.mods
+ from IPython.Shell import IPShellEmbed
+ 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!"
+ )
+
@add_cmd_options(['outputfn','bn','thresh','dm_only','skip'])
@check_args
def do_hop(self, subcmd, opts, arg):
More information about the yt-svn
mailing list