Context: A dict of namespaces as the key, and their objects as the
            value. Used to easily inject code into the shell's runtime env.
321004
def run(self, commands=None, default_command=None, context=None):
        

        if commands:
            self._commands.update(commands)

            # HACK: Overriding the old shell isn't cool.
            # Should do it by default.
        from alchemist.commands import Shell
        self._commands['shell'] = Shell(context=context)

        if default_command is not None and len(sys.argv) == 1:
            sys.argv.append(default_command)

        try:
            result = self.handle(sys.argv[0], sys.argv[1:])
        except SystemExit as e:
            result = e.code

        sys.exit(result or 0)
309492
def context
      c = Thread.current.thread_variable_get(NAME)

      if c.nil?
        c = if Thread.current.thread_variable_get(STACK_NAME)
          flatten(stack)
        else
          Hash.new
        end
        Thread.current.thread_variable_set(NAME, c)
      end

      return c
    end
490505
function Namespace(path, hex) {
  this.hex = !!hex
  this.keyEncoding = hex ? 'utf8' : 'binary'

  this.path = path
  this.buffer = bytewise.encode(path)
  this.prehooks = []
  this.posthooks = []
}
2681
def get_context_dict(self):
        
        context_dict = {}
        for s in self.sections():
            for k, v in self.manifest.items(s):
                context_dict["%s:%s" % (s, k)] = v
        for k, v in self.inputs.values().items():
            context_dict["config:{0}".format(k)] = v
        context_dict.update(self.additional_context_variables.items())
        context_dict.update(dict([("%s|escaped" % k, re.escape(str(v) or "")) for k, v in context_dict.items()]))
        return context_dict
193790
def context(self, name):
        
        data = self._context(name)
        context = data.get("context")
        if context:
            return context

        assert self.load_path
        context_path = os.path.join(self.load_path, "contexts", "%s.rxt" % name)
        context = ResolvedContext.load(context_path)
        data["context"] = context
        data["loaded"] = True
        return context
1324898
def context(self, identifier=None, meta=None):
        
        return Context(self, identifier=identifier, meta=meta)
829165
function context(value) {
  var out = {}

  value = value || {}

  ;['priority', 'timeout'].forEach(function eachIntKey(key) {
    if (value.hasOwnProperty(key)) {
      out[key] = parseInt(value[key], 10)

      if (isNaN(out[key])) {
        throw new FieldTypeError('context.' + key, 'number')
      }
    }
  })


  if (value.hasOwnProperty('queryId')) {
    out.queryId = value.queryId + ''
  }

  ['bySegment', 'populateCache', 'useCache', 'finalize', 'skipEmptyBuckets'].forEach(function eachBoolKey(key) {
    if (value.hasOwnProperty(key)) {
      out[key] = !!((value[key]||false).valueOf())
    }
  })

  return out
}
252373
def _at_dump_context(self, calculator, rule, scope, block):
        
        sys.stderr.write("%s\n" % repr(rule.namespace._variables))
782430
def prepare_context(env)
      context = Roger::Template::TemplateContext.new(self, env)

      # Extend context with all helpers
      self.class.helpers.each do |mod|
        context.extend(mod)
      end

      context
    end
131803
def for_context(context)
      contexts = hash.keys.select { |ckey| context.matches?([ckey]) }
      contexts.map { |exc| hash[exc] }
    end
1340472
def when(self, key):
        
        ctx = Context(key, self)
        self.context.append(ctx)
        return ctx
1048754
def copy(self):
        
        properties = {}
        for key, value in self.raw_values.items():
            if key in self.UnhashableOptions:
                properties[key] = value
            else:
                properties[key] = copy.copy(value)

        return Context(**properties)
1342343
def _get_context(argspec, kwargs):
    
    if argspec.keywords is not None:
        return kwargs
    return dict((arg, kwargs[arg]) for arg in argspec.args if arg in kwargs)
1222453
def map(self, **kwargs):
        '''  '''
        return { key: str(self._envars[kwargs[key]])  # str strips Entry
                 for key in kwargs }
131110
def possible_namespaces
      namespaces = []
      key = @key.to_s
      while (index = key.rindex('_'))
        key = key[0, index]
        namespaces << key.to_sym
      end
      namespaces
    end
414925
def parse_env(self, env=None, namespace=None):
        """"""
        env = env or os.environ
        results = {}
        if not namespace:
            namespace = self.prog
        namespace = namespace.upper()  # pylint: disable=no-member
        for option in self._options:
            env_var = option.kwargs.get('env')
            default_env = "%s_%s" % (namespace, option.name.upper())
            if env_var and env_var in env:
                value = env[env_var]
                results[option.dest] = option.type(value)
            elif default_env in env:
                value = env[default_env]
                results[option.dest] = option.type(value)

        return results
554588
def dump(context=os.environ):
    

    output = {}
    for key, value in context.iteritems():
        if not key.startswith("BE_"):
            continue
        output[key[3:].lower()] = value

    return output