Read a configuration from the database whose name matches the the given
configuration name
771431
public MigrationConfiguration getMigrationConfiguration(String configurationName)
            throws IOException, LightblueException {
        DataFindRequest findRequest = new DataFindRequest("migrationConfiguration", null);
        findRequest.where(Query.and(
                Query.withValue("configurationName", Query.eq, configurationName),
                Query.withValue("consistencyCheckerName", Query.eq, cfg.getName()))
        );
        findRequest.select(Projection.includeFieldRecursively("*"));
        LOGGER.debug("Loading configuration:{}", findRequest.getBody());
        return lightblueClient.data(findRequest, MigrationConfiguration.class);
    }
994272
def read_config(cls, configparser):
        """"""
        config = dict()
        section = cls.__name__
        option = sslcertwarndays
        if configparser.has_option(section, option):
            num = configparser.getint(section, option)
            if num > 0:
                config[option] = num
            else:
                msg = _("invalid value for %s: %d must not be less than %d") % (option, num, 0)
                raise LinkCheckerError(msg)
        else:
            # set the default
            config[option] = 30
        return config
678202
def read(database, table, key):
    """"""
    with database.snapshot() as snapshot:
        result = snapshot.execute_sql('SELECT u.* FROM %s u WHERE u.id="%s"' %
                                      (table, key))
        for row in result:
            key = row[0]
        for i in range(NUM_FIELD):
            field = row[i + 1]
905380
def load_config(filename=None):
    
    try:
        with _config_stream(filename) as handle:
            filename = handle.name
            return deserialize_config(handle.read())
    except (OSError, toml.TomlDecodeError, UnicodeDecodeError) as exc:
        raise ConfigError(
            'Error loading configuration from {}'.format(filename)) from exc
348992
def read(config_file, configspec, server_mode=False, default_section='default_settings', list_values=True):
    '''
    
    '''
#    configspec = ConfigObj(path.join(path.abspath(path.dirname(__file__)), configspec),
#                           encoding='UTF8',
#                           interpolation='Template',
#                           list_values=False,
#                           _inspec=True)
    config = ConfigObj(config_file,
                       configspec=path.join(path.abspath(path.dirname(__file__)),
                                            configspec),
                                            list_values=list_values)
    validation = config.validate(validate.Validator(), preserve_errors=True)

    if validation == True:
        config = dict(config)
        for section in config:
            if section != default_section:
                if server_mode: # When it's a servers config file, retrieve the correct fqdn
                    config[section]['availability'] = True
                    if config[section]['custom_fqdn'] == None:
                        config[section]['custom_fqdn'] = socket.getfqdn()
                for option in config[section]:  # retrieve default configuration for missing values
                    if config[section][option] == None:
                        config[section][option] = config[default_section][option]

        del(config[default_section])

        return config
    else:
        raise ConfiguratorException(config_file, validation)
1203558
def fetch_config(filename):
    

    #  This trick gets the directory of *this* file Configuration.py thus
    # allowing to find the schema files relative to this file.
    dir_name = get_source_dir()

    # Append json
    filename = os.path.join('json', filename)

    fileobj = open(os.path.join(dir_name, filename), 'r')
    my_dict = json.loads(fileobj.read())
    return my_dict
764491
function readConfig() {
  const patten = `${process.cwd()}/config/*.json`
  return glob.sync(patten).reduce((acc, curr) => {
    var ctx = !env ? require(curr) : require(curr)[env]
    return Object.assign({}, acc, ctx)
  }, {})
}
963020
def _read_config(filename):
    
    parser = configparser.RawConfigParser()
    if filename and not parser.read(filename):
        sys.stderr.write("Unable to open configuration file %s. Use --config='' to disable this warning.\n" % filename)

    config = {}

    for section, defaults in BASE_CONFIG.items():
        # Patterns are handled separately
        if section == 'patterns':
            continue

        for name, descr in defaults.items():
            kind, default = descr
            if section in parser.sections() and name in parser.options(section):
                if kind == 'int':
                    value = parser.getint(section, name)
                elif kind == 'float':
                    value = parser.getfloat(section, name)
                elif kind == 'bool':
                    value = parser.getboolean(section, name)
                else:
                    value = parser.get(section, name)
            else:
                value = default
            config[name] = value

    if 'patterns' in parser.sections():
        patterns = [parser.get('patterns', opt) for opt in parser.options('patterns')]
    else:
        patterns = DEFAULT_PATTERNS
    config['patterns'] = patterns

    return config
1168946
def read_contents(self, schema, name, conn):
        ''''''
        sql = '''
with schemas as
(select n.oid,
        n.nspname as name
  from pg_catalog.pg_namespace n),
tables as
(select c.oid,
        c.relnamespace as schema_oid,
        c.relname as name
 from pg_catalog.pg_class c
 where c.relkind in ('r','v','m','f'))
select a.attname,
       ty.typname,
       d.description
 from
    schemas s
    join tables t on (s.oid = t.schema_oid)
    join pg_catalog.pg_attribute a on (a.attrelid = t.oid)
    join pg_catalog.pg_type ty on (ty.oid = a.atttypid)
    left join pg_catalog.pg_description d on
    (d.objoid = a.attrelid and d.objsubid = coalesce(a.attnum,d.objsubid))
where s.name = %s and
      t.name = %s and
      coalesce(a.attnum,1) > 0
order by s.name,t.name,a.attnum'''
        log = get_logger()
        cur = conn.cursor()
        cur.execute(sql, [schema, name])
        columns = cur.fetchall()
        for column in columns:
            column_dict = {'name': column[0],
                           'type': column[1],
                           'comment': column[2]}
            log.debug('{} {}: {}'.format(column[0], column[1], column[2]))
            self.contents.append(copy.deepcopy(column_dict))
        cur.close()
449429
def _read_config(cls):
        

        cls._config_parser = configparser.ConfigParser()
        cls._config_parser.read(cls._default_attribute_values_configuration_file_path)
580739
def read_config_file(filename)
      contents = ""
      File.open(filename, "r") { |f| contents = f.read() } if File.exists?(filename)
      contents
    end
183797
def _parse_connection_name(self, name):
        
        if name is None:
            name = self.get_default_connection()

        if name.endswith(('::read', '::write')):
            return name.split('::', 1)

        return name, None
1189295
def read(self, name):
        """"""
        call_params = dict()
        if os.name == 'nt' and sys.version_info >= (3, 0):
            # if system is windows - force utf-8 encoding
            call_params['encoding'] = 'utf-8'
        with open(os.path.join(self.migrate_dir, name + '.py'), **call_params) as f:
            code = f.read()
            scope = {}
            exec_in(code, scope)
            return scope.get('migrate', VOID), scope.get('rollback', VOID)
1268381
def read(config_values):
    """"""
    if not config_values:
        raise RheaError('Cannot read config_value: `{}`'.format(config_values))

    config_values = to_list(config_values)

    config = {}
    for config_value in config_values:
        config_value = ConfigSpec.get_from(value=config_value)
        config_value.check_type()
        config_results = config_value.read()
        if config_results and isinstance(config_results, Mapping):
            config = deep_update(config, config_results)
        elif config_value.check_if_exists:
            raise RheaError('Cannot read config_value: `{}`'.format(config_value))

    return config
781699
def _read_configuration_file(self, config_filename):
        
        config = configparser.ConfigParser()
        config.read(config_filename)

        self._constants_filename = config.get('constants', 'columns')
        self._prefix = config.get('constants', 'prefix')
        self._class_name = config.get('constants', 'class')
1220201
def config_get(self, pattern='*'):
        
        result = {}
        for name, value in self.redis_config.items():
            if fnmatch.fnmatch(name, pattern):
                try:
                    result[name] = int(value)
                except ValueError:
                    result[name] = value
        return result
223330
def parse_config(self):
        """"""
        config = config_get()
        mysql_config = {}
        if 'max-connections' in config:
            mysql_config['max_connections'] = config['max-connections']

        if 'wait-timeout' in config:
            mysql_config['wait_timeout'] = config['wait-timeout']

        if 'innodb-flush-log-at-trx-commit' in config:
            mysql_config['innodb_flush_log_at_trx_commit'] = \
                config['innodb-flush-log-at-trx-commit']
        elif 'tuning-level' in config:
            mysql_config['innodb_flush_log_at_trx_commit'] = \
                self.INNODB_FLUSH_CONFIG_VALUES.get(config['tuning-level'], 1)

        if ('innodb-change-buffering' in config and
                config['innodb-change-buffering'] in self.INNODB_VALID_BUFFERING_VALUES):
            mysql_config['innodb_change_buffering'] = config['innodb-change-buffering']

        if 'innodb-io-capacity' in config:
            mysql_config['innodb_io_capacity'] = config['innodb-io-capacity']

        # Set a sane default key_buffer size
        mysql_config['key_buffer'] = self.human_to_bytes('32M')
        total_memory = self.human_to_bytes(self.get_mem_total())

        dataset_bytes = config.get('dataset-size', None)
        innodb_buffer_pool_size = config.get('innodb-buffer-pool-size', None)

        if innodb_buffer_pool_size:
            innodb_buffer_pool_size = self.human_to_bytes(
                innodb_buffer_pool_size)
        elif dataset_bytes:
            log("Option 'dataset-size' has been deprecated, please use"
                "innodb_buffer_pool_size option instead", level="WARN")
            innodb_buffer_pool_size = self.human_to_bytes(
                dataset_bytes)
        else:
            # NOTE(jamespage): pick the smallest of 50% of RAM or 512MB
            #                  to ensure that deployments in containers
            #                  without constraints don't try to consume
            #                  silly amounts of memory.
            innodb_buffer_pool_size = min(
                int(total_memory * self.DEFAULT_INNODB_BUFFER_FACTOR),
                self.DEFAULT_INNODB_BUFFER_SIZE_MAX
            )

        if innodb_buffer_pool_size > total_memory:
            log("innodb_buffer_pool_size; {} is greater than system available memory:{}".format(
                innodb_buffer_pool_size,
                total_memory), level='WARN')

        mysql_config['innodb_buffer_pool_size'] = innodb_buffer_pool_size
        return mysql_config