[Yt-svn] commit/yt: MatthewTurk: Adding "intents" to the cookbook repository.

Bitbucket commits-noreply at bitbucket.org
Fri Jun 10 18:09:24 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/d8c1137e795a/
changeset:   d8c1137e795a
branch:      yt
user:        MatthewTurk
date:        2011-06-11 03:09:05
summary:     Adding "intents" to the cookbook repository.

The idea here, and it works for the star_extrema but is not yet pretty, is to
run scripts:

 yt intents # will list all intents it can find
 yt intents star_extrema /path/to/pf # will run the star_extrema with arg

This, hopefully, will help provide a better, more comprehensive set of common
actions.
affected #:  2 files (584 bytes)

--- a/yt/mods.py	Fri Jun 10 13:44:01 2011 -0700
+++ b/yt/mods.py	Fri Jun 10 18:09:05 2011 -0700
@@ -40,6 +40,7 @@
 from yt.utilities.performance_counters import yt_counters, time_function
 from yt.config import ytcfg
 import yt.utilities.physical_constants as physical_constants
+from yt.utilities.cookbook import Intent
 
 from yt.data_objects.api import \
     BinnedProfile1D, BinnedProfile2D, BinnedProfile3D, \


--- a/yt/utilities/command_line.py	Fri Jun 10 13:44:01 2011 -0700
+++ b/yt/utilities/command_line.py	Fri Jun 10 18:09:05 2011 -0700
@@ -1247,6 +1247,24 @@
         while 1:
             time.sleep(1)
 
+    def do_intents(self, subcmd, opts, *intents):
+        """
+        ${cmd_name}: What are your ... intentions?
+
+        ${cmd_usage}
+        ${cmd_option_list}
+        """
+        from yt.utilities.cookbook import Intent
+        if len(intents) == 0:
+            Intent.list_intents()
+        else:
+            intent = Intent.select_intent(intents[0])
+            if intent is None:
+                print "Could not find %s" % intents[0]
+                return 1
+            intent_inst = intent(intents[1:])
+            intent_inst.run()
+
 def run_main():
     for co in ["--parallel", "--paste"]:
         if co in sys.argv: del sys.argv[sys.argv.index(co)]

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