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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 2 12:59:05 PDT 2013


2 new commits in yt-3.0:

https://bitbucket.org/yt_analysis/yt-3.0/commits/aba44265d752/
Changeset:   aba44265d752
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-07-02 16:39:54
Summary:     Adding a new exception, subclassing YTFieldNotFound

This is for instances when a field could not be generated.  Since this
subclasses YTFieldNotFound, existing machinery for catching that particular
exception will continue to work.  And, we should now have a generic solution to
the problem of fields returning None.  However, this may result in additional
derived fields being swallowed rather than created.
Affected #:  2 files

diff -r 2b865392b01b1f5458947d629dee2707c8140765 -r aba44265d752191a46e8a6a7a6bb86385ad4938d yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -219,11 +219,14 @@
         finfo = self.pf._get_field_info(*field)
         with self._field_type_state(ftype, finfo):
             if fname in self._container_fields:
-                return self._generate_container_field(field)
+                tr = self._generate_container_field(field)
             if finfo.particle_type:
-                return self._generate_particle_field(field)
+                tr = self._generate_particle_field(field)
             else:
-                return self._generate_fluid_field(field)
+                tr = self._generate_fluid_field(field)
+            if tr is None:
+                raise YTCouldNotGenerateField(field, self.pf)
+            return tr
 
     def _generate_fluid_field(self, field):
         # First we check the validator

diff -r 2b865392b01b1f5458947d629dee2707c8140765 -r aba44265d752191a46e8a6a7a6bb86385ad4938d yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -77,6 +77,10 @@
     def __str__(self):
         return "Could not find field '%s' in %s." % (self.fname, self.pf)
 
+class YTCouldNotGenerateField(YTFieldNotFound):
+    def __str__(self):
+        return "Could field '%s' in %s could not be generated." % (self.fname, self.pf)
+
 class YTFieldTypeNotFound(YTException):
     def __init__(self, fname):
         self.fname = fname


https://bitbucket.org/yt_analysis/yt-3.0/commits/8594e3c7ecb9/
Changeset:   8594e3c7ecb9
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-02 21:59:01
Summary:     Merged in MatthewTurk/yt-3.0 (pull request #57)

Adding a new exception, subclassing YTFieldNotFound
Affected #:  2 files

diff -r 67d98f2ef85c7831a1f5bb0c640b06ed89ea151a -r 8594e3c7ecb9f39175b2013eb0adb5bfda100aa3 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -219,11 +219,14 @@
         finfo = self.pf._get_field_info(*field)
         with self._field_type_state(ftype, finfo):
             if fname in self._container_fields:
-                return self._generate_container_field(field)
+                tr = self._generate_container_field(field)
             if finfo.particle_type:
-                return self._generate_particle_field(field)
+                tr = self._generate_particle_field(field)
             else:
-                return self._generate_fluid_field(field)
+                tr = self._generate_fluid_field(field)
+            if tr is None:
+                raise YTCouldNotGenerateField(field, self.pf)
+            return tr
 
     def _generate_fluid_field(self, field):
         # First we check the validator

diff -r 67d98f2ef85c7831a1f5bb0c640b06ed89ea151a -r 8594e3c7ecb9f39175b2013eb0adb5bfda100aa3 yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -77,6 +77,10 @@
     def __str__(self):
         return "Could not find field '%s' in %s." % (self.fname, self.pf)
 
+class YTCouldNotGenerateField(YTFieldNotFound):
+    def __str__(self):
+        return "Could field '%s' in %s could not be generated." % (self.fname, self.pf)
+
 class YTFieldTypeNotFound(YTException):
     def __init__(self, fname):
         self.fname = fname

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

--

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