Compute a configuration using the current scope.
777041
def get_scoped_config(self, graph):
        
        def loader(metadata):
            if not self.current_scope:
                target = graph.config
            else:
                target = graph.config.get(self.current_scope, {})
            return {
                self.key: target.get(self.key, {}),
            }

        defaults = {
            self.key: get_defaults(self.func),
        }
        return configure(defaults, graph.metadata, loader)
652914
function determineContext( scope ) {
   let current = scope;
   while( !current.hasOwnProperty( 'widget' ) && current !== current.$root ) {
      current = current.$parent;
   }

   const isInWidget = !!current.widget;

   return {
      widgetName: isInWidget ? current.widget.path : '',
      widgetId: isInWidget ? current.widget.id : '',
      widgetScopeId: isInWidget ? current.$id : null,
      scopeId: scope.$id
   };
}
39718
def setup_config(command, filename, section, vars):
    """"""
    confuri = "config:" + filename
    if ":" in section:
        confuri += "#" + section.rsplit(":", 1)[-1]
    conf = appconfig(confuri)

    load_environment(conf.global_conf, conf.local_conf)
913087
def current(config):
    """"""
    with open(config, 'r'):
        main.current(yaml.load(open(config)))
703552
def settings(instance):
    """"""
    with open(instance.root_dir + '/Config/config.yml') as config:
        config = yaml.load(config)
        instance.name = config['name']
        instance.port = config['web']['port']
        # default host
        instance.host = "http://localhost"
        if 'host' in config['web']:
            instance.host = config['web']['host']
        instance.debug = config['debug']
    return instance
419896
function(settings, scope) {
        var
          scopeOptions = angular.extend({}, scope),
          htOptions, i, length;

        settings = settings || {};
        angular.extend(scopeOptions, scope.settings || {});
        htOptions = this.getAvailableSettings();

        for (i = 0, length = htOptions.length; i < length; i++) {
          if (typeof scopeOptions[htOptions[i]] !== 'undefined') {
            settings[htOptions[i]] = scopeOptions[htOptions[i]];
          }
        }

        return settings;
      }
935275
def read_config():
    """"""
    # XXX modifies global state, which is kind of evil
    config = _load_config()
    if config.get(CFG_IGNORE_DEFAULT_RULES[1], False):
        del IGNORE[:]
    if CFG_IGNORE[1] in config:
        IGNORE.extend(p for p in config[CFG_IGNORE[1]] if p)
    if CFG_IGNORE_BAD_IDEAS[1] in config:
        IGNORE_BAD_IDEAS.extend(p for p in config[CFG_IGNORE_BAD_IDEAS[1]] if p)
617359
def _load_config():
    """"""
    fname = _get_config_fname()
    if fname is None or not op.isfile(fname):
        return dict()
    with open(fname, 'r') as fid:
        config = json.load(fid)
    return config
754028
def register(key, initializer: callable, param=None):
    ''''''
    get_current_scope().container.register(key, initializer, param)
987818
def named_config(self, func):
        
        config_scope = ConfigScope(func)
        self._add_named_config(func.__name__, config_scope)
        return config_scope
80554
private Scope switchScope(Scope scope) {
    Scope prev = currentScope;
    currentScope = scope;
    return prev;
  }
180125
def configure(*val , &block)
      case val.size
      when 1
        return @config[val[0]]
      when 2
        @config[val[0]] = val[1]
        instance_variable_set("@#{val[0]}", val[1]) 
      end
      instance_eval &block if block_given?
    end
215367
def compute(self):
        """"""
        self.value = self.value_provider()
        if self.value is not_computed:
            return None
        else:
            return self.value
8195
def config(self):
        """"""
        return ", ".join('%s:%s' % (key, value) for key, value in self.conf.items())
943500
def load_configuration(working_dir):
    

    import nameset.virtualchain_hooks as virtualchain_hooks

    # acquire configuration, and store it globally
    opts = configure(working_dir)
    blockstack_opts = opts.get('blockstack', None)
    blockstack_api_opts = opts.get('blockstack-api', None)
    bitcoin_opts = opts['bitcoind']

    # config file version check
    config_server_version = blockstack_opts.get('server_version', None)
    if (config_server_version is None or versions_need_upgrade(config_server_version, VERSION)):
       print >> sys.stderr, "Obsolete or unrecognizable config file ({}): '{}' != '{}'".format(virtualchain.get_config_filename(virtualchain_hooks, working_dir), config_server_version, VERSION)
       print >> sys.stderr, 'Please see the release notes for version {} for instructions to upgrade (in the release-notes/ folder).'.format(VERSION)
       return None

    # store options
    set_bitcoin_opts( bitcoin_opts )
    set_blockstack_opts( blockstack_opts )
    set_blockstack_api_opts( blockstack_api_opts )

    return {
        'bitcoind': bitcoin_opts,
        'blockstack': blockstack_opts,
        'blockstack-api': blockstack_api_opts
    }
1267016
def run_scope(scope, machine, klass, states)
      values = states.flatten.map { |state| machine.states.fetch(state).value }
      scope.call(klass, values)
    end
1021908
def load_config(self):
    """"""
    config = dict([(key, value) for key, value in iteritems(self.options)
                   if key in self.cfg.settings and value is not None])
    for key, value in iteritems(config):
      self.cfg.set(key.lower(), value)