Exemplo n.º 1
0
 def __init__( self, value, description = 'No description', validator = None ):
     if validator:
         checkType( validator, FUNCTION )
         self._validator = validator
         validator( value )
     self._value = value
     self.description = description
Exemplo n.º 2
0
 def setFunction( self, function ):
     self._function = function
     self.argList = []
     self.parameters = {}
     if function is None: return
     checkType( function, FUNCTION )
     if type( function ) is LabradSetting:
         self.parameters = {}
         if function.parameters is None:
             return
         [self.parameters.update( {index:Parameter( index, Input( None ), parameter )} ) for index, parameter in enumerate( function.parameters )]
         return
     argNames, defs = ( inspect.getargspec( function )[i] for i in ( 0, 3 ) )
     defs = [] if defs is None else defs
     argVals = [None for i in range( len( argNames ) - len( defs ) )]
     argVals.extend( defs )
     parameters = {}
     for index, argTup in enumerate( zip( argNames, argVals ) ):
         parameters[index] = Parameter( index, Input( argTup[1] ), argTup[0] )
     self.parameters = parameters
Exemplo n.º 3
0
 def __init__( self, name, input = None, description = 'No description' ):
     checkType( name, str, int )
     self._name = name
     if input is not None: checkType( input, Input )
     self._input = input
     checkType( description, str )
     self._description = description
Exemplo n.º 4
0
 def setDescription( self, description ):
     checkType( description, str )
     self._description = description
Exemplo n.º 5
0
 def setInput( self, input ):
     checkType( input, Input )
     self._input = input
Exemplo n.º 6
0
 def __init__( self, function = None ):
     if function is not None: checkType( function, FUNCTION )
     self.function = function
     if type( self ) is Function: raise LRExpError( 'Do not instantiate Function class' )