Exemplo n.º 1
0
 def checker(self, x):
     if type(x) is not types.ListType:
         parameter.raiseTypeError(type(x), "list of Points")
     for y in x:
         if not isinstance(y, Point):
             parameter.raiseTypeError("list of %s" % type(y),
                                      "list of Points")
Exemplo n.º 2
0
 def checker(self, x):
     if type(x) is not types.ListType:
         parameter.raiseTypeError(type(x), "list of Points")
     for y in x:
         if not isinstance(y, primitives.Point):
             parameter.raiseTypeError("list of %s" % type(y),
                                      "list of Points")
Exemplo n.º 3
0
 def checker(self, x):
     if not isinstance(x, (ListType, TupleType)):
         parameter.raiseTypeError(type(x), "list of index pairs")
     for s in x:
         if not (isinstance(s, StringType) and len(s) == 2 and s[0] in "123"
                 and s[1] in "123456"):
             parameter.raiseTypeError("list of %s" % typename(type(s)),
                                      "list of index pairs [1-3][1-6]")
Exemplo n.º 4
0
 def checker(self, x):
     # A single ProfileXT or a FluxProfileSet is allowed
     if isinstance(x, ProfileXT) or isinstance(x, FluxProfileSet):
         return
     # A list or tuple of Profiles is allowed
     if type(x) in (types.ListType, types.TupleType):
         for y in x:
             if not isinstance(y, ProfileXT):
                 parameter.raiseTypeError('List or tuple of '+ type(y),
                                          'List of Profiles')
     parameter.raiseTypeError(type(x), 'List of Profiles, or FluxProfileSet')
Exemplo n.º 5
0
 def checker(self, x):
     # A single ProfileXT or a FluxProfileSet is allowed
     if isinstance(x, ProfileXT) or isinstance(x, FluxProfileSet):
         return
     # A list or tuple of Profiles is allowed
     if type(x) in (types.ListType, types.TupleType):
         for y in x:
             if not isinstance(y, ProfileXT):
                 parameter.raiseTypeError('List or tuple of ' + type(y),
                                          'List of Profiles')
     parameter.raiseTypeError(type(x),
                              'List of Profiles, or FluxProfileSet')
Exemplo n.º 6
0
 def set(self, value):
     if value is None:
         self._set(value)
     else:
         if type(value) is not types.ListType:
             parameter.raiseTypeError(
                 'list of objects from' + `self.classnames()`, value)
         convertedval = []
         for e in value:
             if type(e) is types.StringType: # string representation of enum
                 for ec in self.enumclasses:
                     if e in ec.names:
                         convertedval.append(ec(e))
                         break
                 else:
                     parameter.raiseTypeError(
                         'list of objects from' + `self.classnames()`, value)
             else:                   # not a string
                 for ec in self.enumclasses:
                     if isinstance(e, ec):
                         convertedval.append(e)
                         break
                 else:
                     parameter.raiseTypeError(
                         'list of objects from' + `self.classnames()`, value)
         self._set(convertedval)
Exemplo n.º 7
0
 def checker(self, x):
     if not isinstance(x, Output):
         parameter.raiseTypeError(type(x), 'Output')
Exemplo n.º 8
0
 def checker(self, x):
     if not isinstance(x, flux.FluxPtr):
         parameter.raiseTypeError(x, "Flux")
Exemplo n.º 9
0
 def checker(self, x):
     if not isinstance(x, field.FieldPtr):
         parameter.raiseTypeError(x, "Field")
Exemplo n.º 10
0
 def checker(self, x):
     if not isinstance(
             x, equation.EquationPtr) or not x.allow_boundary_conditions():
         parameter.raiseTypeError(x, "Equation with BC capability")
Exemplo n.º 11
0
 def checker(self, x):
     if not isinstance(x, equation.EquationPtr):
         parameter.raiseTypeError(x, "Equation")
Exemplo n.º 12
0
 def checker(self, x):
     if not isinstance(x, Output):
         parameter.raiseTypeError(type(x), 'Output')
Exemplo n.º 13
0
 def checker(self, x):
     if not (isinstance(x, Output)
             and issubclass(x.otype, outputval.ScalarOutputValPtr)):
         parameter.raiseTypeError(type(x), 'Scalar Output')
Exemplo n.º 14
0
 def checker(self, x):
     if not isinstance(x, flux.FluxPtr):
         parameter.raiseTypeError(x, "Flux")
Exemplo n.º 15
0
 def checker(self, x):
     if not isinstance(x, equation.EquationPtr):
         parameter.raiseTypeError(x, "Equation")
Exemplo n.º 16
0
 def checker(self, x):
     if not (isinstance(x, Output)
             and issubclass(x.otype, outputval.ScalarOutputValPtr)):
         parameter.raiseTypeError(type(x), 'Scalar Output')
Exemplo n.º 17
0
 def checker(self, x):
     if not isinstance(x, Output):
         parameter.raiseTypeError(type(x), 'Position Output')
     PositionOutputParameter.oktypes(x.otype)
Exemplo n.º 18
0
 def checker(self, x):
     if not isinstance(x, equation.EquationPtr) or not x.allow_boundary_conditions():
         parameter.raiseTypeError(x, "Equation with BC capability")
Exemplo n.º 19
0
 def checker(self, x):
     if not isinstance(x, Output):
         parameter.raiseTypeError(type(x), 'Position Output')
     PositionOutputParameter.oktypes(x.otype)
Exemplo n.º 20
0
 def checker(self, x):
     if not isinstance(x, field.FieldPtr):
         parameter.raiseTypeError(x, "Field")