GET // 
FUNCTION: get( opts, clbk )
Gets an author's package list.

@param {Object} opts - options
@param {Function} clbk - callback to invoke after getting a package list
@returns {Void}
435154
function get( opts, clbk ) {
	request( opts, done );
	/**
	* FUNCTION: done( error, data )
	*	Callback invoked upon completing a request.
	*
	* @private
	* @param {Error|Null} error - error object
	* @param {String} data - response data
	* @returns {Void}
	*/
	function done( error, data ) {
		if ( error ) {
			return clbk( error );
		}
		data = transform( data );
		clbk( null, data );
	} // end FUNCTION done()
}
1007561
def get_app(opts):
    '''
    
    '''
    apiopts = opts.get(__name__.rsplit('.', 2)[-2], {})  # rest_cherrypy opts

    # Add Salt and salt-api config options to the main CherryPy config dict
    cherrypy.config['saltopts'] = opts
    cherrypy.config['apiopts'] = apiopts

    root = API()  # cherrypy app
    cpyopts = root.get_conf()  # cherrypy app opts

    return root, apiopts, cpyopts
708067
function(opts) {
      opts = opts || {};
      var path = opts.path || this.path,
          callback = opts.callback,
          method = opts.method || this.method,
          ws = getWebsocketPlugin(),
          transports = app.config.transports,
          self = this,
          i = 0,
          error,
          response;

      if (ws) {
        if (transports && transports.length > 0) {
          async.whilst(
            function () {
              return (i < transports.length);
            },
            function (done) {
              self.doConnect(transports[i], method, path, function (err, res) {
                error = err;
                response = res;
                if (!err && res) {
                  i = transports.length;
                } else {
                  i++;
                  if (i < transports.length) {
                    delete self.request;
                  }
                }
                done();
              });
            },
            function (err) {
              callback(err || error, response);
            }
          );
        } else {
          error = 'no transport available';
          log.error('%s %s', app.name, error);
          callback(error);
        }
      } else {
        this.doConnect('http', method, path, callback);
      }
      return this;
    }
713349
function fetchFromCache(options, opts, cb) {
  // look for existing cached resource
  if (indirFiles.length > 0) {
    var etag;
    var regexp = '^' + opts.prefix +
                 '([A-Za-z0-9]+={0,2})' + // base64 encoded
                 opts.suffix + '$';
    var regex = new RegExp(regexp);
    var i;
    for (i = 0; i < indirFiles.length; i++) {
      var file = regex.exec(indirFiles[i]);
      if (file) {
        etag = new Buffer(file[1], 'base64').toString();
        break;
      }
    }

    if (etag) {
      try {
        var headOpts = JSON.parse(JSON.stringify(options)); // clone options
        headOpts.headers = { 'If-None-Match': etag };
        request.head(headOpts, function(err, res, body) {
          if (err) {
            logger.error(err);
            cb();
            // not fatal; continue
          } else if (res.statusCode === 304) {
            var filename = path.join(opts.outdir, indirFiles[i]);
            fs.copy(path.join(opts.indir, indirFiles[i]),
                    filename,
                    { preserveTimestamps: true },
                    function(err) {
                      if (err) {
                        throw (err);
                      }
                      var body = decryptData(fs.readFileSync(filename));
                      logger.info('Using cached copy of %s', indirFiles[i]);
                      var result = {
                        file: filename,
                        contents: body };
                      cb(null, result);
                    });
          } else {
            cb();
          }
        });
      } catch (e) {
        logger.error(e);
        cb();
        // not fatal; continue
      }
    } else {
      cb();
    }
  } else {
    cb();
  }
}
810362
function (source, opts, cb) {
        var callback,
            options;

        if (arguments.length === 2) {
            options = defaults();
            callback = opts;
        } else {
            options = defaults(opts);
            callback = cb;
        }

        try {
            source = api.clean(source);
            callback(null, api.insert(source, getToc(source, options)));
        } catch (err) {
            callback(err, null);
        }
    }
679043
function (opts, cb) {
            var self = this;
            cb = cb || function () {
                };
            opts = opts || {};
            var url = this._getlisturi(opts);
            this.client.get({
                uri: url,
                data:opts
            }, cb);
        }
1028123
function tree (dir, opts, cb) {
  var i = 0
  findPackage(dir, function (err, pkg) {
    pull(
      pull.depthFirst(pkg, function (pkg) {
        pkg.tree = {}
        return pull(
          pfs.readdir(path.resolve(pkg.path, 'node_modules')),
          paramap(maybe(readPackage)),
          pull.filter(function (_pkg) {
            if(!_pkg) return
            _pkg.parent = pkg
            
            pkg.tree[_pkg.name] = _pkg
            return pkg
          })
        )
      }),
      opts.post ? paramap(function (data, cb) {
        //run a post install-style hook.
        opts.post(data, cb)
      }) : pull.through(),
      pull.drain(null, function (err) {
        cb(err === true ? null : err, clean(pkg))
      })
    )
  })
}
1218753
function gulpPlovr(opts) {
  opts = opts || { };
  
  if (!opts.java_path) opts.java_path = JAVA_PATH;
  if (!opts.plovr_path) opts.plovr_path = PLOVR_PATH;
  if (!opts.plovr_args) opts.plovr_args = {};
  if (opts.debug) gutil.log(PLUGIN_NAME + ':', 'debug mode is enabled!');
  
  // Creating a stream through which each file will pass
  return through.obj(function(file, enc, cb) {
    if (file.isNull()) {
      // return empty file
      cb(null, file);
    }
    
    //var baseDir = path.dirname(module.parent.filename);
    var filePath = path.dirname(file.path);
    var configPath = file.path;
    
    if (file.isBuffer()) {
      var args = [];
      args.push('-jar');
      args.push(opts.plovr_path);
      
      Object.keys(opts.plovr_args).forEach(function(key) {
        var value;
        value = opts.plovr_args[key];
        args.push("--" + key);
        return args.push(value);
      });
      
      args.push('build');
      args.push(configPath);
      
      var compiler = spawn(opts.java_path, args);
      var stdout = '';
      var stderr = '';
      compiler.stdout.setEncoding('utf8');
      compiler.stderr.setEncoding('utf8');
      compiler.stdout.on('data', function(data) {
        if (opts.debug) gutil.log(PLUGIN_NAME + ':', data);
        return stdout += data;
      });
      
      compiler.stderr.on('data', function(data) {
        return stderr += data;
      });
      
      compiler.on('exit', function(code) {
        if (code !== 0) {
          this.emit('error', new gutil.PluginError(PLUGIN_NAME, stderr));
        }
        
        cb();
      });
      
      compiler.on('close', function(code) {
        if (opts.debug) gutil.log(stdout + stderr);
      });
    }
    
    if (file.isStream()) {
      this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
      cb();
    }
  });
}
1141273
def _get_opt(config, key, option, opt_type):
    """"""
    for opt_key in [option, option.replace('-', '_')]:
        if not config.has_option(key, opt_key):
            continue

        if opt_type == bool:
            return config.getbool(key, opt_key)

        if opt_type == int:
            return config.getint(key, opt_key)

        if opt_type == str:
            return config.get(key, opt_key)

        if opt_type == list:
            return _parse_list_opt(config.get(key, opt_key))

        raise ValueError("Unknown option type: %s" % opt_type)
149927
function pkginfo( clbk ) {
	var root,
		file;

	if ( !isFunction( clbk ) ) {
		throw new TypeError( 'invalid input argument. Must provide a callback function. Value: `' + clbk + '`.' );
	}
	root = resolve();
	file = path.join( root, 'package.json' );

	readJSON( file, onData );

	/**
	* FUNCTION: onData( error, data )
	*	Callback invoked after attempting to read an application's `package.json`.
	*
	* @private
	* @param {Error|Null} error - error object
	* @param {Object} data - JSON data
	* @returns {Void}
	*/
	function onData( error, data ) {
		if ( error ) {
			return clbk( error );
		}
		clbk( null, data );
	}
}
868220
function resolve( opts, clbk ) {
	var ratelimit;
	var options;
	var count;
	var total;
	var data;
	var last;
	var err;

	options = getOptions( opts ); // request options

	count = 0;
	total = 1;
	last = 1;

	debug( 'Beginning request.' );
	getPage( opts.page );

	/**
	* FUNCTION: getPage( i )
	*	Gets a single resource page.
	*
	* @private
	* @param {Number} i - page number
	* @returns {Void}
	*/
	function getPage( i ) {
		options.path = urlpath({
			'pathname': opts.pathname,
			'page': i,
			'per_page': opts.per_page,
			'query': opts.query
		});
		debug( 'Request path: %s', options.path );

		debug( 'Attempting to resolve page %d.', i );
		request( options, onPage );
	} // end FUNCTION getPage()

	/**
	* FUNCTION: getPages( i, j )
	*	Gets multiple resource pages.
	*
	* @private
	* @param {Number} i - start page
	* @param {Number} j - end page
	* @returns {Void}
	*/
	function getPages( i, j ) {
		for ( ; i <= j; i++ ) {
			getPage( i );
		}
	} // end FUNCTION getPages()

	/**
	* FUNCTION: onPage( error, response, body )
	*	Callback invoked upon receiving an HTTP response.
	*
	* @private
	* @param {Error|Null} error - error or null
	* @param {Object} response - HTTP response object
	* @param {Object[]|Object} body - response body
	* @returns {Void}
	*/
	function onPage( error, response, body ) {
		var link;
		var curr;

		count += 1;
		debug( '%d of %d pages resolved.', count, total );

		if ( arguments.length === 1 ) {
			debug( 'No available rate limit information.' );
			return done( error );
		}
		// If this is the first response, get initial rate limit info; otherwise, update rate limit info...
		if ( count === 1 ) {
			ratelimit = getRateLimit( response.headers );
		} else {
			ratelimit = checkRateLimit( ratelimit, response.headers );
		}
		if ( error ) {
			return done( error );
		}
		// If a user wants multiple pages, we need to parse the link header...
		if (
			opts.last_page > opts.page ||
			opts.last_page === 'last'
		) {
			debug( 'Attempting to parse link header: %s', response.headers.link );
			link = parseHeader( response.headers.link );
		}
		// Handle two cases: 1) user does not want multiple pages; 2) only one page exists (no link header => link=null)...
		if (
			link === void 0 || // single page
			link === null      // no link header
		) {
			debug( 'Single page request.' );			
			data = body;
			return done();
		}
		// If we have a link header, we have a paginated response...
		debug( 'Parsed link header: %s', JSON.stringify( link ) );

		if ( data === void 0 ) {
			last = lastPage( opts.last_page, +link.last.page );
			debug( 'Last page to resolve: %d.', last );

			total = getTotal( opts.page, last );
			debug( 'Total number of pages to resolve: %d.', total );

			data = createCache( total );
			debug( 'Initialized response cache of size: %d.', total );
		}
		if ( link.hasOwnProperty( 'next' ) ) {
			curr = +link.next.page - 1;
		} else {
			curr = +link.prev.page + 1;
		}
		debug( 'Current page: %d.', curr );

		debug( 'Caching page results.' );
		data[ curr-1 ] = body;

		if ( curr === opts.page ) {
			debug( 'First paginated result. Resolving %d remaining page(s).', total-count );
			setTimeout( next( curr+1, last ), 0 ); // dezalgo'd
		}
		done();
	} // end FUNCTION onPage()

	/**
	* FUNCTION: next( i, j )
	*	Returns a function to resolve the next pages.
	*
	* @private
	* @param {Number} i - start page
	* @param {Number} j - end page
	* @returns {Function} function to resolve next pages
	*/
	function next( i, j ) {
		/**
		* FUNCTION: next()
		*	Resolves the next set of pages.
		*
		* @private
		* @returns {Void}
		*/
		return function next() {
			getPages( i, j );
		};
	} // end FUNCTION next()

	/**
	* FUNCTION: done( [error] )
	*	Callback invoked upon resolving resources.
	*
	* @private
	* @param {Error} [error] - error object
	* @returns {Void}
	*/
	function done( error ) {
		if ( error && !err ) {
			err = error;
		}
		if ( count === total ) {
			debug( 'Request completed.' );
			if ( err ) {
				if ( ratelimit ) {
					return clbk( err, null, ratelimit );
				}
				return clbk( err );
			}
			if ( total > 1 ) {
				debug( 'Flattening paginated results.' );
				data = flatten( data );
				debug( 'Total number of results: %d', data.length );
			}
			return clbk( null, data, ratelimit );
		}
	} // end FUNCTION done()
}
686580
function normalizeOpts (opts) {
  if (!opts) { opts = {} }

  // hmr plugin expects us to be using watchify
  if (opts.hot) {
    opts.watch = true
  }

  // root directory for all source files
  // (assume that this is the same directory as package.json)
  if (!opts.rootDir) { opts.rootDir = process.cwd() }

  // use browserify-incremental?
  if (typeof opts.inc === 'undefined') { opts.inc = true }
  if (!opts.cacheFile) { opts.cacheFile = '.bcache.json' }

  const outputDefaults = {
    dir: 'dist',
    bundle: path.basename(opts.entry)
  }

  opts.output = Object.assign({}, outputDefaults, opts.output || {})
  opts.outFile = path.join(opts.rootDir, opts.output.dir, opts.output.bundle)

  if (!opts.vendor) { opts.vendor = [] }

  return opts
}
1211142
def get_opts(opts):
    
    defaults = {
        'board': None,
        'terrain': Opt.random,
        'numbers': Opt.preset,
        'ports': Opt.preset,
        'pieces': Opt.preset,
        'players': Opt.preset,
    }
    _opts = defaults.copy()
    if opts is None:
        opts = dict()
    try:
        for key, val in opts.copy().items():
            if key == 'board':
                # board is a string, not a regular opt, and gets special handling
                # in _read_tiles_from_string
                continue
            opts[key] = Opt(val)
        _opts.update(opts)
    except Exception:
        raise ValueError('Invalid options={}'.format(opts))
    logging.debug('used defaults=\n{}\n on opts=\n{}\nreturned total opts=\n{}'.format(
        pprint.pformat(defaults),
        pprint.pformat(opts),
        pprint.pformat(_opts)))
    return _opts
625629
function pullcatalog(opts, cb) {
  opts.path = APIM_CATALOG_ENDP +
              '?' + // filter parms
              APIM_CLIENT_ID_EQ + opts.clientid + '&' +
              APIM_TYPE_EQ + APIM_TYPE_FILTER;
  opts.prefix = 'catalogs-';
  opts.suffix = '.json';
  fetch(opts, function(err, result) {
    if (err) {
      cb(err);
    } else if (typeof result === 'object') {
      response.catalogs = result.file;
      var models = [];
      models.push(new ModelType('products', 'products-', APIM_PRODUCTS_ENDP));
      models.push(new ModelType('apis', 'apis-', APIM_APIS_ENDP));
      models.push(new ModelType('subscriptions', 'subs-', APIM_SUBS_ENDP));
      models.push(new ModelType('tlsprofiles', 'tlsprofs-', APIM_TLS_ENDP));
      models.push(new ModelType('registries', 'registries-', APIM_REGISTRIES_ENDP));
      models.forEach(
        function(model) {
          response[model.name] = [];
        }
      );
      var catalogsJSON;
      try {
        catalogsJSON = JSON.parse(result.contents);
      } catch (e) {
        cb(e);
        return;
      }
      var catalogs = [];
      catalogsJSON.forEach(function(obj) {
        catalogs.push({
          org: obj.organization.id,
          cat: obj.id });
      });
      cb(null, catalogs, models);
    } else {
      var error = new Error('Unexpected type returned from catalog fetch');
      cb(error);
    }
  });
}
715440
function createReqIdHeaders(opts) {

    assert.object(opts, 'opts');
    assert.arrayOfString(opts.headers, 'opts.headers');

    var headers = opts.headers.concat(DEFAULT_HEADERS);

    return function reqIdHeaders(req, res, next) {

        for (var i = 0; i < headers.length; i++) {
            var val = req.header(headers[i]);

            if (val) {
                req.id(val);
                break;
            }
        }

        return next();
    };
}
613766
function parseOptions(opts) {
    opts = opts || {};
    if (toString.call(opts) === '[object String]') {
        opts = {
            directory: opts
        };
    }

    opts.cwd = opts.cwd || process.cwd();

    log.verbosity = toString.call(opts.verbosity) === '[object Number]' ? opts.verbosity : DEFAULT_VERBOSITY;
    delete (opts.verbosity);

    cmd = opts.cmd || DEFAULT_CMD;
    delete (opts.cmd);

    // enable bower prompting but ignore the actual prompt if interactive == false
    enablePrompt = opts.interactive || DEFAULT_INTERACTIVE;
    opts.interactive = true;

    if (!opts.directory) {
        opts.directory = getDirectoryFromBowerRc(opts.cwd) || DEFAULT_DIRECTORY;
    }

    return opts;
}
972729
function (pkg) {
            var b = pkg[KIRIN_IN_PACKAGE_JSON];
            if (b) {
                if (typeof b === 'string') {
                    pkg.main = b;
                }
                else if (typeof b === 'object' && b.main) {
                    pkg.main = b.main;
                }
            }
            return pkg;
        }