helper to generate the creds_params method
427817
def generate_creds_params
      define_singleton_method :creds_params,
        if @service_tokens
          lambda do |options|
            token = options.delete(:service_token)
            service_id = options[:service_id]
            raise ArgumentError, "need to specify a service_token and a service_id" unless token && service_id
            'service_token='.freeze + CGI.escape(token)
          end
        elsif @provider_key
          warn DEPRECATION_MSG_PROVIDER_KEY if @warn_deprecated
          lambda do |_|
            "provider_key=#{CGI.escape @provider_key}".freeze
          end
        else
          raise ArgumentError, 'missing credentials - either use "service_tokens: true" or specify a provider_key value'
        end
    end
737666
def build_find_params(options)
      keyconditions = []
      keyparameters = []
      parameters = []
      includes   = []
      joins   = []

      # Build SQL WHERE clause using the AST
      sql = @ast.to_sql(self, definition) do |notification, value|

        # Handle the notifications encountered during the SQL generation:
        # Store the parameters, includes, etc so that they can be added to
        # the find-hash later on.
        case notification
          when :keycondition then keyconditions << value
          when :keyparameter then keyparameters << value
          when :parameter    then parameters    << value
          when :include      then includes      << value
          when :joins        then joins         << value
          else raise ScopedSearch::QueryNotSupported, "Cannot handle #{notification.inspect}: #{value.inspect}"
        end
      end
        # Build SQL ORDER BY clause
      order = order_by(options[:order]) do |notification, value|
        case notification
          when :parameter then parameters << value
          when :include   then includes   << value
          when :joins     then joins      << value
          else raise ScopedSearch::QueryNotSupported, "Cannot handle #{notification.inspect}: #{value.inspect}"
        end
      end
      sql = (keyconditions + (sql.blank? ? [] : [sql]) ).map {|c| "(#{c})"}.join(" AND ")
      # Build hash for ActiveRecord::Base#find for the named scope
      find_attributes = {}
      find_attributes[:conditions] = [sql] + keyparameters + parameters unless sql.blank?
      find_attributes[:include]    = includes.uniq                      unless includes.empty?
      find_attributes[:joins]      = joins.uniq                         unless joins.empty?
      find_attributes[:order]      = order                              unless order.nil?

      # p find_attributes # Uncomment for debugging
      return find_attributes
    end
1121187
def _build_list_params(param_name, key, values):
        """"""
        params = {}
        if hasattr(values, '__iter__'):
            index = 0
            for value in values:
                params[str(param_name) + '[' + str(index) + '].' + str(key)] = str(value)
                index += 1
        else:
            params[str(param_name) + '[0].' + str(key)] = str(values)
        return params
76885
def build_params(self, params={}):
        
        z = params.copy()
        z.update({'editId': self.edit_id, 'packageName': self.package_name})
        return z
630231
def fix_field_params_repr(params):
    
    class ReprUnicode(text_type):
        def __new__(cls, text):
            return text_type.__new__(cls, text)

        def __repr__(self):
            out = repr(text_type(self))
            return out[1:] if out.startswith("u'") or out.startswith('u"') else out

    class ReprChoices(list):
        def __new__(cls, choices):
            return list.__new__(cls, choices)

        def __repr__(self):
            out = []
            for x_0, x_1 in self:
                out.append('(%s, %s)' % (
                    repr(ReprUnicode(x_0) if isinstance(x_0, text_type) else x_0),
                    repr(ReprUnicode(x_1) if isinstance(x_1, text_type) else x_1)
                ))
            return '[%s]' % (', '.join(out))
    if PY3:
        return params
    out = OrderedDict()
    for k, v in params.items():
        if k == 'choices' and v:
            v = ReprChoices(v)
        elif isinstance(v, text_type):
            v = ReprUnicode(v)
        out[k] = v
    return out
332466
def _construct_params(params, required_keys, opt_keys=None):
        
        try:
            params_list = [params.pop(key) for key in required_keys]
        except KeyError as e:
            raise MissingParameter(
                'Missing expected request parameter: %s' % e)
        if opt_keys:
            params_list.extend([params.pop(key)
                                for key in opt_keys if key in params])
        return '/'.join(str(p) for p in params_list)
1314128
def to_parameter_specs(self, name_prefix=""):
    """"""
    specs = []
    for name, categories, _ in self._categorical_params.values():
      spec = {
          "parameterName": name_prefix + name,
          "type": "CATEGORICAL",
          "categoricalValues": categories,
      }
      specs.append(spec)

    for name, feasible_points, scale, _ in self._discrete_params.values():
      spec = {
          "parameterName": name_prefix + name,
          "type": "DISCRETE",
          "discreteValues": feasible_points,
      }
      if scale:
        spec["scaleType"] = self.SCALES_STR[scale]
      specs.append(spec)

    for name, min_val, max_val, scale, _ in self._float_params.values():
      spec = {
          "parameterName": name_prefix + name,
          "type": "DOUBLE",
          "minValue": min_val,
          "maxValue": max_val,
      }
      if scale:
        spec["scaleType"] = self.SCALES_STR[scale]
      specs.append(spec)

    for name, min_val, max_val, scale, _ in self._int_params.values():
      spec = {
          "parameterName": name_prefix + name,
          "type": "INTEGER",
          "minValue": min_val,
          "maxValue": max_val,
      }
      if scale:
        spec["scaleType"] = self.SCALES_STR[scale]
      specs.append(spec)

    return specs
905991
private String generateReqParams() throws UnsupportedEncodingException {

        String params = "";
        if ((m_parameterMap != null) && !m_parameterMap.isEmpty()) {
            for (Entry<String, String[]> paramEntry : m_parameterMap.entrySet()) {
                if (paramEntry.getValue() != null) {
                    for (int i = 0; i < paramEntry.getValue().length; i++) {
                        params += "&"
                            + paramEntry.getKey()
                            + "="
                            + URLEncoder.encode(paramEntry.getValue()[i], "UTF-8");
                    }
                }
            }
            params = "?" + params.substring(1);
        }
        return params;
    }
759519
public function generateUrlParams()
    {
        /* @var $class ActiveRecord */
        $class = $this->modelClass;
        $pks = $class::primaryKey();
        if (count($pks) === 1) {
            if (is_subclass_of($class, \yii\mongodb\ActiveRecord::class)) {
                return "'id' => (string)\$model->{$pks[0]}";
            }

            return "'id' => \$model->{$pks[0]}";
        }

        $params = [];
        foreach ($pks as $pk) {
            if (is_subclass_of($class, \yii\mongodb\ActiveRecord::class)) {
                $params[] = "'$pk' => (string)\$model->$pk";
            } else {
                $params[] = "'$pk' => \$model->$pk";
            }
        }

        return implode(', ', $params);
    }
746268
function convertParameters(parameters) {
  return parameters.map(parameter => {
    const { required, name } = parameter;
    return {
      name,
      disabled: required !== true,
      value: `${generateParameterExample(parameter)}`,
    };
  });
}
90475
def _encode_params(**kw):
    '''
    
    '''
    args = []
    for k, v in kw.iteritems():
        if isinstance(v, basestring):
            qv = v.encode('utf-8') if isinstance(v, unicode) else v
            args.append('%s=%s' % (k, urllib.quote(qv)))
        elif isinstance(v, collections.Iterable):
            for i in v:
                qv = i.encode('utf-8') if isinstance(i, unicode) else str(i)
                args.append('%s=%s' % (k, urllib.quote(qv)))
        else:
            qv = str(v)
            args.append('%s=%s' % (k, urllib.quote(qv)))
    return '&'.join(args)
59138
def define_params(self):
        '''
        
        '''
        input_dim = self.input_dim
        hidden_dim = self.hidden_dim
        prefix = self.name
        self.w_matrix = tf.Variable(tf.random_normal([input_dim, 3 * hidden_dim], stddev=0.1),
                                    name='/'.join([prefix, 'W']))
        self.U = tf.Variable(tf.random_normal([hidden_dim, 3 * hidden_dim], stddev=0.1),
                             name='/'.join([prefix, 'U']))
        self.bias = tf.Variable(tf.random_normal([1, 3 * hidden_dim], stddev=0.1),
                                name='/'.join([prefix, 'b']))
        return self
308241
static function GenerateErrorParameter()
    {
        $ErrBytes   = 144;
        $ErrBytesAv = 144;
        $ErrCPF     = '0000000';
        $ErrRes     = ' ';
        $ErrEx      = ' ';
        // changed $this to self so can work in static context
        $ds[] = self::AddParameterInt32('in', "Bytes provided", 'errbytes', $ErrBytes);
        $ds[] = self::AddParameterInt32('out', "Bytes available",'err_bytes_avail', $ErrBytesAv);
        $ds[] = self::AddParameterChar('out',7, "Exception ID", 'exceptId', $ErrCPF);
        $ds[] = self::AddParameterChar('out',1, "Reserved", 'reserved', $ErrRes);
        $ds[] = self::AddParameterHole('out',128, "Exception data", 'excData', $ErrEx); // can be bad XML so make it a hole
        return $ds;
    }
992561
public function generateActionParamComments()
    {
        /** @var ActiveRecord $class */
        $class = $this->modelClass;
        $pks = $class::primaryKey();
        if (($table = $this->getTableSchema()) === false) {
            $params = [];
            foreach ($pks as $pk) {
                $params[] = '@param ' . (substr(strtolower($pk), -2) == 'id' ? 'integer' : 'string') . ' $' . $pk;
            }

            return $params;
        }
        if (count($pks) === 1) {
            return ['@param ' . $table->columns[$pks[0]]->phpType . ' $id'];
        } else {
            $params = [];
            foreach ($pks as $pk) {
                $params[] = '@param ' . $table->columns[$pk]->phpType . ' $' . $pk;
            }

            return $params;
        }
    }
934882
def parametrize(params):
    
    returned = str(params[0])
    returned += "".join("[" + str(p) + "]" for p in params[1:])
    return returned
146851
static String generateParamList(JsDoc jsDoc) {
    ImmutableList<JsDoc.Param> params = jsDoc.params();
    List<String> functionParameters = new ArrayList<>();
    for (JsDoc.Param param : params) {
      if ("param".equals(param.annotationType())) {
        functionParameters.add(param.paramTypeName());
      }
    }
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < functionParameters.size(); i++) {
      sb.append(functionParameters.get(i));
      if (i + 1 < functionParameters.size()) {
        sb.append(", ");
      }
    }
    return sb.toString();
  }
521819
def format_parameters(self, params):
        # type: (Dict[str, str]) -> None
        
        query = urlparse(self.url).query
        if query:
            self.url = self.url.partition('?')[0]
            existing_params = {
                p[0]: p[-1]
                for p in [p.partition('=') for p in query.split('&')]
            }
            params.update(existing_params)
        query_params = ["{}={}".format(k, v) for k, v in params.items()]
        query = '?' + '&'.join(query_params)
        self.url = self.url + query