Set defaults for command line utilities
776058
static public function commandLineDefaults() {
		if ( ! defined( 'PB_CONVERT_COMMAND' ) ) {
			define( 'PB_CONVERT_COMMAND', '/usr/bin/convert' );
		}
		if ( ! defined( 'PB_GS_COMMAND' ) ) {
			define( 'PB_GS_COMMAND', '/usr/bin/gs' );
		}
		if ( ! defined( 'PB_PDFINFO_COMMAND' ) ) {
			define( 'PB_PDFINFO_COMMAND', '/usr/bin/pdfinfo' );
		}
		if ( ! defined( 'PB_PDFTOPPM_COMMAND' ) ) {
			define( 'PB_PDFTOPPM_COMMAND', '/usr/bin/pdftoppm' );
		}
		if ( ! defined( 'PB_PRINCE_COMMAND' ) ) {
			define( 'PB_PRINCE_COMMAND', '/usr/bin/prince' );
		}
	}
1048283
def create_default_options_getter():
    """"""
    options = []
    try:
        ttyname = subprocess.check_output(args=['tty']).strip()
        options.append(b'ttyname=' + ttyname)
    except subprocess.CalledProcessError as e:
        log.warning('no TTY found: %s', e)

    display = os.environ.get('DISPLAY')
    if display is not None:
        options.append('display={}'.format(display).encode('ascii'))
    else:
        log.warning('DISPLAY not defined')

    log.info('using %s for pinentry options', options)
    return lambda: options
331914
def Update(self, env, args=None):
        

        values = {}

        # first set the defaults:
        for option in self.options:
            if not option.default is None:
                values[option.key] = option.default

        # next set the value specified in the options file
        for filename in self.files:
            if os.path.exists(filename):
                dir = os.path.split(os.path.abspath(filename))[0]
                if dir:
                    sys.path.insert(0, dir)
                try:
                    values['__name__'] = filename
                    with open(filename, 'r') as f:
                        contents = f.read()
                    exec(contents, {}, values)
                finally:
                    if dir:
                        del sys.path[0]
                    del values['__name__']

        # set the values specified on the command line
        if args is None:
            args = self.args

        for arg, value in args.items():
            added = False
            for option in self.options:
                if arg in list(option.aliases) + [ option.key ]:
                    values[option.key] = value
                    added = True
            if not added:
                self.unknown[arg] = value

        # put the variables in the environment:
        # (don't copy over variables that are not declared as options)
        for option in self.options:
            try:
                env[option.key] = values[option.key]
            except KeyError:
                pass

        # Call the convert functions:
        for option in self.options:
            if option.converter and option.key in values:
                value = env.subst('${%s}'%option.key)
                try:
                    try:
                        env[option.key] = option.converter(value)
                    except TypeError:
                        env[option.key] = option.converter(value, env)
                except ValueError as x:
                    raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))


        # Finally validate the values:
        for option in self.options:
            if option.validator and option.key in values:
                option.validator(option.key, env.subst('${%s}'%option.key), env)
712450
def change_default(
    kls,
    key,
    new_default,
    new_converter=None,
    new_reference_value=None,
):
    """"""
    an_option = kls.get_required_config()[key].copy()
    an_option.default = new_default
    if new_converter:
        an_option.from_string_converter = new_converter
    if new_reference_value:
        an_option.reference_value_from = new_reference_value
    return an_option
204716
protected function setDefaults()
  {
    $this->importPaths = array();
    $this->pluginPaths = array();
    $this->sourceMap = self::DEFAULT_SOURCEMAP;
    $this->mapComment = self::DEFAULT_MAPCOMMENT;
    $this->lineNumbers = self::DEFAULT_LINENUMBERS;
    $this->precision = self::DEFAULT_PRECISION;
    $this->style = self::DEFAULT_STYLE;
  }
1004715
def set_defaults(defaults, kwargs):
    
    for key, value in defaults.items():
        if key not in kwargs and value is not None:
            kwargs[key] = value
        elif isinstance(value, list) and isinstance(kwargs[key], list):
            kwargs[key] = list(value) + kwargs[key]
        elif isinstance(value, dict) and isinstance(kwargs[key], dict):
            set_defaults(value, kwargs[key])
        elif key in kwargs and value is None:
            kwargs[key] = None
44281
protected function setDefaults()
	{
		$this->binary = function()
		{
			if (is_dir(__DIR__.'/../../../vendor'))
			{
				$bin = __DIR__.'/../../../vendor/bin/phantomjs';
			}
			else
			{
				$bin = __DIR__.'/../../../../bin/phantomjs';
			}

			if (!is_executable($bin))
			{
				throw new RuntimeException
				(
					'The phantomjs command ("'.$bin.'") '.
					'was not found or is not executable by the current user! '
				);
			}

			return realpath($bin);
		};

		$this->runner = __DIR__.'/Phantom.js';

		$this->process = $this->protect(function($cmd)
		{
			return new Process($cmd);
		});

		$this->tempFile = $this->protect(function()
		{
			return new TempFile('GearsPdf', 'pdf');
		});

		$this->printFramework = function()
		{
			return
			'
				<style>'.file_get_contents(__DIR__.'/Print.css').'</style>
				<script>'.file_get_contents(__DIR__.'/isVisible.js').'</script>
				<script>'.file_get_contents(__DIR__.'/jQuery.js').'</script>
				<script>'.file_get_contents(__DIR__.'/Print.js').'</script>
			';
		};
	}
1127677
def _setToDefaults(self):
        

        # Create an empty object, where every item is set to it's default value
        try:
            tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename,
                                           associatedPkg=\
                                           self._taskParsObj.getAssocPkg(),
                                           setAllToDefaults=self.taskName,
                                           strict=False)
        except Exception as ex:
            msg = "Error Determining Defaults"
            showerror(message=msg+'\n\n'+ex.message, title="Error Determining Defaults")
            return

        # Set the GUI entries to these values (let the user Save after)
        tmpObj.filename = self._taskParsObj.filename = '' # name it later
        newParList = tmpObj.getParList()
        try:
            self.setAllEntriesFromParList(newParList) # needn't updateModel yet
            self.checkAllTriggers('defaults')
            self.updateTitle('')
            self.showStatus("Loaded default "+self.taskName+" values via: "+ \
                 os.path.basename(tmpObj._original_configspec), keep=1)
        except editpar.UnfoundParamError as pe:
            showerror(message=str(pe), title="Error Setting to Default Values")
845714
def defaults(current: dict, *args: AnyMapping) -> dict:
    
    """
    for data in args:
        for key, value in data.items():
            current.setdefault(key, value)
    return current
1274232
def default(self, cmd):
        '''  '''
        choices = ["help", "mode", "psiturk_status", "server", "shortcuts",
                   "worker", "db", "edit", "open", "config", "show",
                   "debug", "setup_example", "status", "tunnel", "amt_balance",
                   "download_datafiles", "exit", "hit", "load", "quit", "save",
                   "shell", "version"]
        print "%s is not a psiTurk command. See 'help'." %(cmd)
        print "Did you mean this?\n      %s" %(process.extractOne(cmd,
                                                                  choices)[0])
492694
def _set_defaults(self, log_level=logging.INFO, redirect_stdout=False):
        """"""

        # Remove all previous handlers
        for handler in self.handlers[:]:
            self.removeHandler(handler)

        # Set levels
        self.setLevel(logging.DEBUG)

        # Set up the stdout handler
        self.fh = None
        self.sh = logging.StreamHandler()
        self.sh.emit = colored_formatter
        self.addHandler(self.sh)

        self.sh.setLevel(log_level)

        # warnings.showwarning = self._show_warning

        # Redirects all stdout to the logger
        if redirect_stdout:
            sys.stdout = LoggerStdout(self._print)

        # Catches exceptions
        sys.excepthook = self._catch_exceptions
146148
def _update_defaults(self, defaults):
        """"""

        # Accumulate complex default state.
        self.values = optparse.Values(self.defaults)
        late_eval = set()
        # Then set the options with those values
        for key, val in self._get_ordered_configuration_items():
            # '--' because configuration supports only long names
            option = self.get_option('--' + key)

            # Ignore options not present in this parser. E.g. non-globals put
            # in [global] by users that want them to apply to all applicable
            # commands.
            if option is None:
                continue

            if option.action in ('store_true', 'store_false', 'count'):
                try:
                    val = strtobool(val)
                except ValueError:
                    error_msg = invalid_config_error_message(
                        option.action, key, val
                    )
                    self.error(error_msg)

            elif option.action == 'append':
                val = val.split()
                val = [self.check_default(option, key, v) for v in val]
            elif option.action == 'callback':
                late_eval.add(option.dest)
                opt_str = option.get_opt_string()
                val = option.convert_value(opt_str, val)
                # From take_action
                args = option.callback_args or ()
                kwargs = option.callback_kwargs or {}
                option.callback(option, opt_str, val, self, *args, **kwargs)
            else:
                val = self.check_default(option, key, val)

            defaults[option.dest] = val

        for key in late_eval:
            defaults[key] = getattr(self.values, key)
        self.values = None
        return defaults
1161524
def update_defaults(self, defaults):
        
        # Then go and look for the other sources of configuration:
        config = {}
        # 1. config files
        config.update(dict(self.get_config_section('virtualenv')))
        # 2. environmental variables
        config.update(dict(self.get_environ_vars()))
        # Then set the options with those values
        for key, val in config.items():
            key = key.replace('_', '-')
            if not key.startswith('--'):
                key = '--%s' % key  # only prefer long opts
            option = self.get_option(key)
            if option is not None:
                # ignore empty values
                if not val:
                    continue
                # handle multiline configs
                if option.action == 'append':
                    val = val.split()
                else:
                    option.nargs = 1
                if option.action == 'store_false':
                    val = not strtobool(val)
                elif option.action in ('store_true', 'count'):
                    val = strtobool(val)
                try:
                    val = option.convert_value(key, val)
                except optparse.OptionValueError:
                    e = sys.exc_info()[1]
                    print("An error occured during configuration: %s" % e)
                    sys.exit(3)
                defaults[option.dest] = val
        return defaults
1138703
def add_command_line_options_optparse(cls, optparser):
        """"""

        def set_parameter(option, opt, value, parser):
            """callback function for OptionParser"""
            cls.config[opt] = value
            if opt == "--stomp-conf":
                cls.load_configuration_file(value)

        optparser.add_option(
            "--stomp-host",
            metavar="HOST",
            default=cls.defaults.get("--stomp-host"),
            help="Stomp broker address, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-port",
            metavar="PORT",
            default=cls.defaults.get("--stomp-port"),
            help="Stomp broker port, default '%default'",
            type="int",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-user",
            metavar="USER",
            default=cls.defaults.get("--stomp-user"),
            help="Stomp user, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-pass",
            metavar="PASS",
            default=cls.defaults.get("--stomp-pass"),
            help="Stomp password",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-prfx",
            metavar="PRE",
            default=cls.defaults.get("--stomp-prfx"),
            help="Stomp namespace prefix, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-conf",
            metavar="CNF",
            default=cls.defaults.get("--stomp-conf"),
            help="Stomp configuration file containing connection information, disables default values",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
264170
def _setDefaults(input_dict={}):
    
    paramDict = {
        'input':'*flt.fits',
        'output':None,
        'mdriztab':None,
        'refimage':None,
        'runfile':None,
        'workinplace':False,
        'updatewcs':True,
        'proc_unit':'native',
        'coeffs':True,
        'context':False,
        'clean':True,
        'group':None,
        'ra':None,
        'dec':None,
        'build':True,
        'gain':None,
        'gnkeyword':None,
        'readnoise':None,
        'rnkeyword':None,
        'exptime':None,
        'expkeyword':None,
        'crbitval':4096,
        'static':True,
        'static_sig':4.0,
        'skysub':True,
        'skymethod':"globalmin+match",
        'skystat':"median",
        'skywidth':0.1,
        'skylower':None,
        'skyupper':None,
        'skyclip':5,
        'skylsigma':4.0,
        'skyusigma':4.0,
        "skymask_cat":"",
        "use_static":True,
        "sky_bits":0,
        "skyuser":"",
        "skyfile":"",
        'driz_separate':True,
        'driz_sep_outnx':None,
        'driz_sep_outny':None,
        'driz_sep_crpix1':None,
        'driz_sep_crpix2':None,
        'driz_sep_kernel':'turbo',
        'driz_sep_scale':None,
        'driz_sep_pixfrac':1.0,
        'driz_sep_rot':None,
        'driz_sep_fillval':None,
        'driz_sep_bits':0,
        'median':True,
        'median_newmasks':True,
        'combine_type':"minmed",
        'combine_nsigma':"4 3",
        'combine_nlow':0,
        'combine_nhigh':1,
        'combine_lthresh':None,
        'combine_hthresh':None,
        'combine_grow':1,
        'blot':True,
        'blot_interp':'poly5',
        'blot_sinscl':1.0,
        'driz_cr':True,
        'driz_cr_corr':False,
        'driz_cr_snr':"3.5 3.0",
        'driz_cr_scale':"1.2 0.7",
        'driz_cr_cteg':0,
        'driz_cr_grow':1,
        'driz_combine':True,
        'final_wht_type':"EXP",
        'final_outnx':None,
        'final_outny':None,
        'final_crpix1':None,
        'final_crpix2':None,
        'final_kernel':'square',
        'final_scale':None,
        'final_pixfrac':1.0,
        'final_rot':None,
        'final_fillval':None,
        'final_bits':0}

    paramDict.update(input_dict)

    print('\nUser Input Parameters for Init Step:')
    util.printParams(paramDict)

    return paramDict
863829
def set_default(cls, name):
        """"""
        if name not in cls._depots:
            raise RuntimeError('%s depot has not been configured' % (name,))
        cls._default_depot = name
280000
function loadDefaultOpts(startDir, configFile) {
  try {
    return require(path.join(startDir, configFile)).options || {};
  } catch (e) {
    var dir = path.dirname(startDir);
    if (dir === startDir) {
      return {};
    }
    return loadDefaultOpts(dir, configFile);
  }
}