mailr16262 - in /branches/uf_redesign: arg_check.py relax_errors.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 13, 2012 - 11:44:
Author: bugman
Date: Sun May 13 11:44:02 2012
New Revision: 16262

URL: http://svn.gna.org/viewcvs/relax?rev=16262&view=rev
Log:
Created RelaxValListValError and RelaxNoneValListValError for the 
arg_check.is_val_or_list() fn.


Modified:
    branches/uf_redesign/arg_check.py
    branches/uf_redesign/relax_errors.py

Modified: branches/uf_redesign/arg_check.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/arg_check.py?rev=16262&r1=16261&r2=16262&view=diff
==============================================================================
--- branches/uf_redesign/arg_check.py (original)
+++ branches/uf_redesign/arg_check.py Sun May 13 11:44:02 2012
@@ -35,7 +35,7 @@
     float128 = float64    # Support for 32-bit numpy versions.
 
 # relax module imports.
-from relax_errors import RelaxBoolError, RelaxFloatError, 
RelaxFunctionError, RelaxIntError, RelaxIntListIntError, RelaxListFloatError, 
RelaxListIntError, RelaxMatrixFloatError, RelaxNoneFloatError, 
RelaxNoneFunctionError, RelaxListNumError, RelaxListStrError, RelaxNoneError, 
RelaxNoneIntError, RelaxNoneIntListIntError, RelaxNoneListFloatError, 
RelaxNoneListIntError, RelaxNoneMatrixFloatError, RelaxNoneListNumError, 
RelaxNoneListStrError, RelaxNoneNumError, RelaxNoneNumStrListNumStrError, 
RelaxNoneNumTupleNumError, RelaxNoneStrError, RelaxNoneStrFileError, 
RelaxNoneStrListNumError, RelaxNoneStrListStrError, RelaxNumError, 
RelaxNumStrListNumStrError, RelaxNumTupleNumError, RelaxStrError, 
RelaxStrFileError, RelaxStrListNumError, RelaxStrListStrError, 
RelaxTupleError, RelaxTupleNumError
+from relax_errors import RelaxBoolError, RelaxFloatError, 
RelaxFunctionError, RelaxIntError, RelaxIntListIntError, RelaxListFloatError, 
RelaxListIntError, RelaxMatrixFloatError, RelaxNoneFloatError, 
RelaxNoneFunctionError, RelaxListNumError, RelaxListStrError, RelaxNoneError, 
RelaxNoneIntError, RelaxNoneIntListIntError, RelaxNoneListFloatError, 
RelaxNoneListIntError, RelaxNoneMatrixFloatError, RelaxNoneListNumError, 
RelaxNoneListStrError, RelaxNoneNumError, RelaxNoneNumStrListNumStrError, 
RelaxNoneNumTupleNumError, RelaxNoneStrError, RelaxNoneStrFileError, 
RelaxNoneStrListNumError, RelaxNoneStrListStrError, RelaxNumError, 
RelaxNumStrListNumStrError, RelaxNumTupleNumError, RelaxStrError, 
RelaxStrFileError, RelaxStrListNumError, RelaxStrListStrError, 
RelaxTupleError, RelaxTupleNumError, RelaxNoneValListValError, 
RelaxValListValError
 from relax_io import DummyFileObject
 from types import FunctionType, MethodType
 
@@ -1231,13 +1231,13 @@
         if not raise_error:
             return False
         if can_be_none and size != None:
-            raise RelaxNoneNumStrListNumStrError(name, arg, size)
-        elif can_be_none:
-            raise RelaxNoneNumStrListNumStrError(name, arg)
+            raise RelaxNoneValListValError(name, arg, size)
+        elif can_be_none:
+            raise RelaxNoneValListValError(name, arg)
         elif size != None:
-            raise RelaxNumStrListNumStrError(name, arg, size)
-        else:
-            raise RelaxNumStrListNumStrError(name, arg)
-
-    # Success.
-    return True
+            raise RelaxValListValError(name, arg, size)
+        else:
+            raise RelaxValListValError(name, arg)
+
+    # Success.
+    return True

Modified: branches/uf_redesign/relax_errors.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/relax_errors.py?rev=16262&r1=16261&r2=16262&view=diff
==============================================================================
--- branches/uf_redesign/relax_errors.py (original)
+++ branches/uf_redesign/relax_errors.py Sun May 13 11:44:02 2012
@@ -52,6 +52,7 @@
 LIST_INT = 'a list of integers'
 LIST_NUM = 'a list of numbers'
 LIST_STR = 'a list of strings'
+LIST_VAL = 'a list of values'
 MATRIX_FLOAT = 'a matrix of floating point numbers'
 NONE = 'None'
 NUM = 'a number'
@@ -61,6 +62,7 @@
 TUPLE_NUM = 'a tuple of numbers'
 TUPLE_STR = 'a tuple of strings'
 STR = 'a string'
+VAL = 'a value'
 
 
 def save_state():
@@ -497,6 +499,15 @@
     simple_types = [NONE, STR]
     list_types = [LIST_STR]
 
+# Value or list of values.
+class RelaxValListValError(BaseArgError):
+    simple_types = [VAL]
+    list_types = [LIST_VAL]
+
+class RelaxNoneValListValError(BaseArgError):
+    simple_types = [NONE, VAL]
+    list_types = [LIST_VAL]
+
 
 # Tuple types.
 #~~~~~~~~~~~~~




Related Messages


Powered by MHonArc, Updated Sun May 13 12:00:02 2012