A with-context that encapsulates pushd/popd.
423963
def pushd(directory):
  
  cwd = os.getcwd()
  os.chdir(directory)
  try:
    yield directory
  finally:
    os.chdir(cwd)
81043
def op_funcdef_handle(tokens):
    """"""
    func, base_args = get_infix_items(tokens)
    args = []
    for arg in base_args[:-1]:
        rstrip_arg = arg.rstrip()
        if not rstrip_arg.endswith(unwrapper):
            if not rstrip_arg.endswith(","):
                arg += ", "
            elif arg.endswith(","):
                arg += " "
        args.append(arg)
    last_arg = base_args[-1]
    if last_arg.rstrip().endswith(","):
        last_arg = last_arg.rsplit(",")[0]
    args.append(last_arg)
    return func + "(" + "".join(args) + ")"
376334
def push_dcp(event, callback, position='right'):
    
    ctx = stack.top
    ctx.app.extensions.get('pluginkit').push_dcp(event, callback, position)
1232852
def push(self, len, buf):
        
        ret = libxml2mod.xmlParserInputBufferPush(self._o, len, buf)
        return ret
678022
def bump_context(self, name):
        """"""
        data = self._context(name)
        data["priority"] = self._next_priority
        self._flush_tools()
132007
def wraps_with_context(func, context):
    """"""
    wrapped = functools.partial(func, context)
    wrapped = functools.wraps(func)(wrapped)
    if asyncio.iscoroutinefunction(func):
        wrapped = asyncio.coroutine(wrapped)
    return wrapped
1089357
def make_withitem(queue, stack):
    
    context_expr = make_expr(stack)
    # This is a POP_TOP for just "with <expr>:".
    # This is a STORE_NAME(name) for "with <expr> as <name>:".
    as_instr = queue.popleft()
    if isinstance(as_instr, (instrs.STORE_FAST,
                             instrs.STORE_NAME,
                             instrs.STORE_DEREF,
                             instrs.STORE_GLOBAL)):
        return ast.withitem(
            context_expr=context_expr,
            optional_vars=make_assign_target(as_instr, queue, stack),
        )
    elif isinstance(as_instr, instrs.POP_TOP):
        return ast.withitem(context_expr=context_expr, optional_vars=None)
    else:
        raise DecompilationError(
            "Don't know how to make withitem from %s" % as_instr,
        )
1151096
def push(self, obj):
        """"""
        rv = getattr(self._local, "stack", None)
        if rv is None:
            self._local.stack = rv = []
        rv.append(obj)
        return rv
1197657
@SuppressWarnings("deprecation")
  public void pushContextData() {
    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
      logger.entering(CLASS_NAME,"pushContextData",this);
    }

    // will want to run on the calling thread's class loader
    this.newCL = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
        @Override
        public ClassLoader run() {
            ClassLoader old = Thread.currentThread().getContextClassLoader();
            return old;
        }
    });

    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
        logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "thread context class loader [" + this.newCL +"]");
      }
    
    this.contextData = new HashMap();
    
    // push data for other components that we already have hooks into
    ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
    ComponentMetaData cmd = cmdai.getComponentMetaData();
    if (cmd != null) {
      this.contextData.put(ComponentMetaData, cmd);
    }  
    
    // each producer service of the Transfer service is accessed in order to get the thread context data
    Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
    if (TransferIterator != null) { 
      while(TransferIterator.hasNext()){
        ITransferContextService tcs = TransferIterator.next();
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
          logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "calling storeState on: " + tcs);
        }
        tcs.storeState(this.contextData);
        asyncContext.storeStateCtxData = this.contextData;
      }
    } else {
      if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
        logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "no implmenting services found");
      }
    }
    
    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
      logger.exiting(CLASS_NAME,"pushContextData",this);
    }
  }
175249
def context(self, size, placeholder=None, scope=None):
        """"""
        return self.leftcontext(size, placeholder,scope) + [self] + self.rightcontext(size, placeholder,scope)
498416
function func$withContext(fn, item, i, ctx) { // eslint-disable-line max-params
	return fn.call(ctx, item, i)
}
942110
def rpoplpush(self, sourcekey, destkey, *, encoding=_NOTSET):
        
        return self.execute(b'RPOPLPUSH', sourcekey, destkey,
                            encoding=encoding)
926826
def call_with_context(func, context, *args):
    
    return make_context_aware(func, len(args))(*args + (context,))
1228111
function liftContext(ctx, func) {
  if (!ctx.pure) {
    throw new Error("no monad's definition is provided");
  }
  return function() {
    var saved;
    saved = context;
    context = ctx;
    try {
      return func.apply(null, arguments);
    } finally {
      context = saved;
    }
  };
}
681758
def _astoref(ins):
    ''' 
    '''
    output = _addr(ins.quad[1])

    value = ins.quad[2]
    if value[0] == '*':
        value = value[1:]
        indirect = True
    else:
        indirect = False

    if indirect:
        output.append('push hl')
        output.extend(_float_oper(ins.quad[2]))
        output.append('pop hl')
    else:
        output.extend(_float_oper(ins.quad[2]))

    output.append('call __STOREF')
    REQUIRES.add('storef.asm')

    return output
897763
def activate(ctx):
        """"""
        if hasattr(ctx, '_on_context_exit'):
            raise ContextError(
                'Context actions registered outside this '
                'parse context are active')

        try:
            ParseContext._active.append(ctx)
            ctx._on_context_exit = []
            yield
        finally:
            for func, args, kwargs in ctx._on_context_exit:
                func(*args, **kwargs)
            del ctx._on_context_exit
            ParseContext._active.pop()
93995
def with_current_context(self, func):
        """"""

        caller_context = self.snapshot()

        def call_with_current_context(*args, **kwargs):
            try:
                backup_context = self.snapshot()
                self.apply(caller_context)
                return func(*args, **kwargs)
            finally:
                self.apply(backup_context)

        return call_with_current_context