Setup options and defaults
486085
function setOptions(schema, options) {
  function setDefaults(array) {
    if (!array.length) {
      if (options.find) { array.push('find'); }
      if (options.findOne || !options.find) { array.push('findOne'); }
    }
  }

  options = options || {};

  options.only = options.only || [];
  options.validateBeforeSave = options.validateBeforeSave === undefined
                                ? schema.options.validateBeforeSave
                                : Boolean(options.validateBeforeSave);

  ['virtual', 'attach', 'modify'].filter(prop => options[prop])
    .forEach(
      prop => {
        if (typeof options[prop] !== 'object') {
          options[prop] = {};
        }
        options[prop].properties = options[prop].properties || {};
        options[prop].only = options[prop].only || Object.keys(options[prop].properties);
      }
    );

  if (options.modify) {
    delete options.modify.properties;
    options.modify.on = options.modify.on || [];
    setDefaults(options.modify.on);
  }
  if (options.attach) {
    Object.keys(options.attach.properties).forEach(property => {
      options.attach.properties[property].on = options.attach.properties[property].on || [];
      setDefaults(options.attach.properties[property].on);
    });
  }

  return options;
}
291323
def setup(options):
    
    sys.path.insert(0, options.gae_lib_path)

    from dev_appserver import fix_sys_path
    fix_sys_path()
686862
protected function configure()
    {
        $this->setName(self::COMMAND_NAME);
        $this->setDescription('Import "core_config_data" settings for an environment');
        $this->addArgument('folder', InputArgument::REQUIRED, 'Import folder name');
        $this->addArgument('environment', InputArgument::REQUIRED, 'Environment name. SubEnvs separated by slash e.g.: development/osx/developer01');
        $this->addOption('base', null, InputOption::VALUE_OPTIONAL, 'Base folder name', 'base');
        $this->addOption('format', 'm', InputOption::VALUE_OPTIONAL, 'Format: yaml, json (Default: yaml)', 'yaml');

        parent::configure();
    }
191562
private function setup()
    {
        self::$version = '3.1.7';
        self::$src = dirname(__FILE__);
        self::$dir = dirname(dirname(__FILE__));
        self::$url = $this->getCuztomUrl(self::$src);

        // Do
        do_action('cuztom_setup');
    }
38894
function setupLogger() {
  "use strict";
  var options = require('./config');

  if (options.v.length == 3) {
    Logger.level = Logger.levels.verbose;
  } else if (options.v.length == 2) {
    Logger.level = Logger.levels.debug;
  } else if (options.v.length == 1) {
    Logger.level = Logger.levels.info;
  } else if (options.s) {
    Logger.level = Logger.levels.noLog;
  }
}
914398
def configure(options, cfg)
      cfg = super(options, cfg)
      cfg[:offline_queueing] = options[:offline_queueing]
      cfg[:filter_params] = options[:filter_params]
      cfg
    end
1180941
function config(options) {
    var current = config.current
    Object.assign(current, options)
    api._init(current)
}
320253
def _setup(self):
        
        context_module = os.environ.get(ENVIRONMENT_CONTEXT_VARIABLE, 'context')
        if not context_module:
            raise ImproperlyConfigured(
                'Requested context points to an empty variable. '
                'You must either define the environment variable {0} '
                'or call context.configure() before accessing the context.'
                .format(ENVIRONMENT_CONTEXT_VARIABLE))

        self._wrapped = Settings(context_module, default_settings=global_context)
346251
function setDefaultSettings(settings) {
  if (!settings)
    throw new Error('Settings must be an object.')

  // Default settings for each project type.
  switch (settings.projectType) {
    case 'cli':
    case 'node-app':
    case 'node-lib':
      settings.platforms ??= ['node']
      break

    case 'lib':
      settings.platforms ??= ['browser', 'node']
      break

    case 'react-spa':
      settings.platforms ??= ['browser']
      settings.jsx ??= true
      settings.react ??= true
      break

    case 'web-lib':
      settings.platforms ??= ['browser']
      break
  }

  // Default supported browsers inferred by the platform.
  if (settings.platforms.includes('browsers')) {
    settings.browsers ??= [
      '>= 0.5%',
      'not ie 11',
      'not op_mini all',
    ]
  }

  // Default supported NodeJS inferred by the platform.
  if (settings.platforms.includes('node'))
    settings.node ??= '8.9'
}
1354768
def set_defaults
      default_user_agent = Config.user_agent || Typhoeus::USER_AGENT

      options[:headers] = {'User-Agent' => default_user_agent}.merge(options[:headers] || {})
      options[:headers]['Expect'] ||= ''
      options[:verbose] = Typhoeus::Config.verbose if options[:verbose].nil? && !Typhoeus::Config.verbose.nil?
      options[:maxredirs] ||= 50
      options[:proxy] = Typhoeus::Config.proxy unless options.has_key?(:proxy) || Typhoeus::Config.proxy.nil?
    end
500188
protected function configure(): void
    {
        $this
            ->setName('make:model')
            ->setDescription('Creates a new App model')
            ->addArgument(
                'modelName',
                InputArgument::OPTIONAL,
                'Define the name of the model to create'
            )
            ->addOption(
                'skip-db',
                null,
                InputOption::VALUE_NONE,
                'Skip database table creation'
            )
            ->addOption(
                'skip-seeder',
                null,
                InputOption::VALUE_NONE,
                'Skip seeder creation'
            )
            ->addOption(
                'auto-detect',
                null,
                InputOption::VALUE_NONE,
                'Automatically build models from the database'
            )
            ->addOption(
                'localised',
                null,
                InputOption::VALUE_NONE,
                'Create a localised model (or convert an existing model)'
            );

        if (Components::exists('nails/module-admin')) {
            $this->addOption(
                'admin',
                null,
                InputOption::VALUE_NONE,
                'Create an admin controller'
            );
        }
    }
52499
function setupOptions(opts) {
    var options = Object.create(null);
    for (var opt in defaultOptions) {
        if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) {
            var incomingOpt = opts[opt];
            options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt;
        } else if (defaultOptions.hasOwnProperty(opt)) {
            var defaultOpt = defaultOptions[opt];
            options[opt] = typeof defaultOpt === 'function' ? defaultOpt() : defaultOpt;
        }
    }
    return options;
  }
631434
@Override
    public void setup() {

        if (log.isInfoEnabled()) {
            log.info("Setting default locale to [" + newLocale + "]");
        }

        try {
            Locale.setDefault(newLocale);
        } catch (Exception e) {
            log.error("Could not switch locale to ["
                    + newLocale + "]. Continuing with standard locale.", e);
        }
    }
616492
function setupConfig(options) {
    if (options.resetConfig) {
        // Reset your environment variables for resetting node-config module. node-config is a singleton.
        // For testing it's necessary to reset and this is a workaround from node-config support.
        global.NODE_CONFIG = null;
        delete require.cache[require.resolve('config')];
        config = require('config');
        delete options.resetConfig;
    }

    var customConfigFile, customConfig,
        defaultConfig       = require('../config/default.js');

    options = options || {};

    if (options.config) {
        customConfigFile    = options.config.charAt(0) === '/' || options.config.charAt(0) === '\\' ? options.config : path.join(process.cwd(), options.config); // Absolute or relative
        customConfig        = require(customConfigFile);
    }

    delete options.config;

    // Combine configs and override lower priority configs.
    config.util.extendDeep(config, defaultConfig, customConfig || {}, { "sequelize-pg-generator": options });
}
701706
function setup(userOptions) {

    Object.assign(options, userOptions);

    /*
        Try to automatically grab the app name from the root directory
     */  
    if (!options.root) {
        try {
            var p = require(path.dirname(process.mainModule.filename) + '/package.json');
            options.root = path.dirname(process.mainModule.filename);
            options.name = p.name;
        } catch (e) {
            options.root = null;    
        }
    }

    if (options.root && !options.name) {
        try {
            var p = require(options.root + '/package.json');
            options.name = p.name;
        } catch (e) {
        }
    }

    /*
        In production mode, define default log threshold to info
     */
    if (process.env.LOG_LEVEL === undefined && process.env.NODE_ENV === "production") {
        process.env.LOG_LEVEL = "info";
    }

    options.name = options.name || ".";
    replace();
    return restore;
}
602302
protected function setupDefaultOptions()
    {
        $defaults = [
            'overwriteInitial'     => false,
            'initialPreviewAsData' => true,
            'browseLabel'          => trans('admin.browse'),
            'cancelLabel'          => trans('admin.cancel'),
            'showRemove'           => false,
            'showUpload'           => false,
            'dropZoneEnabled'      => false,
            'deleteExtraData'      => [
                $this->formatName($this->column) => static::FILE_DELETE_FLAG,
                static::FILE_DELETE_FLAG         => '',
                '_token'                         => csrf_token(),
                '_method'                        => 'PUT',
            ],
        ];

        if ($this->form instanceof Form) {
            $defaults['deleteUrl'] = $this->form->resource().'/'.$this->form->model()->getKey();
        }

        $defaults = array_merge($defaults, ['fileActionSettings' => $this->fileActionSettings]);

        $this->options($defaults);
    }
638575
protected function configure()
    {
        $this->setName($this->name);
        $this->setDescription($this->description);

        foreach ($this->arguments as $argument) {
            $this->getDefinition()->addArgument($argument);
        }

        foreach ($this->options as $option) {
            $this->getDefinition()->addOption($option);
        }
    }