prepare method specific options
555545
def setup_method_options(method, tuning_options):
    
    kwargs = {}

    #pass size of parameter space as max iterations to methods that support it
    #it seems not all methods iterpret this value in the same manner
    maxiter = numpy.prod([len(v) for v in tuning_options.tune_params.values()])
    kwargs['maxiter'] = maxiter
    if method in ["Nelder-Mead", "Powell"]:
        kwargs['maxfev'] = maxiter
    elif method == "L-BFGS-B":
        kwargs['maxfun'] = maxiter

    #pass eps to methods that support it
    if method in ["CG", "BFGS", "L-BFGS-B", "TNC", "SLSQP"]:
        kwargs['eps'] = tuning_options.eps
    elif method == "COBYLA":
        kwargs['rhobeg'] = tuning_options.eps

    return kwargs
159948
def prepare(cls, value, length=0, position=0, is_last_data=True):
        
        hstruct = WriteLobHeader.header_struct
        lob_option_dataincluded = WriteLobHeader.LOB_OPTION_DATAINCLUDED if length > 0 else 0
        lob_option_lastdata = WriteLobHeader.LOB_OPTION_LASTDATA if is_last_data else 0
        options = lob_option_dataincluded | lob_option_lastdata
        pfield = hstruct.pack(cls.type_code, options, length, position)
        return pfield
952268
function prepareArgs(opts) {
  var valueFromOpts = valueFrom.bind(null, opts);

  return Object.keys(opts).reduce(function(acc, item) {
    acc.splice(indexFromArgs(item), 0, valueFromOpts(item));

    return acc;
  }, []);
}
1326451
function prepareAndGetDateOptions (options) {
    options = options || {formatLength: 'short', selector: 'date and time'};
    options.formatLength = options.formatLength || 'short';
    options.selector = options.selector || 'date and time';

    return convertToMomentLocalizedFormat(options);
}
1222750
public function prepareOptions()
    {
        foreach ($this->content as $key => $option) {
            if (!($option instanceof Option)) {
                throw new \InvalidArgumentException('List item should be an Windwalker\\Html\\Option object.');
            }

            if ($this->isChecked($option)) {
                $option['checked'] = 'checked';
            }

            $attrs = $option->getAttributes();

            $attrs['type'] = $this->type;
            $attrs['name'] = $this->getAttribute('name');

            $attrs['id'] = $option->getAttribute('id');
            $attrs['id'] = $attrs['id'] ?: strtolower(
                trim(
                    preg_replace(
                        '/[^A-Z0-9_\.-]/i',
                        '-',
                        $attrs['name'] ?: 'empty'
                    ),
                    '-'
                )
            );
            $attrs['id'] .= '-' . strtolower(
                trim(
                    preg_replace(
                        '/[^A-Z0-9_\.-]/i',
                        '-',
                        $option->getValue() ?: 'empty'
                    ),
                    '-'
                )
            );
            $attrs['id'] = 'input-' . $attrs['id'];
            $attrs['disabled'] = $this->disabled;
            $attrs['readonly'] = $this->readonly;

            // Do not affect source options
            $option = clone $option;

            $option->setAttributes($attrs);

            $input = new HtmlElement('input', null, $attrs);

            $option->setAttribute('disabled', null);
            $option->setAttribute('readonly', null);

            $label = $this->createLabel($option);

            $this->content[$key] = new HtmlElements([$input, $label]);
        }
    }
1154317
function permittedOptions(methodName) {
        var options = ghostBookshelf.Model.permittedOptions.call(this, methodName),

            // whitelists for the `options` hash argument on methods, by method name.
            // these are the only options that can be passed to Bookshelf / Knex.
            validOptions = {
                findOne: ['columns', 'importing', 'withRelated', 'require', 'filter'],
                findPage: ['status', 'staticPages'],
                findAll: ['columns', 'filter'],
                destroy: ['destroyAll', 'destroyBy'],
                edit: ['filter']
            };

        // The post model additionally supports having a formats option
        options.push('formats');

        if (validOptions[methodName]) {
            options = options.concat(validOptions[methodName]);
        }

        return options;
    }
1308800
def prepare_options(options)
      options = engine.config.to_hash.merge(options)
      options.keys.each { |k| options[k.to_s.gsub(/_([a-z])/) { $1.upcase }.to_sym] = options[k] }
      options.delete_if { |k, v| v.nil? }
    end
1114480
def respond_to?(method_sym, include_private = false)
      method_name = method_sym.to_s
      case 
        when KNOWN_ELEMENTS.include?(method_name.gsub(/^uniq_/,''))
          # page_object.uniq_xxx(hash)
          true
        when has_eset?(method_name)
          # page_object.some_elements_set
          true
        when has_element?(method_name)
          # page_object.some_element
          true
        when FEED_ALL.match(method_name)
          # page_object.feed_all(:fresh_food)
          true
        when (FEED.match(method_name) and has_eset?($1))
          # page_object.feed_some_elements_set(:fresh_food)
          true
        when (FEED.match(method_name) and has_element?($1))
          # page_object.feed_some_element(:fresh_food)
          true
        when (FIRE_ACTION.match(method_name) and has_action?($1))
          # page_object.fire_some_action
          true
        when (FIRE_ACTION.match(method_name) and has_alias?($1))
          # page_object.fire_some_action
          true
        when (VALIDATE.match(method_name) and has_action?($1))
          # page_object.validate_xxx
          true
        when (SELECT_FROM.match(method_name) and has_table?($1))
          # page_object.select_from_some_table(:header_column, {:column => 'value'})
          true
        when (SELECT_ROW_FROM.match(method_name) and has_table?($1))
          # page_object.select_from_some_table(:header_column, {:column => 'value'})
          true
        when (PAGINATION_EACH.match(method_name) and has_pagination?($1))
          # page_object.each_pagination
          true
        when (PAGINATION_OPEN.match(method_name) and has_pagination?($1))
          # page_object.open_padination(1)
          true
        when (PRESS.match(method_name) and has_element?($1))
          # page_object.press_element
          true
        else
          super
      end
    end
431059
public function prepareOptions()
    {
        parent::prepareOptions();

        // Prepare array name
        foreach ($this->content as $key => $option) {
            $option[0]->setAttribute('name', $option[0]->getAttribute('name') . '[]');
        }
    }
1153455
def method_missing(cmd, options={}, *args, &block)
      native(cmd, options, *args, &block)
    end
1307611
function processOptions(opt) {
        keys(opt).forEach(function (key) {
            var value = opt[key];
            if (typeof value === 'string') {
                opt[key] = grunt.template.process(value);
            } else if (Array.isArray(value)) {
                opt[key] = value.slice().map(function (i) {
                    return grunt.template.process(i);
                });
            }
        });
    }
1277713
function addOptionMethod( PluginClass ) {
				// don't overwrite original option method
				if ( PluginClass.prototype.option ) {
					return;
				}

			  // option setter
			  PluginClass.prototype.option = function( opts ) {
			    // bail out if not an object
			    if ( !$.isPlainObject( opts ) ){
			      return;
			    }
			    this.options = $.extend( true, this.options, opts );
			  };
			}
1095669
private function prepareOptions()
    {
        $metadata = $this->metadata();

        // Can be override from the outside.
        if (!$this->exportIdent()) {
            $exportIdent = $this->exportIdent() ? : $this->metadata()->get('admin.default_export');
            if (!$exportIdent) {
                throw new Exception(sprintf(
                    'No export ident defined for "%s" in %s',
                    $this->objType(),
                    get_class($this)
                ));
            }

            $this->setExportIdent($exportIdent);
        }

        $export = $metadata->get('admin.export.'.$this->exportIdent());
        if (!$export) {
            throw new Exception(sprintf(
                'No export data defined for "%s" at "%s" in %s',
                $this->objType(),
                $this->exportIdent(),
                get_class($this)
            ));
        }

        if (is_string($export)) {
            $export = $metadata->get('admin.lists.'.$export);
            if (!$export) {
                throw new Exception(sprintf(
                    'No export data defined for "%s" in %s',
                    $this->objType(),
                    get_class($this)
                ));
            }
        }

        if (!isset($export['properties'])) {
            throw new Exception(sprintf(
                'No properties defined to export "%s" in %s',
                $this->objType(),
                get_class($this)
            ));
        }

        if (isset($export['exporter_options'])) {
            $opts = $export['exporter_options'];
            if (isset($opts['convert_br_to_newlines'])) {
                $this->setConvertBrToNewlines($opts['convert_br_to_newlines']);
            }
            if (isset($opts['strip_tags'])) {
                $this->setStripTags($opts['strip_tags']);
            }
            if (isset($opts['filename'])) {
                $this->setFilename($opts['filename']);
            }
        }

        // Default filename.
        // Filename is not a requirement
        if (!$this->filename()) {
            $ts = new DateTime('now');
            $filename = str_replace('/', '.', strtolower($this->objType())).'-export-'.$ts->format('Ymd.His').'.csv';
            $this->setFilename($filename);
        }

        // Properties to be exported
        // They will defined the file header and the rows.
        $this->setProperties($export['properties']);

        // Unnecessary for collection config.
        unset($export['properties']);
        unset($export['exporter_options']);

        // The rest is just collection config
        $this->setCollectionConfig($export);

        return $this;
    }
1022884
protected function prepare()
    {
        //Force passice mode if not specified
        $this->addOption('passive', true);

        //To make call on different files, we must retrieve the root and apply commands to the path
        $tmp = clone $this->getUrl();
        $tmp->path('');
        $this->addOption('url', $tmp->toString());
    }
749851
def prepare_params(modeline, fileconfig, options):
    
    params = dict(skip=False, ignore=[], select=[], linters=[])
    if options:
        params['ignore'] = list(options.ignore)
        params['select'] = list(options.select)

    for config in filter(None, [modeline, fileconfig]):
        for key in ('ignore', 'select', 'linters'):
            params[key] += process_value(key, config.get(key, []))
        params['skip'] = bool(int(config.get('skip', False)))
    # TODO: skip what? This is causing erratic behavior for linters.
    params['skip'] = False

    params['ignore'] = set(params['ignore'])
    params['select'] = set(params['select'])

    return params
33023
function prepareDOM() {
        var i, pageNum,
            zoomLevel, maxZoom,
            ptWidth, ptHeight,
            pxWidth, pxHeight,
            pt2px = util.calculatePtSize(),
            dimensions = config.metadata.dimensions,
            skeleton = '';

        // adjust page scale if the pages are too small/big
        // it's adjusted so 100% == DOCUMENT_100_PERCENT_WIDTH px;
        config.pageScale = DOCUMENT_100_PERCENT_WIDTH / (dimensions.width * pt2px);

        // add zoom levels to accomodate the scale
        zoomLevel = config.zoomLevels[config.zoomLevels.length - 1];
        maxZoom = 3 / config.pageScale;
        while (zoomLevel < maxZoom) {
            zoomLevel += zoomLevel / 2;
            config.zoomLevels.push(zoomLevel);
        }

        dimensions.exceptions = dimensions.exceptions || {};

        // create skeleton
        for (i = config.pageStart - 1; i < config.pageEnd; i++) {
            pageNum = i + 1;
            if (pageNum in dimensions.exceptions) {
                ptWidth = dimensions.exceptions[pageNum].width;
                ptHeight = dimensions.exceptions[pageNum].height;
            } else {
                ptWidth = dimensions.width;
                ptHeight = dimensions.height;
            }
            pxWidth = ptWidth * pt2px;
            pxHeight = ptHeight * pt2px;
            pxWidth *= config.pageScale;
            pxHeight *= config.pageScale;
            skeleton += util.template(Crocodoc.pageTemplate, {
                w: pxWidth,
                h: pxHeight
            });
        }

        // insert skeleton and keep a reference to the jq object
        config.$pages = $(skeleton).appendTo(config.$doc);
    }
387885
def _pv_respond_to(opts, key, method_name_list)
        value = _pv_opts_lookup(opts, key)
        unless value.nil?
          Array(method_name_list).each do |method_name|
            unless value.respond_to?(method_name)
              raise ValidationFailed, "Option #{key} must have a #{method_name} method!"
            end
          end
        end
      end