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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 20 18:21:45 PDT 2016


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/fca82ba19a10/
Changeset:   fca82ba19a10
Branch:      yt
User:        ngoldbaum
Date:        2016-07-20 21:54:47+00:00
Summary:     [bugfix] Only tupleize fields passed to command-line plotting if they're not None
Affected #:  1 file

diff -r b44c0b1bb9d3cf0c8827c36e9bb133ca6cf14812 -r fca82ba19a10cedfc232b6e96e62eeb0dda87873 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -144,14 +144,16 @@
         self = cls()
         # Check for some things we know; for instance, comma separated
         # field names should be parsed as tuples.
-        if hasattr(args, 'field') and ',' in args.field:
-            if args.field.count(",") > 1:
-                raise YTFieldNotParseable(args.field)
-            args.field = tuple(_.strip() for _ in args.field.split(","))
-        if hasattr(args, 'weight') and ',' in args.weight:
-            if args.weight.count(",") > 1:
-                raise YTFieldNotParseable(args.weight)
-            args.weight = tuple(_.strip() for _ in args.weight.split(","))
+        if hasattr(args, 'field'):
+            if args.field is not None and ',' in args.field:
+                if args.field.count(",") > 1:
+                    raise YTFieldNotParseable(args.field)
+                args.field = tuple(_.strip() for _ in args.field.split(","))
+        if hasattr(args, 'weight'):
+            if args.weight is not None and ',' in args.weight:
+                if args.weight.count(",") > 1:
+                    raise YTFieldNotParseable(args.weight)
+                args.weight = tuple(_.strip() for _ in args.weight.split(","))
         # Some commands need to be run repeatedly on datasets
         # In fact, this is the rule and the opposite is the exception
         # BUT, we only want to parse the arguments once.


https://bitbucket.org/yt_analysis/yt/commits/33224f46382b/
Changeset:   33224f46382b
Branch:      yt
User:        ngoldbaum
Date:        2016-07-20 22:01:03+00:00
Summary:     Make none checking use less nesting
Affected #:  1 file

diff -r fca82ba19a10cedfc232b6e96e62eeb0dda87873 -r 33224f46382b503005b82309949b44b71b5c4130 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -144,16 +144,14 @@
         self = cls()
         # Check for some things we know; for instance, comma separated
         # field names should be parsed as tuples.
-        if hasattr(args, 'field'):
-            if args.field is not None and ',' in args.field:
-                if args.field.count(",") > 1:
-                    raise YTFieldNotParseable(args.field)
-                args.field = tuple(_.strip() for _ in args.field.split(","))
-        if hasattr(args, 'weight'):
-            if args.weight is not None and ',' in args.weight:
-                if args.weight.count(",") > 1:
-                    raise YTFieldNotParseable(args.weight)
-                args.weight = tuple(_.strip() for _ in args.weight.split(","))
+        if getattr(args, 'field', None) is not None and ',' in args.field:
+            if args.field.count(",") > 1:
+                raise YTFieldNotParseable(args.field)
+            args.field = tuple(_.strip() for _ in args.field.split(","))
+        if getattr(args, 'weight', None) is not None and ',' in args.weight:
+            if args.weight.count(",") > 1:
+                raise YTFieldNotParseable(args.weight)
+            args.weight = tuple(_.strip() for _ in args.weight.split(","))
         # Some commands need to be run repeatedly on datasets
         # In fact, this is the rule and the opposite is the exception
         # BUT, we only want to parse the arguments once.

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