[yt-svn] commit/yt: MatthewTurk: Adding a hub_upload command to everything with an _mrep.

Bitbucket commits-noreply at bitbucket.org
Wed May 9 11:40:33 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/052af798ab30/
changeset:   052af798ab30
branch:      yt
user:        MatthewTurk
date:        2012-05-09 20:40:25
summary:     Adding a hub_upload command to everything with an _mrep.
affected #:  4 files

diff -r fa8f89f1a1b1a53e5d966f305f92dc600bd4273f -r 052af798ab3072f5ff52ac384965e8dab998d19a yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1152,6 +1152,9 @@
     def _mrep(self):
         return MinimalSliceData(self)
 
+    def hub_upload(self):
+        self._mrep.upload()
+
 class AMRCuttingPlaneBase(AMR2DData):
     _plane = None
     _top_node = "/CuttingPlanes"
@@ -1673,6 +1676,9 @@
     def _mrep(self):
         return MinimalProjectionData(self)
 
+    def hub_upload(self):
+        self._mrep.upload()
+
     def _convert_field_name(self, field):
         if field == "weight_field": return "weight_field_%s" % self._weight
         if field in self._key_fields: return field


diff -r fa8f89f1a1b1a53e5d966f305f92dc600bd4273f -r 052af798ab3072f5ff52ac384965e8dab998d19a yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -128,6 +128,9 @@
     def _mrep(self):
         return MinimalStaticOutput(self)
 
+    def hub_upload(self):
+        self._mrep.upload()
+
     @classmethod
     def _is_valid(cls, *args, **kwargs):
         return False


diff -r fa8f89f1a1b1a53e5d966f305f92dc600bd4273f -r 052af798ab3072f5ff52ac384965e8dab998d19a yt/utilities/minimal_representation.py
--- a/yt/utilities/minimal_representation.py
+++ b/yt/utilities/minimal_representation.py
@@ -183,14 +183,25 @@
         chunks = [(fn, d) for fn, d in self.images]
         return (metadata, ('images', chunks))
 
+_hub_categories = ("News", "Documents", "Simulation Management",
+                   "Data Management", "Analysis and Visualization",
+                   "Paper Repositories", "Astrophysical Utilities",
+                   "yt Scripts")
+
 class MinimalProjectDescription(MinimalRepresentation):
     type = "project"
     _attr_list = ("title", "url", "description", "category", "image_url")
 
     def __init__(self, title, url, description,
-                 category = "General Purpose Scripts", image_url = ""):
+                 category, image_url = ""):
+        assert(category in _hub_categories)
         self.title = title
         self.url = url
         self.description = description
         self.category = category
         self.image_url = image_url
+
+    def _generate_post(self):
+        metadata = self._attrs
+        chunks = []
+        return (metadata, ("chunks", []))


diff -r fa8f89f1a1b1a53e5d966f305f92dc600bd4273f -r 052af798ab3072f5ff52ac384965e8dab998d19a yt/visualization/plot_collection.py
--- a/yt/visualization/plot_collection.py
+++ b/yt/visualization/plot_collection.py
@@ -144,6 +144,9 @@
         shutil.rmtree(dd)
         return MinimalImageCollectionData(ic)
 
+    def hub_upload(self):
+        self._mrep.upload()
+
     def save(self, basename=None, format="png", override=False, force_save=False):
         r"""Save out all the plots hanging off this plot collection, using
         generated names.

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