Pick the correct default format.
8667
def set_format(self, format):
        
        if self.options.format:
            self.format = self.options.format
        else:
            self.format = \
                self.config["default_format_" + format]
521906
def default_output_format(content_type='application/json', apply_globally=False, api=None, cli=False, http=True):
    """"""
    def decorator(formatter):
        formatter = hug.output_format.content_type(content_type)(formatter)
        if apply_globally:
            if http:
                hug.defaults.output_format = formatter
            if cli:
                hug.defaults.cli_output_format = formatter
        else:
            apply_to_api = hug.API(api) if api else hug.api.from_object(formatter)
            if http:
                apply_to_api.http.output_format = formatter
            if cli:
                apply_to_api.cli.output_format = formatter
        return formatter
    return decorator
958412
private void setDefaultList() {
        // Remember, these are regexs, so escape properly \\ vs \
        // Also, http://regexpal.com/ for quick testing.
        // The file formats are common types, not inclusive of all types. Remember, more == slower;
        // complex == slower. Don't overload with every obscure image/audio/video format in existence.
    	
    	/* At some point in the future, this could be read from some a config file and
    	 * parsed.  Thus, we just make it as arrays of strings and assume there
    	 * is some level of parsing at some point.  Since it is rarely accessed (like
    	 * once per boot, it need not be optimized).  */
    	final String defaultListArray[][] = {
			{
	    		"^.*\\.(?:gif|jpe?g|png|ico|icns|bmp)$",
	    	    "Extension - Image (ends with .extension)",
	            "false"
	  	    }, {
				"^.*\\.(?:mp[34]|mpe?g|m4[ap]|aac|avi|mov|wmv|og[gav])$",
				"Extension - Audio/Video (ends with .extension)",
				"false"
			}, {
				"^.*\\.(?:pdf|docx?|xlsx?|pptx?)$",
				"Extension - PDF & Office (ends with .extension)",
				"false"
			}, {
				"^.*\\.(?:css|js)$",
				"Extension - Stylesheet, JavaScript (ends with .extension)",
				"false"
			}, {
				"^.*\\.(?:sw[fa]|flv)$",
				"Extension - Flash & related (ends with .extension)",
				"false"
			}, {
				"^[^\\?]*\\.(?:gif|jpe?g|png|ico|icns|bmp)\\?.*$",
				"ExtParam - Image (extension plus ?params=values)",
				"false"
			}, {
				"^[^\\?]*\\.(?:mp[34]|mpe?g|m4[ap]|aac|avi|mov|wmv|og[gav])\\?.*$",
				"ExtParam - Audio/Video (extension plus ?params=values)",
				"false"
			}, {
				"^[^\\?]*\\.(?:pdf|docx?|xlsx?|pptx?)\\?.*$",
				"ExtParam - PDF & Office (extension plus ?params=values)",
				"false"
			}, {
				"^[^\\?]*\\.(?:css|js)\\?.*$",
				"ExtParam - Stylesheet, JavaScript (extension plus ?params=values)",
				"false"
			}, {
				"^[^\\?]*\\.(?:sw[fa]|flv)\\?.*$",
				"ExtParam - Flash & related (extension plus ?params=values)",
				"false"
			}, {
				"^[^\\?]*/(?:WebResource|ScriptResource)\\.axd\\?d=.*$",
				"ExtParam - .NET adx resources (SR/WR.adx?d=)",
				"false"
			}, {
				"^https?://api\\.bing\\.com/qsml\\.aspx?query=.*$",
				"Site - Bing API queries",
				"false"
			}, {
				"^https?://(?:safebrowsing-cache|sb-ssl|sb|safebrowsing).*\\.(?:google|googleapis)\\.com/.*$",
				"Site - Google malware detector updates",
				"false"
			}, {
				"^https?://(?:[^/])*\\.?lastpass\\.com",
				"Site - Lastpass manager",
				"false"
			}, {
				"^https?://(?:.*addons|aus[0-9])\\.mozilla\\.(?:org|net|com)/.*$",
				"Site - Firefox browser updates",
				"false"
			}, {
				"^https?://(?:[^/])*\\.?(?:getfoxyproxy\\.org|getfirebug\\.com|noscript\\.net)",
				"Site - Firefox extensions phoning home",
				"false"
			}, {
				// some of this from http://serverfault.com/questions/332003/what-urls-must-be-in-ies-trusted-sites-list-to-allow-windows-update
				"^https?://(?:.*update\\.microsoft|.*\\.windowsupdate)\\.com/.*$",
				"Site - Microsoft Windows updates",
				"false"
			}, {
				"^https?://clients2\\.google\\.com/service/update2/crx.*$",
				"Site - Google Chrome extension updates",
				"false"
			}, {
				"^https?://detectportal\\.firefox\\.com.*$",
				"Site - Firefox captive portal detection",
				"false"
			}, {
				"^https?://www\\.google-analytics\\.com.*$",
				"Site - Google Analytics",
				"false"
			}, {
				"^https?://ciscobinary\\.openh264\\.org.*$",
				"Site - Firefox h264 codec download", // https://support.mozilla.org/t5/Firefox/Where-is-a-check-that-http-ciscobinary-openh264-org-openh264-is/m-p/1316497#M1005892
				"false"
			}, {
				"^https?://fonts.*$",
				"Site - Fonts CDNs such as fonts.gstatic.com, etc",
				"false"
			}, {
				"^https?://.*\\.cdn\\.mozilla\\.(?:com|org|net)/.*$",
				"Site - Mozilla CDN (requests such as getpocket)",
				"false"
			}, {
				"^https?://.*\\.telemetry\\.mozilla\\.(?:com|org|net)/.*$",
				"Site - Firefox browser telemetry",
				"false"
			}, {
				"^https?://.*\\.adblockplus\\.org.*$",
				"Site - Adblockplus updates and notifications",
				"false"
			}, {
				"^https?://.*\\.services\\.mozilla\\.com.*$",
				"Site - Firefox services",
				"false"
			}, {
				"^https?://.*\\.gvt1\\.com.*$",
				"Site - Google updates",
				"false"
			}
    	};
    	
    	for (String row[] : defaultListArray) {
    		boolean b = row[2].equalsIgnoreCase("true") ? true : false;
        	defaultList.add( new GlobalExcludeURLParamToken( row[0], row[1], b));
    	}
    }
299127
def default_help_formatter(quick_helps):
    
    ret = ''
    for line in quick_helps:
        cmd_path, param_hlp, cmd_hlp = line
        ret += ' '.join(cmd_path) + ' '
        if param_hlp:
            ret += param_hlp + ' '
        ret += '- ' + cmd_hlp + '\n'
    return ret
308521
def _set_defaults(self, defaults):
        """"""
        self.n_res = defaults.n_res
        self.n_sub = defaults.n_sub
        self.randomize = defaults.randomize
        self.return_median = defaults.return_median
        self.efficient = defaults.efficient
        self.return_only_bw = defaults.return_only_bw
        self.n_jobs = defaults.n_jobs
1121350
def _default_service_formatter(
        service_url,
        width,
        height,
        background,
        foreground,
        options
        ):
        """"""

        # Build the base URL
        image_tmp = '{service_url}/{width}x{height}/{background}/{foreground}/'
        image_url = image_tmp.format(
            service_url=service_url,
            width=width,
            height=height,
            background=background,
            foreground=foreground
            )

        # Add any options
        if options:
            image_url += '?' + urlencode(options)

        return image_url
864683
def validate_output_format(self, default_format):
        
        output_format = self.options.output_format

        # Use default format if none is given
        if output_format is None:
            output_format = default_format

        # Check if it's a custom output format from configuration
        # (they take precedence over field names, so name them wisely)
        output_format = config.formats.get(output_format, output_format)

        # Expand plain field list to usable form
        if re.match(r"^[,._0-9a-zA-Z]+$", output_format):
            self.plain_output_format = True
            output_format = "%%(%s)s" % ")s\t%(".join(formatting.validate_field_list(output_format, allow_fmt_specs=True))

        # Replace some escape sequences
        output_format = (output_format
            .replace(r"\\", "\\")
            .replace(r"\n", "\n")
            .replace(r"\t", "\t")
            .replace(r"\$", "\0") # the next 3 allow using $() instead of %()
            .replace("$(", "%(")
            .replace("\0", "$")
            .replace(r"\ ", " ") # to prevent stripping in config file
            #.replace(r"\", "\")
        )

        self.options.output_format = formatting.preparse(output_format)
1067795
function defaultFormat(d) {
  if ((0, _DateUtils.isDate)(d)) {
    var year = d.getFullYear();
    var month = '' + (d.getMonth() + 1);
    var day = '' + d.getDate();
    return year + '-' + month + '-' + day;
  }
  return '';
}
361081
def _auto_fill_defaults(cls):
        """"""
        if not cls.spec.appname:
            cls.spec.appname = get_basename(get_program_path())
        if not cls.spec.dev:
            cls.spec.dev = get_dev_folder()
96786
def input_format(self, content_type):
        """"""
        return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None))
119463
def _set_default_format(self, vmin, vmax):
        ""

        if self.plot_obj.date_axis_info is None:
            self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
        info = self.plot_obj.date_axis_info

        if self.isminor:
            format = np.compress(info['min'] & np.logical_not(info['maj']),
                                 info)
        else:
            format = np.compress(info['maj'], info)
        self.formatdict = {x: f for (x, _, _, f) in format}
        return self.formatdict
141410
def opt_format(self, fmt):
        
        key = get_enum_key(fmt, FORMATTERS)
        if key is not None:
            self.conf["format"] = key
            print("Set format %r" % key)
        else:
            print("Unknown format %r" % fmt)
252053
def setdefault (self, key, def_val=None):
        """"""
        if key in self:
            return self[key]
        self[key] = def_val
        return def_val
623321
def _setDefaults(configObj={}):
    

    paramDict={"build":True,
              "single":True,
              "stepsize":10,
              "in_units":"cps",
              "wt_scl":1.,
              "pixfrac":1.,
              "kernel":"square",
              "fillval":999.,
              "maskval": None,
              "rot":0.,
              "scale":1.,
              "xsh":0.,
              "ysh":0.,
              "blotnx":2048,
              "blotny":2048,
              "outnx":4096,
              "outny":4096,
              "data":None,
              "driz_separate":True,
              "driz_combine":False}

    if(len(configObj) !=0):
        for key in configObj.keys():
            paramDict[key]=configObj[key]

    return paramDict
89282
def set_default(self):
        """"""
        try:
            os.makedirs(os.path.dirname(self._configfile))
        except:
            pass

        self._config = configparser.RawConfigParser()
        self._config.add_section('Settings')

        for key, val in self.DEFAULTS.items():
            self._config.set('Settings', key, val)

        with open(self._configfile, 'w') as f:
            self._config.write(f)
359165
def format_code(source, preferred_quote="'"):
    """"""
    try:
        return _format_code(source, preferred_quote)
    except (tokenize.TokenError, IndentationError):
        return source
941257
private void generatesFormatSelection() {

        if (m_configuration.isUseFormats()) {
            String[] formats = m_configuration.getImageFormatNames().split(",");
            for (int i = 0; i < formats.length; i++) {
                m_formats.put(formats[i].split(":")[0], formats[i].split(":")[1]);
            }
            m_formatSelection.setItems(m_formats);
        } else {
            m_formatSelection.removeFromParent();
            m_descriptionArea.setRowsGallery(4);
        }
    }