Handle the diff action for a single thing. It may be a Vault backend
    implementation or it may be a Vault data resource
969505
def diff_a_thing(thing, opt):
    """"""
    changed = thing.diff()
    if changed == ADD:
        print("%s %s" % (maybe_colored("+", "green", opt), str(thing)))
    elif changed == DEL:
        print("%s %s" % (maybe_colored("-", "red", opt), str(thing)))
    elif changed == CHANGED:
        print("%s %s" % (maybe_colored("~", "yellow", opt), str(thing)))
    elif changed == OVERWRITE:
        print("%s %s" % (maybe_colored("+", "yellow", opt), str(thing)))
    elif changed == CONFLICT:
        print("%s %s" % (maybe_colored("!", "red", opt), str(thing)))

    if changed != OVERWRITE and changed != NOOP:
        maybe_details(thing, opt)
1162764
def git_hook(error=True):
    """"""
    _, files_modified, _ = run("git diff-index --cached --name-only HEAD")

    options = parse_options()
    setup_logger(options)
    if sys.version_info >= (3,):
        candidates = [f.decode('utf-8') for f in files_modified]
    else:
        candidates = [str(f) for f in files_modified]

    if candidates:
        process_paths(options, candidates=candidates, error=error)
384702
def handle_update(self, args):
    """"""
    _LOGGER.debug("handle_update %d -- %s" % (self._integration_id, args))
    state = int(args[0])
    if state != Output._ACTION_ZONE_LEVEL:
      return False
    level = float(args[1])
    _LOGGER.debug("Updating %d(%s): s=%d l=%f" % (
        self._integration_id, self._name, state, level))
    self._level = level
    self._query_waiters.notify()
    self._dispatch_event(Output.Event.LEVEL_CHANGED, {'level': self._level})
    return True
1122229
def _doAction(self, action):
		""""""

		if self._db == '':
			raise FMError, 'No database was selected'

		result = ''

		try:
			request = [
				uu({'-db': self._db })
			]

			if self._layout != '':
				request.append(uu({'-lay': self._layout }))

			if action == '-find' and self._lop != 'and':
				request.append(uu({'-lop': self._lop }))

			if action in ['-find', '-findall']:

				if self._skipRecords != 0:
					request.append(uu({ '-skip': self._skipRecords }))

				if self._maxRecords != 0:
					request.append(uu({ '-max': self._maxRecords }))

				for i in range(0, len(self._sortParams)):
					sort = self._sortParams[i]
					request.append(uu({ '-sortfield.'+str(i+1): sort[0] }))

					if sort[1] != '':
						request.append(uu({ '-sortorder.'+str(i+1): sort[1] }))

			for dbParam in self._dbParams:

				if dbParam[0] == 'RECORDID':
					request.append(uu({ '-recid': dbParam[1] }))

				elif dbParam[0] == 'MODID':
					request.append(uu({ '-modid': dbParam[1] }))

				elif hasattr(dbParam[1], 'strftime'):
					d = dbParam[1]
					if (not hasattr(d, 'second')):
						request.append(uu({ dbParam[0]: d.strftime('%m-%d-%Y') }))
					else:
						request.append(uu({ dbParam[0]: d.strftime('%m-%d-%Y %H:%M:%S') }))
					del(d)
				else:
					request.append(uu({ dbParam[0]: dbParam[1] }))
			request.append(action)

			if self._extra_script:
				request += self._extra_script
				self._extra_script = None

			result = self._doRequest(request)

			try:
				result = FMResultset.FMResultset(result)
			except FMFieldError, value:
				realfields = FMServer(self._buildUrl(), self._db, self._layout).doView()

				l = []
				for k, v in self._dbParams:
					if k[-3:] != '.op' and k[0] != '-':
						l.append(("'%s'" % k.replace('::','.')).encode('utf-8'))
				raise FMError, "Field(s) %s not found on layout '%s'" % (', '.join(l), self._layout)

			if action == '-view':
				result = result.fieldNames

		finally:
			self._dbParams = []
			self._sortParams = []
			self._skipRecords = 0
			self._maxRecords = 0
			self._lop = 'and'

		return result
940543
def diff(**kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    id_ = kwargs.pop('id', 0)
    if kwargs:
        salt.utils.args.invalid_kwargs(kwargs)

    conn = __proxy__['junos.conn']()
    ret = {}
    ret['out'] = True
    try:
        ret['message'] = conn.cu.diff(rb_id=id_)
    except Exception as exception:
        ret['message'] = 'Could not get diff with error "{0}"'.format(
            exception)
        ret['out'] = False

    return ret
855296
def diff(other_snapshot)
      endpoint = "/snapshots/#{self.Name}/diff/#{other_snapshot.Name}"
      response = @connection.send(:get, endpoint)
      JSON.parse(response.body)
    end
255776
def process_action(ctx, param, value):
    """"""
    actions = current_app.extensions['invenio-access'].actions
    if value not in actions:
        raise click.BadParameter('Action "%s" is not registered.', value)
    return actions[value]
460746
function execute(req, res) {
  // TODO: ensure a conflict is triggered on all watched keys
  this.store.flushall();
  res.send(null, Constants.OK);
}
1162094
def _simple_action(self, action=None):
        '''
        '''
        if not action:
            raise Exception('No simple action defined')
        path = "/".join([self.RESOURCE, action])
        response = self.client.request(
            path, {self.RESOURCE_ID_ATTRIBUTE: self.object_id}
        )
        return response
1270529
function handleUpdateFile(response) {

        var path = response.path,
            type = response.type,
            $deferredHints = getPendingRequest(path, OFFSET_ZERO, type);

        if ($deferredHints) {
            $deferredHints.resolve();
        }
    }
1275077
function doAction() {
            var now = (new Date()).getTime();
            var diff = now - lastTapTime;
            var isDiffElemSafeDelay = elem !== lastElemTapped && diff > 200;
            var isSameElemSafeDelay = elem === lastElemTapped && diff > sameElemSafeDelay;

            if (tapped && (isDiffElemSafeDelay || isSameElemSafeDelay)) {
                lastElemTapped = elem;
                lastTapTime = now;
                safeApply(action, scope);
            }

            // reset tapped at end
            tapped = false;
        }
126636
def handle_update(self, args):
    """"""
    component = int(args[0])
    action = int(args[1])
    params = [int(x) for x in args[2:]]
    _LOGGER.debug("Updating %d(%s): c=%d a=%d params=%s" % (
        self._integration_id, self._name, component, action, params))
    if component in self._components:
      return self._components[component].handle_update(action, params)
    return False
690866
function handleUpdatedConfigItems(_a) {
    var fileInitialState = _a.fileInitialState, memoryInitialState = _a.memoryInitialState;
    var updatedItems = fileInitialState.filter(function (fileItem) {
        var foundBsItem = memoryInitialState.find(function (bsItem) { return fileItem.key === bsItem.key; });
        if (!foundBsItem) {
            return false;
        }
        else {
            return fileItem.value !== foundBsItem.value;
        }
    });
    if (updatedItems.length > 0) {
        console.log('UPDATED CONFIG: ', updatedItems);
    }
    updatedItems.forEach(function (updatedItem) {
        saveItemToBrowserStorage(updatedItem);
    });
}
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;
}
454108
def handler(event, context):
    
    for record in event['Records']:
        process_dynamodb_differ_record(record, Durable{{cookiecutter.technology_slug | titlecase}}Model)
154995
function handleChange(bundleName) {
	const bundle = module.exports.find(bundleName);

	/* istanbul ignore if: It's rare for `bundle` to be undefined here, but it can happen when using black/whitelisting. */
	if (!bundle) {
		return;
	}

	if (backoffTimer) {
		log.debug('Backoff active, delaying processing of change detected in', bundleName);
		hasChanged[bundleName] = true;
		resetBackoffTimer();
	} else {
		log.debug('Processing change event for', bundleName);
		resetBackoffTimer();

		let reparsedBundle;
		const bundleCfgPath = path.join(root, '/cfg/', bundleName + '.json');
		if (fs.existsSync(bundleCfgPath)) {
			reparsedBundle = parseBundle(bundle.dir, bundleCfgPath);
		} else {
			reparsedBundle = parseBundle(bundle.dir);
		}

		module.exports.add(reparsedBundle);
		emitter.emit('bundleChanged', reparsedBundle);
	}
}
406172
def checkdiff(a,b,sp=True):
  ''
  if sp: a=splitpreserve(a); b=splitpreserve(b)
  res=applydiff(a,rediff(a,b))
  if sp: res=''.join(res)
  return res