control parameters
484488
def cmd_param(self, args):
        ''''''
        self.check_new_target_system()
        sysid = self.get_sysid()
        self.pstate[sysid].handle_command(self.master, self.mpstate, args)
810564
def parameters(self, value):
        """"""
        self.W = value[0] if isinstance(value[0], GPUArray) else \
          gpuarray.to_gpu(value[0])
        self.b = value[1] if isinstance(value[0], GPUArray) else \
          gpuarray.to_gpu(value[1])
952504
def controlPoints(cmd, data):
    
    cmd = cmd.lower()
    if cmd in ['c', 's', 'q']:
        indices = range(len(data))
        if cmd == 'c':  # c: (x1 y1 x2 y2 x y)+
            return [index for index in indices if (index % 6) < 4]
        elif cmd in ['s', 'q']:  # s: (x2 y2 x y)+   q: (x1 y1 x y)+
            return [index for index in indices if (index % 4) < 2]

    return []
804018
def control(self, key):
        """"""
        if not self.connection:
            raise exceptions.ConnectionClosed()

        payload = json.dumps({
            "method": "ms.remote.control",
            "params": {
                "Cmd": "Click",
                "DataOfCmd": key,
                "Option": "false",
                "TypeOfRemote": "SendRemoteKey"
            }
        })

        logging.info("Sending control command: %s", key)
        self.connection.send(payload)
        time.sleep(self._key_interval)
231497
def _make_parameters(self):
        """"""
        self.value_means = []
        self.value_ranges = []
        self.arrangement = []
        self.variable_parameters = []
        current_var = 0
        for parameter in self.parameters:
            if parameter.type == ParameterType.DYNAMIC:
                self.value_means.append(parameter.value[0])
                if parameter.value[1] < 0:
                    raise AttributeError(
                        '"{}" parameter has an invalid range. Range values '
                        'must be greater than zero'.format(parameter.label))
                self.value_ranges.append(parameter.value[1])
                var_label = 'var{}'.format(current_var)
                self.arrangement.append(var_label)
                self.variable_parameters.append(var_label)
                current_var += 1
            elif parameter.type == ParameterType.STATIC:
                self.arrangement.append(parameter.value)
            else:
                raise AttributeError(
                    '"{}"Unknown parameter type ({}). Parameters can be STATIC or'
                    ' DYNAMIC.'.format(parameter.type))
        return
412597
protected function unixParams()
    {
        if ($this->windows) {
            return;
        }
        
        $this->the_command .= $this->redirect_output ? ' > /dev/null 2>&1' : '';
        $this->the_command .= $this->background ? ' &' : '';
        $this->the_command = $this->run_as_user 
                ? 'su -u '.$this->run_as_user.' -c "'.$this->the_command.'"' 
                : $this->the_command;
    }
401565
def _set_parameters(self, parameters):
        """"""
        for theta in self.variables['theta']:
            val = 1.0
            # TODO: improve approach for initializing parameters.
            if parameters is not None:
                if theta.name in parameters:
                    val = parameters[theta.name]
            # Add parameter.
            
            self.link_parameters(Param(theta.name, val, None))
499730
def print_parameters(self):
        
        print("Static: ", self.params_st)
        print("Thermal: ", self.params_th)
        print("Anharmonic: ", self.params_anh)
        print("Electronic: ", self.params_el)
1342359
def controlPoints(self):
        
        # define input variables
        in_point = self.inputPoint()
        in_rect = self.inputRect()

        in_x = in_point.x()
        in_y = in_point.y()

        in_cx = in_rect.center().x()
        in_cy = in_rect.center().y()
        in_left = in_rect.left()
        in_right = in_rect.right()
        in_top = in_rect.top()
        in_bot = in_rect.bottom()
        in_loc = self.inputLocation()

        # define output variables
        out_point = self.outputPoint()
        out_rect = self.outputRect()

        out_x = out_point.x()
        out_y = out_point.y()

        out_cx = out_rect.center().x()
        out_cy = out_rect.center().y()
        out_left = out_rect.left()
        out_right = out_rect.right()
        out_top = out_rect.top()
        out_bot = out_rect.bottom()
        out_loc = self.outputLocation()

        # define global variables
        pad = self.squashThreshold()
        loc_left = XConnectionLocation.Left
        loc_right = XConnectionLocation.Right
        loc_top = XConnectionLocation.Top
        loc_bot = XConnectionLocation.Bottom

        # calculate deltas
        delta_x = abs(in_x - out_x)
        delta_y = abs(in_y - out_y)
        buffer = 2

        # calculate point scenarios

        # right -> left
        if (out_loc & loc_right) and (in_loc & loc_left) and out_right < in_left:
            # no y change, bounding rects don't overlap
            if delta_y < buffer:
                return [(out_x, out_y), (in_x, in_y)]

            # y change, padding deltas don't overlap
            elif out_right + pad < in_left - pad:
                return [(out_x, out_y),
                        (out_x + delta_x / 2.0, out_y),
                        (out_x + delta_x / 2.0, in_y),
                        (in_x, in_y)]

        # left -> right
        if (out_loc & loc_left) and (in_loc & loc_right) and in_right < out_left:
            # no y change, bounding rects don't overlap
            if delta_y < buffer and in_x < out_x:
                return [(out_x, out_y), (in_x, in_y)]

            # y change, padding deltas don't overlap
            elif in_left + pad < out_right - pad:
                return [(out_x, out_y),
                        (out_x - delta_x / 2.0, out_y),
                        (out_x - delta_x / 2.0, in_y),
                        (in_x, in_y)]

        # bottom -> top
        if (out_loc & loc_bot) and (in_loc & loc_top) and out_bot < in_top:
            # no x change, bounding rects don't overlap
            if delta_x < buffer and out_y < in_y:
                return [(out_x, out_y), (in_x, in_y)]

            # x change, pading delta's don't overlap
            elif out_bot + pad < in_top - pad:
                return [(out_x, out_y),
                        (out_x, out_y + delta_y / 2.0),
                        (in_x, out_y + delta_y / 2.0),
                        (in_x, in_y)]

        # top -> bottom
        if (out_loc & loc_top) and (in_loc & loc_bot) and in_bot < out_top:
            # no x change, bounding rects don't overlap
            if delta_x < buffer and in_y < out_y:
                return [(out_x, out_y), (in_x, in_y)]

            # y change, padding deltas don't overlap
            elif in_bot + pad < out_top - pad:
                return [(out_x, out_y),
                        (out_x, out_y - delta_y / 2.0),
                        (in_x, out_y - delta_y / 2.0),
                        (in_x, in_y)]

        # bottom -> left
        if (out_loc & loc_bot) and (in_loc & loc_left):
            if out_y + pad < in_y and out_x + pad < in_x:
                return [(out_x, out_y),
                        (out_x, in_y),
                        (in_x, in_y)]

        # bottom -> right
        if (out_loc & loc_bot) and (in_loc & loc_right):
            if out_y + pad < in_y and out_x - pad > in_x:
                return [(out_x, out_y),
                        (out_x, in_y),
                        (in_x, in_y)]

        # top -> left
        if (out_loc & loc_top) and (in_loc & loc_left):
            if in_y + pad < out_y and out_x + pad < in_x:
                return [(out_x, out_y),
                        (out_x, in_y),
                        (in_x, in_y)]

        # top -> right
        if (out_loc & loc_top) and (in_loc & loc_right):
            if in_y + pad < out_y and out_x - pad > in_x:
                return [(out_x, out_y),
                        (out_x, in_y),
                        (in_x, in_y)]

        # right -> top
        if (out_loc & loc_right) and (in_loc & loc_top):
            if out_x + pad < in_x and out_y - pad < in_y:
                return [(out_x, out_y),
                        (in_x, out_y),
                        (in_x, in_y)]

        # right -> bottom
        if (out_loc & loc_right) and (in_loc & loc_bot):
            if out_x + pad < in_x and out_y + pad > in_y:
                return [(out_x, out_y),
                        (in_x, out_y),
                        (in_x, in_y)]

        # left -> top
        if (out_loc & loc_left) and (in_loc & loc_top):
            if in_x + pad < out_x and out_y - pad < in_y:
                return [(out_x, out_y),
                        (in_x, out_y),
                        (in_x, in_y)]

        # left -> bottom
        if (out_loc & loc_left) and (in_loc & loc_bot):
            if in_x + pad < out_x and out_y + pad > in_y:
                return [(out_x, out_y),
                        (in_x, out_y),
                        (in_x, in_y)]

        # right -> right
        if (out_loc & loc_right) and (in_loc & loc_right):
            max_x = max(out_right + 2 * pad, in_right + 2 * pad)
            if out_cx <= in_cx or not (out_loc & loc_left and in_loc & loc_left):
                return [(out_x, out_y),
                        (max_x, out_y),
                        (max_x, in_y),
                        (in_x, in_y)]

        # left -> left
        if (out_loc & loc_left) and (in_loc & loc_left):
            min_x = min(out_left - 2 * pad, in_left - 2 * pad)
            return [(out_x, out_y),
                    (min_x, out_y),
                    (min_x, in_y),
                    (in_x, in_y)]

        # top -> top
        if (out_loc & loc_top) and (in_loc & loc_top):
            if out_cy <= in_cy or not (out_loc & loc_bot and in_loc & loc_bot):
                min_y = min(out_top - 2 * pad, in_top - 2 * pad)
                return [(out_x, out_y),
                        (out_x, min_y),
                        (in_x, min_y),
                        (in_x, in_y)]

        # bottom -> bottom
        if (out_loc & loc_bot) and (in_loc & loc_bot):
            max_y = max(out_y + 2 * pad, out_y + 2 * pad)
            return [(out_x, out_y),
                    (out_x, max_y),
                    (in_x, max_y),
                    (in_x, in_y)]

        # right -> left with center squash
        if (out_loc & loc_right) and (in_loc & loc_left):
            if out_bot < in_top:
                mid_y = out_bot + (in_top - out_bot) / 2.0
            elif in_bot < out_top:
                mid_y = in_bot + (out_top - in_bot) / 2.0
            else:
                mid_y = None

            if mid_y:
                return [(out_x, out_y),
                        (out_x + 2 * pad, out_y),
                        (out_x + 2 * pad, mid_y),
                        (in_x - 2 * pad, mid_y),
                        (in_x - 2 * pad, in_y),
                        (in_x, in_y)]

        # left -> right with center squash
        if (out_loc & loc_left) and (in_loc & loc_right):
            if out_bot < in_top:
                mid_y = in_top + (in_top - out_bot) / 2.0
            elif in_bot < out_top:
                mid_y = out_top - (out_top - in_bot) / 2.0
            else:
                mid_y = None

            if mid_y:
                return [(out_x, out_y),
                        (out_x - 2 * pad, out_y),
                        (out_x - 2 * pad, mid_y),
                        (in_x + 2 * pad, mid_y),
                        (in_x + 2 * pad, in_y),
                        (in_x, in_y)]

        # bottom -> top with center squash
        if (out_loc & loc_bot) and (in_loc & loc_top):
            if out_right < in_left:
                mid_x = out_right + (in_left - out_right) / 2.0
            elif in_right < out_left:
                mid_x = in_right + (out_left - in_right) / 2.0
            else:
                mid_x = None

            if mid_x:
                return [(out_x, out_y),
                        (out_x, out_y + 2 * pad),
                        (mid_x, out_y + 2 * pad),
                        (mid_x, in_y - 2 * pad),
                        (in_x, in_y - 2 * pad),
                        (in_x, in_y)]

        # top -> bottom with center squash
        if (out_loc & loc_top) and (in_loc & loc_bot):
            if out_right < in_left:
                mid_x = in_left + (in_left - out_right) / 2.0
            elif in_right < out_left:
                mid_x = out_left - (out_left - in_right) / 2.0
            else:
                mid_x = None

            if mid_x:
                return [(out_x, out_y),
                        (out_x, out_y - 2 * pad),
                        (mid_x, out_y - 2 * pad),
                        (mid_x, in_y + 2 * pad),
                        (in_x, in_y + 2 * pad),
                        (in_x, in_y)]

        # right -> left with looping
        if (out_loc & loc_right) and (in_loc & loc_left):
            max_y = max(out_bot + 2 * pad, in_bot + 2 * pad)
            return [(out_x, out_y),
                    (out_x + 2 * pad, out_y),
                    (out_x + 2 * pad, max_y),
                    (in_x - 2 * pad, max_y),
                    (in_x - 2 * pad, in_y),
                    (in_x, in_y)]

        # left -> right with looping
        if (out_loc & loc_left) and (in_loc & loc_right):
            max_y = max(out_bot + 2 * pad, in_bot + 2 * pad)
            return [(out_x, out_y),
                    (out_x - 2 * pad, out_y),
                    (out_x - 2 * pad, max_y),
                    (in_x + 2 * pad, max_y),
                    (in_x + 2 * pad, in_y),
                    (in_x, in_y)]

        # bottom -> top with looping
        if (out_loc & loc_bot) and (in_loc & loc_top):
            max_x = max(out_right + 2 * pad, in_right + 2 * pad)
            return [(out_x, out_y),
                    (out_x, out_y + 2 * pad),
                    (max_x, out_y + 2 * pad),
                    (max_x, in_y - 2 * pad),
                    (in_x, in_y - 2 * pad),
                    (in_x, in_y)]

        # top -> bottom with looping
        if (out_loc & loc_top) and (in_loc & loc_bot):
            max_x = max(out_right + 2 * pad, in_right + 2 * pad)
            return [(out_x, out_y),
                    (out_x, out_y - 2 * pad),
                    (max_x, out_y - 2 * pad),
                    (max_x, in_y + 2 * pad),
                    (in_x, in_y + 2 * pad),
                    (in_x, in_y)]

        # right -> right with looping
        if (out_loc & loc_right) and (in_loc & loc_right):
            max_y = max(out_bot + 2 * pad, in_bot + 2 * pad)
            mid_x = out_left - abs(out_left - in_right) / 2.0
            return [(out_x, out_y),
                    (out_x + 2 * pad, out_y),
                    (out_x + 2 * pad, max_y),
                    (mid_x, max_y),
                    (mid_x, in_y),
                    (in_x, in_y)]

        # left -> left with looping
        if (out_loc & loc_left) and (in_loc & loc_left):
            max_y = max(out_bot + 2 * pad, in_bot + 2 * pad)
            mid_x = in_left - abs(in_left - out_right) / 2.0
            return [(out_x, out_y),
                    (out_x - 2 * pad, out_y),
                    (out_x - 2 * pad, max_y),
                    (mid_x, max_y),
                    (mid_x, in_y),
                    (in_x, in_y)]

        # unknown, return a direct route
        return [(out_x, out_y), (in_x, in_y)]
436261
def passparameters(self):
        """"""
        paramdict = {}
        for parametergroup, params in self.parameters: #pylint: disable=unused-variable
            for parameter in params:
                if parameter.value:
                    if isinstance(parameter.value, list):
                        paramdict[parameter.id] = ",".join(parameter.value)
                    else:
                        paramdict[parameter.id] = parameter.value
        return paramdict
1351760
function process( $tpl, &$value, $nspace, $current_nspace )
    {
        $named_params = array();
        $param_list = $tpl->operatorParameterList( $this->Name );
        $i = 0;
        foreach ( $param_list as $param_name => $param_type )
        {
            if ( !isset( $this->Params[$i] ) or
                 $this->Params[$i]["type"] == "null" )
            {
                if ( $param_type["required"] )
                {
                    $tpl->warning( "eZTemplateOperatorElement", "Parameter '$param_name' ($i) missing" );
                    $named_params[$param_name] = $param_type["default"];
                }
                else
                {
                    $named_params[$param_name] = $param_type["default"];
                }
            }
            else
            {
                $param_data = $this->Params[$i];
                $named_params[$param_name] = $tpl->elementValue( $param_data, $nspace );
            }
            ++$i;
        }
        if ( $param_list !== null )
            $tpl->doOperator( $this, $nspace, $current_nspace, $value, $this->Name, $this->Params, $named_params );
        else
            $tpl->doOperator( $this, $nspace, $current_nspace, $value, $this->Name, $this->Params );
    }
557067
def parameters(self, value):
        

        assert len(value) == self.n_parameters
        i = 0
        for task in self.tasks:
            task.parameters = value[i:i + task.n_parameters]
            i += task.n_parameters
1144604
protected function specifyParameters()
    {
        // We will loop through all of the arguments and options for the command and
        // set them all on the base command instance. This specifies what can get
        // passed into these commands as "parameters" to control the execution.
        foreach ($this->getArguments() as $arguments)
        {
            call_user_func_array(array($this, 'addArgument'), $arguments);
        }

        // Options (Daemon + Custom)
        $options = $this->daemon ? $this->getDaemonOptions() : [];
        $options = array_merge([], $options, $this->getOptions());
        foreach ($options as $op_item)
        {
            call_user_func_array(array($this, 'addOption'), $op_item);
        }
    }
553737
function Parameter(types, paramSpec, command, groupName) {
  this.command = command || { name: 'unnamed' };
  this.paramSpec = paramSpec;
  this.name = this.paramSpec.name;
  this.type = this.paramSpec.type;
  this.short = this.paramSpec.short;

  if (this.short != null && !/[0-9A-Za-z]/.test(this.short)) {
    throw new Error('\'short\' value must be a single alphanumeric digit.');
  }

  this.groupName = groupName;
  if (this.groupName != null) {
    if (this.paramSpec.option != null) {
      throw new Error('Can\'t have a "option" property in a nested parameter');
    }
  }
  else {
    if (this.paramSpec.option != null) {
      this.groupName = (this.paramSpec.option === true) ?
                       l10n.lookup('canonDefaultGroupName') :
                       '' + this.paramSpec.option;
    }
  }

  if (!this.name) {
    throw new Error('In ' + this.command.name +
                    ': all params must have a name');
  }

  var typeSpec = this.type;
  this.type = types.createType(typeSpec);
  if (this.type == null) {
    console.error('Known types: ' + types.getTypeNames().join(', '));
    throw new Error('In ' + this.command.name + '/' + this.name +
                    ': can\'t find type for: ' + JSON.stringify(typeSpec));
  }

  // boolean parameters have an implicit defaultValue:false, which should
  // not be changed. See the docs.
  if (this.type.name === 'boolean' &&
      this.paramSpec.defaultValue !== undefined) {
    throw new Error('In ' + this.command.name + '/' + this.name +
                    ': boolean parameters can not have a defaultValue.' +
                    ' Ignoring');
  }

  // All parameters that can only be set via a named parameter must have a
  // non-undefined default value
  if (!this.isPositionalAllowed && this.paramSpec.defaultValue === undefined &&
      this.type.getBlank == null && this.type.name !== 'boolean') {
    throw new Error('In ' + this.command.name + '/' + this.name +
                    ': Missing defaultValue for optional parameter.');
  }

  if (this.paramSpec.defaultValue !== undefined) {
    this.defaultValue = this.paramSpec.defaultValue;
  }
  else {
    Object.defineProperty(this, 'defaultValue', {
      get: function() {
        return this.type.getBlank().value;
      },
      enumerable: true
    });
  }

  // Resolve the documentation
  this.manual = lookup(this.paramSpec.manual);
  this.description = lookup(this.paramSpec.description, 'canonDescNone');

  // Is the user required to enter data for this parameter? (i.e. has
  // defaultValue been set to something other than undefined)
  // TODO: When the defaultValue comes from type.getBlank().value (see above)
  // then perhaps we should set using something like
  //   isDataRequired = (type.getBlank().status !== VALID)
  this.isDataRequired = (this.defaultValue === undefined);

  // Are we allowed to assign data to this parameter using positional
  // parameters?
  this.isPositionalAllowed = this.groupName == null;
}
866078
private void readParameters() {
        ItemRuleMap parameterItemRuleMap = getRequestRule().getParameterItemRuleMap();
        if (parameterItemRuleMap != null && !parameterItemRuleMap.isEmpty()) {
            ItemRuleList parameterItemRuleList = new ItemRuleList(parameterItemRuleMap.values());
            determineSimpleMode(parameterItemRuleList);
            if (procedural) {
                console.setStyle("GREEN");
                console.writeLine("Required parameters:");
                console.styleOff();

                if (!simpleInputMode) {
                    for (ItemRule itemRule : parameterItemRuleList) {
                        Token[] tokens = itemRule.getAllTokens();
                        if (tokens == null) {
                            Token t = new Token(TokenType.PARAMETER, itemRule.getName());
                            t.setDefaultValue(itemRule.getDefaultValue());
                            tokens = new Token[] {t};
                        }
                        String mandatoryMarker = itemRule.isMandatory() ? " * " : "   ";
                        console.setStyle("YELLOW");
                        console.write(mandatoryMarker);
                        console.styleOff();
                        console.setStyle("bold");
                        console.write(itemRule.getName());
                        console.styleOff();
                        console.write(": ");
                        writeToken(tokens);
                        console.writeLine();
                    }
                }
            }
            readRequiredParameters(parameterItemRuleList);
        }
    }
155136
protected function bindNumericParameters(): void
    {
        $values = $this->getValues();
        $cnt    = count($values);
        for ($index0 = 0, $index1 = 1; $index0 < $cnt; $index0++, $index1++) {
            $value = $this->toScalar($values[$index0]);
            $this->getWrappedStatement()->bindValue($index1, $value, $this->getPdoType($value));
        }
    }
675916
def print_parameters(self):
        
        print("Static: ", self.params_hugoniot)
        print("Thermal: ", self.params_therm)
        print("Anharmonic: None")
        print("Electronic: None")