Initialise default formats.
698
def _init_formats(self):
        
        theme = self._color_scheme
        # normal message format
        fmt = QtGui.QTextCharFormat()
        fmt.setForeground(theme.foreground)
        fmt.setBackground(theme.background)
        self._formats[OutputFormat.NormalMessageFormat] = fmt

        # error message
        fmt = QtGui.QTextCharFormat()
        fmt.setForeground(theme.error)
        fmt.setBackground(theme.background)
        self._formats[OutputFormat.ErrorMessageFormat] = fmt

        # debug message
        fmt = QtGui.QTextCharFormat()
        fmt.setForeground(theme.custom)
        fmt.setBackground(theme.background)
        self._formats[OutputFormat.CustomFormat] = fmt
1021359
def setdefaults(dct, defaults):
    """"""
    for key in defaults:
        dct.setdefault(key, defaults[key])

    return dct
745419
def set_encoding_format(self, encoding_format):
    """"""
    supported = ENCODE_FN.keys()
    if encoding_format not in supported:
      raise ValueError('`encoding_format` must be one of %s.' % supported)
    self._encoding_format = encoding_format
1087705
def set_defaults(self):
        
        for key, val in self.c_default.items():
            self._dict[key] = val
801344
def set_input_format(self, content_type, handler):
        """"""
        if getattr(self, '_input_format', None) is None:
            self._input_format = {}
        self._input_format[content_type] = handler
111099
def _prepare_defaults(self):
		""""""
		
		for name, field in self.__fields__.items():
			if field.assign:
				getattr(self, name)
268655
protected function initDefaultHeaders()
    {
        // add this header to prevent .php request to be cached
        $this->addHeader(HttpProtocol::HEADER_EXPIRES, '19 Nov 1981 08:52:00 GMT');
        $this->addHeader(HttpProtocol::HEADER_CACHE_CONTROL, 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->addHeader(HttpProtocol::HEADER_PRAGMA, 'no-cache');

        // set per default text/html mimetype
        $this->addHeader(HttpProtocol::HEADER_CONTENT_TYPE, 'text/html');
    }
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
1289674
def init_write_line(self):
        """"""
        format_list = self._format_list
        output_info = self.gen_output_fmt(format_list)
        self._output_fmt = "".join([sub[0] for sub in output_info])
        self._out_gen_fmt = [sub[1] for sub in output_info if sub[1] is not None]
        self._out_widths = [sub[2] for sub in output_info if sub[2] is not None]
        self._write_line_init = True
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
793832
public function initializeFormats() {
        if (is_null($this->formats)) {
            $self = $this;
            $this->registerFormat(Format::DBASE3, function ($filePath, $mode) {
                return new format\DBase3($filePath, $mode);
            });
            $this->registerFormat(Format::FOXPRO, function ($filePath, $mode) {
                return new format\FoxPro($filePath, $mode);
            });
            $this->registerFormat(Format::AUTO, function ($filePath, $mode) use (&$self) {
                foreach ($self->getFormats() as $name => $generator) {
                    try {
                        if ($name === Format::AUTO) {
                            continue;
                        }
                        $format = call_user_func($generator, $filePath, $mode);
                        if (!$format instanceof Format) {
                            throw new Exception('Invalid format returned from generator (' . Utils::getType($format) . ')');
                        }
                        if ($format->isValid()) {
                            return $format;
                        }
                    }
                    catch(Exception $e) {
                        throw $e;
                    }
                    catch (StdException $e) {
                        throw new Exception("Unable to detect format of `$filePath`", 0, $e);
                    }
                }
                throw new Exception("Unable to detect format of `$filePath`");
            });
        }
        return $this;
    }
1270297
def init_default_cb():
    """"""
    global default_cb
    nlcb = os.environ.get('NLCB', '').lower()
    if not nlcb:
        return

    if nlcb == 'default':
        default_cb = NL_CB_DEFAULT
    elif nlcb == 'verbose':
        default_cb = NL_CB_VERBOSE
    elif nlcb == 'debug':
        default_cb = NL_CB_DEBUG
    else:
        _LOGGER.warning('Unknown value for NLCB, valid values: {default | verbose | debug}')
257766
def _init_metadata(self, **kwargs):
        """"""
        osid_objects.OsidRelationshipForm._init_metadata(self, **kwargs)
        update_display_text_defaults(self._mdata['text'], self._locale_map)
        self._text_default = dict(self._mdata['text']['default_string_values'][0])
        self._rating_default = self._mdata['rating']['default_id_values'][0]
877778
def _init_metadata(self, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
        self._taker_default = self._mdata['taker']['default_id_values'][0]
659342
def _register_formats(cls):
        """"""
        for fmt in cls.OUTPUT_FORMATS:
            clean_fmt = fmt.replace('+', '_')
            setattr(cls, clean_fmt, property(
                (lambda x, fmt=fmt: cls._output(x, fmt)), # fget
                (lambda x, y, fmt=fmt: cls._input(x, y, fmt))))
913059
def init_config(self, app):
        """"""
        for k in dir(config):
            if k.startswith('JSONSCHEMAS_'):
                app.config.setdefault(k, getattr(config, k))

        host_setting = app.config['JSONSCHEMAS_HOST']
        if not host_setting or host_setting == 'localhost':
            app.logger.warning('JSONSCHEMAS_HOST is set to {0}'.format(
                host_setting))
229714
def __init_defaults(self, config):
        """"""

        provider = self.__provider

        if provider == 'sqlite':
            config.setdefault('dbname', ':memory:')
            config.setdefault('create_db',  True)
        elif provider == 'mysql':
            config.setdefault('port', 3306)
            config.setdefault('charset', 'utf8')
        elif provider == 'postgres':
            config.setdefault('port', 5432)
        elif provider == 'oracle':
            config.setdefault('port', 1521)
        else:
            raise ValueError('Unsupported provider "{}"'.format(provider))

        if provider != 'sqlite':
            config.setdefault('host', 'localhost')
            config.setdefault('user', None)
            config.setdefault('password', None)
            config.setdefault('dbname', None)