A wrapper for a paramSpec so we can sort out shortened versions names for
option switches
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;
}
1259053
private String getOptionalParameter(String keyword,
                                        Map<String, String> parms) {
        if (!parms.containsKey(keyword)) {
            return null;
        }

        String value = parms.get(keyword);
        if (value == null) {
            throw new ValidatorProcessUsageException("If parameter '" + keyword
                    + "' is provided, it must have a value.");
        } else {
            return value;
        }
    }
1317982
function normalizeOptions(options) {
    const pathToBin = path.join(process.cwd(), 'node_modules', '.bin');
    const pathName = /^win/.test(process.platform) ? 'Path' : 'PATH';
    const newPath = pathToBin + path.delimiter + process.env[pathName];

    return _.extend({
        elmTest: 'elm-test',
        args: [],
        verbose: false,
        errorMessage: 'Running tests for `<%= file.path %>` failed with exit code <%= error.code %>',
        quiet: false,
        cwd: process.cwd(),
        env: _.extend(process.env, _.fromPairs([[pathName, newPath]]), options ? options.env : undefined),
    }, options);
}
407172
function( params ){
      var defaults = { 
        field: 'data',
        bindingEvent: 'data',
        allowBinding: false,
        allowSetting: false,
        allowGetting: false,
        settingEvent: 'data',
        settingTriggersEvent: false,
        triggerFnName: 'trigger',
        immutableKeys: {}, // key => true if immutable
        updateMappers: false,
        onSet: function( self ){},
        canSet: function( self ){ return true }
      };
      params = $$.util.extend({}, defaults, params);

      return function dataImpl( name, value ){
        var p = params;
        var self = this;
        var selfIsArrayLike = self.length !== undefined;
        var all = selfIsArrayLike ? self : [self]; // put in array if not array-like
        var single = selfIsArrayLike ? self[0] : self;

        // .data('foo', ...)
        if( $$.is.string(name) ){ // set or get property

          // .data('foo')
          if( p.allowGetting && value === undefined ){ // get

            var ret;
            if( single ){
              ret = single._private[ p.field ][ name ];
            }
            return ret;
          
          // .data('foo', 'bar')
          } else if( p.allowSetting && value !== undefined ) { // set
            var valid = !p.immutableKeys[name];
            if( valid ){
              for( var i = 0, l = all.length; i < l; i++ ){
                if( p.canSet( all[i] ) ){
                  all[i]._private[ p.field ][ name ] = value;
                }
              }

              // update mappers if asked
              if( p.updateMappers ){ self.updateMappers(); }

              // call onSet callback
              p.onSet( self );

              if( p.settingTriggersEvent ){
                self[ p.triggerFnName ]( p.settingEvent );
              }
            }
          }

        // .data({ 'foo': 'bar' })
        } else if( p.allowSetting && $$.is.plainObject(name) ){ // extend
          var obj = name;
          var k, v;

          for( k in obj ){
            v = obj[ k ];

            var valid = !p.immutableKeys[k];
            if( valid ){
              for( var i = 0, l = all.length; i < l; i++ ){
                if( p.canSet( all[i] ) ){
                  all[i]._private[ p.field ][ k ] = v;
                }
              }
            }
          }
          
          // update mappers if asked
          if( p.updateMappers ){ self.updateMappers(); }

          // call onSet callback
          p.onSet( self );

          if( p.settingTriggersEvent ){
            self[ p.triggerFnName ]( p.settingEvent );
          }
        
        // .data(function(){ ... })
        } else if( p.allowBinding && $$.is.fn(name) ){ // bind to event
          var fn = name;
          self.bind( p.bindingEvent, fn );
        
        // .data()
        } else if( p.allowGetting && name === undefined ){ // get whole object
          var ret;
          if( single ){
            ret = single._private[ p.field ];
          }
          return ret;
        }

        return self; // maintain chainability
      }; // function
    }
155519
def getopt_with_ignore(args, shortopts, longopts=[]):
        
        opts = []
        prog_args = []
        if isinstance(longopts, str):
            longopts = [longopts]
        else:
            longopts = list(longopts)
        while args:
            if args[0] == '--':
                prog_args += args[1:]
                break
            if args[0].startswith('--'):
                try:
                    opts, args = getopt.do_longs(
                        opts,
                        args[0][2:],
                        longopts,
                        args[1:]
                    )
                except getopt.GetoptError:
                    args = args[1:]
            elif args[0][0] == '-':
                try:
                    opts, args = getopt.do_shorts(
                        opts,
                        args[0][1:],
                        shortopts,
                        args[1:]
                    )
                except getopt.GetoptError:
                    args = args[1:]
            else:
                prog_args.append(args[0])
                args = args[1:]
        return opts, prog_args
958259
function parseOptions(opts) {
  opts = opts || {};
  var argv = [];
  var options = {};
  var process_argv = process.argv;
  for (var i = 2; i < process_argv.length; i++) {
    if (process_argv[i].indexOf('--') == 0) {
      var arg = process_argv[i];
      if (arg.indexOf("=") > 0) {
        var arg_kv = arg.split('=');
        arg = arg_kv[0];
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = arg_kv[1];
        if (typeof opts[arg] == 'string') {
          if (opts[arg] == 'int' || opts[arg] == 'integer') {
            options[arg] = parseInt(options[arg]);
          } else if (opts[arg] == 'float') {
            options[arg] = parseFloat(options[arg]);
          }
        } else if (typeof opts[arg] == 'object') {
          if (opts[arg].type == 'array') {
            var sep = opts[arg].separator || opts[arg].sep || ',';
            options[arg] = options[arg].split(sep);
          }
        }
      } else {
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = true;
      }
    } else {
      argv.push(process_argv[i]);
    }
  }
  options.argv = argv;
  return options;
}
1195315
private void appendOptionalArgString(StringBuilder sb, JSType paramType, boolean forAnnotations) {
    if (paramType.isUnionType()) {
      // Remove the optionality from the var arg.
      paramType =
          paramType
              .toMaybeUnionType()
              .getRestrictedUnion(registry.getNativeType(JSTypeNative.VOID_TYPE));
    }
    paramType.appendAsNonNull(sb, forAnnotations).append("=");
  }
584969
private static String[] convertParameters(Class<?>[] params)
   {
      List<String> tmp = new ArrayList<String>();
      for (Class<?> c : params)
      {
         if (c.isArray())
         {
            StringBuffer sb = new StringBuffer();
            Class<?> subType = c.getComponentType();
            sb.append(subType.getName());
            // Convert to type[][]...[]
            while (subType != null)
            {
               sb.append("[]");
               subType = subType.getComponentType();
            }
            tmp.add(sb.toString());
         }
         else
         {
            tmp.add(c.getName());
         }
      }
      String[] sig = new String[tmp.size()];
      tmp.toArray(sig);
      return sig;
   }
1276688
def parse_options(args)
      config = {}
      deprecated_args = []
      flag = /^--/

      args.size.times do
        break if args.empty?
        peek = args.first
        next unless peek && (peek.match(flag) || peek.match(/=/))
        arg  = args.shift
        peek = args.first
        key  = arg
        if key.match(/=/)
          deprecated_args << key unless key.match(flag)
          key, value = key.split('=', 2)
        elsif peek.nil? || peek.match(flag)
          value = true
        else
          value = args.shift
        end
        value = true if value == 'true'
        config[key.sub(flag, '')] = value

        if !deprecated_args.empty?
          out_string = deprecated_args.map{|a| "--#{a}"}.join(' ')
          display("Warning: non-unix style params have been deprecated, use #{out_string} instead")
        end
      end

      config
    end
827937
private String parameter(Options opt, Parameter p[]) {
	StringBuilder par = new StringBuilder(1000);
	for (int i = 0; i < p.length; i++) {
	    par.append(p[i].name() + typeAnnotation(opt, p[i].type()));
	    if (i + 1 < p.length)
		par.append(", ");
	}
	return par.toString();
    }
924221
function(param_, test) {
  var param = param_.replace(/\s+/g, '')
    , cap;

  if (param === 'even') {
    param = '2n+0';
  } else if (param === 'odd') {
    param = '2n+1';
  } else if (param.indexOf('n') === -1) {
    param = '0n' + param;
  }

  cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param);

  return {
    group: cap[1] === '-'
      ? -(cap[2] || 1)
      : +(cap[2] || 1),
    offset: cap[4]
      ? (cap[3] === '-' ? -cap[4] : +cap[4])
      : 0
  };
}
605569
def _normalize_options(options)
        options = super(options)
        if options[:partial] == true
          options[:partial] = action_name
        end

        if (options.keys & [:partial, :file, :template]).empty?
          options[:prefixes] ||= _prefixes
        end

        options[:template] ||= (options[:action] || action_name).to_s
        options
      end
246122
function version(options) {
  let opts = options || {
    typeKey: '_type',
  };
  if (typeof options === 'string') {
    opts = {
      typeKey: options,
    };
  }
  const typeKey = opts.typeKey;
  const override = opts.override;

  return (ctx, next) => {
    const query = ctx.query;
    const currentPath = ctx.path;
    const reg = /^\/v\d+/i;
    const result = reg.exec(currentPath);
    const acceptConfig = {};
    if (result) {
      const versionDesc = result[0];
      const v = parseInt(versionDesc.substring(2), 10);
      /* eslint no-param-reassign:0 */
      ctx.path = ctx.path.substring(versionDesc.length);
      if (override) {
        ctx.originalPath = ctx.path;
      }
      acceptConfig.version = v;
    }
    if (query[typeKey]) {
      acceptConfig.type = query[typeKey];
      delete query[typeKey];
      /* eslint no-param-reassign:0 */
      ctx.query = query;
    }
    const acceptReg = /^application\/vnd\.\S+\.v(\d)+(\+(\S+))?/i;
    const acceptResult = acceptReg.exec(ctx.get('Accept'));
    /* istanbul ignore else */
    if (acceptResult) {
      acceptConfig.version = parseInt(acceptResult[1], 10);
      /* istanbul ignore else */
      if (acceptResult[3]) {
        acceptConfig.type = acceptResult[3];
      }
    }
    /* istanbul ignore else */
    if (acceptConfig.version) {
      /* eslint no-param-reassign:0 */
      ctx.state.acceptConfig = acceptConfig;
      ctx.versionConfig = acceptConfig;
    }
    return next();
  };
}
837368
def parse_options(cls, options):
    """"""
    cls.ignore_decorators = options.ignore_decorators
    cls.exclude_from_doctest = options.exclude_from_doctest
    if not isinstance(cls.exclude_from_doctest, list):
      cls.exclude_from_doctest = [cls.exclude_from_doctest]
8881
def parse_generic_options(args)
      a = args.dup
      arguments = []
      options = {}

      until a.empty?
        arg = a.shift
        case arg
        when /\A--.+=/
          _, option, value = arg.match(/\A--(.+)=(.+)\Z/).to_a
          update_options(option, value, options)
        when /\A--.+/
          if a[0].nil? || a[0].to_s.start_with?("--")
            # Current option is a boolean
            update_options(arg, true, options)
          else
            # Take value from next
            update_options(arg, a.shift, options)
          end
        else
          arguments << arg
        end
      end

      [options, arguments]
    end
22238
def p_define_params_paramlist(p):
    
    for i in p[2]:
        if not isinstance(i, ID):
            error(p.lineno(3),
                  '"%s" might not appear in a macro parameter list' % str(i))
            p[0] = None
            return

    names = [x.name for x in p[2]]
    for i in range(len(names)):
        if names[i] in names[i + 1:]:
            error(p.lineno(3),
                  'Duplicated name parameter "%s"' % (names[i]))
            p[0] = None
            return

    p[0] = p[2]
351540
function parseOptional (params, section, stripped) {
  stripped = stripped.slice(0, -1)
  const key = (params && params[stripped]) || ''

  return {
    dst: key && key.toString() ? section : `/${section}`,
    src: key
  }
}