Wraps the handler function to allow returning only state diff.
187214
function wrapHandler(handler) {
  return function (state) {
    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }

    return _lodash2.default.assign({}, state, handler.apply(undefined, [state].concat(args)));
  };
}
356925
def (self, method):
        
        def _handler(callback, schema=None):
            """
            _handler
            """
            # reentrant default is False [POST, DELETE, PUT]
            reentrant = False
            if method == "get":
                reentrant = True

            self.handlers.append({
                "method": method,
                "callback": callback,
                "schema": schema,
                "reentrant": reentrant
            })
            return self

        return _handler
374223
def _leave_handler(self, event):
        """"""
        iid = self.current_iid
        if iid is None or self.active == iid:
            return
        self.update_state(iid, "normal")
610911
private IAsyncResultHandler<IEngineResult> wrapResultHandler(final IAsyncResultHandler<IEngineResult> handler) {
        return (IAsyncResult<IEngineResult> result) -> {
            boolean doRecord = true;
            if (result.isError()) {
                recordErrorMetrics(result.getError());
            } else {
                IEngineResult engineResult = result.getResult();
                if (engineResult.isFailure()) {
                    recordFailureMetrics(engineResult.getPolicyFailure());
                } else {
                    recordSuccessMetrics(engineResult.getApiResponse());
                    doRecord = false; // don't record the metric now because we need to record # of bytes downloaded, which hasn't happened yet
                }
            }
            requestMetric.setRequestEnd(new Date());
            if (doRecord) {
                metrics.record(requestMetric);
            }
            handler.handle(result);
        };
    }
802462
function applyStateChanges(state, changes) {
  let result = false;

  // Applying the changes may produce a new round of changes, and that round
  // might produce new changes, and so on. Loop until we complete a pass that
  // produces no changes.
  for (
    let changed;
    changed = fieldsChanged(state, changes), !isEmpty(changed);
  ) {
    // We do have some real changes to report.
    result = true;

    // Apply the changes to the state.
    Object.assign(state, changes);

    // Run the change handlers, gathering up the changes those produce.
    const nextChanges = {};
    if (state[changeHandlersKey]) {
      state[changeHandlersKey].forEach(handler => {
        const { dependencies, callback } = handler;
        // Does this handler trigger on any of the changes we have?
        const run = dependencies.some(dependency => changed[dependency]);
        if (run) {
          // Yes, run the change handler and collect its changes.
          const handlerChanges = callback(state, changed);
          Object.assign(nextChanges, handlerChanges);
        }
      });
    }

    // If the change handlers produced changes, we'll run the loop again.
    changes = nextChanges;
  }

  return result;
}
1189533
def handler(self):
		''
		return ft.partial(self.base.handler, parameter=self.parameter)\
			if self.parameter else self.base.handler
52056
def get_state(self, state):
        """"""
        # Check to see if we have a change request pending; if we do
        # return the value we expect it to change to.
        for data in list(self._send_queue.queue):
            desired_states = data['desired_states']
            for desired_state in desired_states:
                if desired_state['state'] == state:
                    return desired_state['enabled']
        if state == States.FILTER_LOW_SPEED:
            return (States.FILTER.value & self._flashing_states) != 0
        return (state.value & self._states) != 0
19127
function wrapReturn(trace, clientState, hooks, rules){
  if (util.isFunction(trace.ret) && !trace.ret.__concurix_blacklisted) {
    wrapFunctions(trace.moduleName, trace.ret, -1, hooks, clientState, rules );
    trace.ret = wrap(trace.ret)
          .before(hooks.beforeHook)
          .after(hooks.afterHook)
          .state(clientState)
          .nameIfNeeded(trace.moduleName)
          .module(trace.moduleName)
          .getProxy();
  } else {
    wrapFunctions(trace.moduleName, trace.ret, -1, hooks, clientState, rules );
  }
}
364590
def process(self, buff):
        '''
            
        '''
        (self._stack, self._memory, scstateidx, self._state, 
            tmpevents, self._waitingforprop, self._parentismap) = process( buff, self.create_parser_info(), self._deserializers);
        self._scstate = self.scstatelist[scstateidx-1]
        
        self._events = tmpevents
728862
def handler(self):
        """"""
        if self._handler is None:
            self._handler = self.HTTPSClientAuthHandler(key=self._keyfile,
                                                        cert=self._certificatefile)
        return self._handler
827549
def ch_handler(offset=0, length=-1, **kw):
    
    global _lastSel

    offset = int(offset)
    length = int(length)
    if length < 0: length = len(_lastSel)
    return _lastSel[offset:offset+length]
1051275
function runHandler(plugin, handler, cancel) {
  return function runHandlerDelegate(data) {
    if (!data) {
      return Promise.resolve();
    }

    return Promise
      .resolve(handler.handler(data, plugin, cancel))
      .then(function(result) {
        return data.configure(result);
      });
  };
}
1288557
function(handle, type) {
				this._state.queue.push({
					fn: handle,
					type: type
				});
				if (this._initialised && !this._running && !this._executing)
					this._next();
				return this;
			}
1299970
function wrapRequestHandler(func) {
  return function handler(req, res, next) {
    try {
      const result = func(req, res, next)
      if (result && result.catch) result.catch(e => next(e))
    } catch(e) {
      next(e)
    }
  }
}
567567
function diffDataProps(props, oldProps) {
  if (oldProps === null) {
    return 'oldProps is null, initial diff';
  }

  // Support optional app defined comparison of data
  const {dataComparator} = props;
  if (dataComparator) {
    if (!dataComparator(props.data, oldProps.data)) {
      return 'Data comparator detected a change';
    }
    // Otherwise, do a shallow equal on props
  } else if (props.data !== oldProps.data) {
    return 'A new data container was supplied';
  }

  return null;
}
702950
function (source, target, res) {
        if (!module.exports.operations.canDiff || !module.exports.operations.diff) {
            log.warn('Difference operation not implemented by application');
            Utils.sendMessage(res, HttpStatus.NOT_IMPLEMENTED, JSON.stringify({ error: 'operation not implemented' }));
        } else if (Utils.isNullOrEmpty(target)) {
            log.error('Target state not provided');
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else if (!module.exports.operations.canDiff(source, target)) {
            log.error('Unable to get difference from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else {
            const result = module.exports.operations.diff(source, target);
            log.debug('Successfully computed difference', result, 'from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.OK, JSON.stringify(result));
        }
    }
1188846
def check_application_state(self, request, callback):
        ""
        stored = request.session.get(self.session_key, None)
        returned = request.GET.get('state', None)
        check = False
        if stored is not None:
            if returned is not None:
                check = constant_time_compare(stored, returned)
            else:
                logger.error('No state parameter returned by the provider.')
        else:
            logger.error('No state stored in the sesssion.')
        return check