Create a represenation ideal for comparisons, but not to be
        shown to the user.
552948
def normalize(self, text, cleaned=False, **kwargs):
        """"""
        if not cleaned:
            text = self.clean(text, **kwargs)
        return ensure_list(text)
293600
def setIfMissing(self, key, value):
        """"""
        if self.get(key) is None:
            self.set(key, value)
        return self
169981
def run(self, value, errors, request):
        """"""
        thing = super(AccessibleDBThing, self).run(value, errors, request)
        if errors:
            return None
        if not thing.can_access(request.user):
            message = 'Insufficient permissions for {0}'.format(self.param)
            raise HTTPForbidden(message)
        return thing
1303267
def _set_catalog_view(self, session):
        """"""
        if self._catalog_view == COMPARATIVE:
            try:
                session.use_comparative_catalog_view()
            except AttributeError:
                pass
        else:
            try:
                session.use_plenary_catalog_view()
            except AttributeError:
                pass
902002
def _setPrivate(self, private):
        """"""
        self.private = private
        self.public = pow(self.generator, self.private, self.modulus)
1268418
def hide_object(self, key, hide=True):
        ''''''
        self.object_queue.put(SlipHideObject(key, hide))
820307
def register_or_check(klass, finish, mean, between, refresh_presision, configuration):
		""""""
		m, created = klass.objects.get_or_create(finish=finish, configuration=configuration)
		if created:
			m.mean=mean
			m.between=between
			m.refresh_presision=refresh_presision
			m.save()
		else:
			diff = abs(float(m.mean) - mean)
			if not(diff < 0.006 and m.between == between and m.refresh_presision == refresh_presision):
				raise InvalidMeasurementError("There are diferents values for the same measurement.")
		return m
1036092
def do_allowrep(self, line):
        """"""
        self._split_args(line, 0, 0)
        self._command_processor.get_session().get_replication_policy().set_replication_allowed(
            True
        )
        self._print_info_if_verbose("Set replication policy to allow replication")
100578
function denyReferenceAtRoot(req, res, next) {
  const body = req.body;

  if (_.has(body, '_ref')) {
    sendDefaultResponseForCode(400, 'Reference (_ref) at root of object is not acceptable', res);
  } else {
    next();
  }
}
591209
def difference(self, other):
        

        obj = self._clone()
        obj.difference_update(other)
        return obj
458938
def disallow(ctx, foreign_account, permission, threshold, account):
    
    pprint(
        ctx.peerplays.disallow(
            foreign_account, account=account, permission=permission, threshold=threshold
        )
    )
767380
def _equal(a, b, identityLong, relicCompare):
    
    # Check for an identity comparison.
    if isinstance(b, (long, int)) and b == identityLong:
        return a.isIdentity()

    # Verify type and fix normalization for a valid comparison.
    assertSameType(a, b)
    a.normalize()
    b.normalize()

    # Compare the elements using the relic function.
    return relicCompare(byref(a), byref(b)) == EQUAL
457125
def do_preferrep(self, line):
        """"""
        mns = self._split_args(line, 1, -1)
        self._command_processor.get_session().get_replication_policy().add_preferred(
            mns
        )
        self._print_info_if_verbose(
            "Set {} as preferred replication target(s)".format(", ".join(mns))
        )
1187961
private static CompareOp reverseCompareOp(CompareOp compareOp) {
    switch (compareOp) {
    case EQUAL:
    case NOT_EQUAL:
    case NO_OP:
      return compareOp;
    case LESS:
      return CompareOp.GREATER;
    case LESS_OR_EQUAL:
      return CompareOp.GREATER_OR_EQUAL;
    case GREATER:
      return CompareOp.LESS;
    case GREATER_OR_EQUAL:
      return CompareOp.LESS_OR_EQUAL;
    default:
      return CompareOp.NO_OP;
    }
  }
105635
def registry_comparison(registry0, registry1):
    """"""
    comparison = {'created_keys': {},
                  'deleted_keys': [],
                  'created_values': {},
                  'deleted_values': {},
                  'modified_values': {}}

    for key, info in registry1.items():
        if key in registry0:
            if info[1] != registry0[key][1]:
                created, deleted, modified = compare_values(
                    registry0[key][1], info[1])

                if created:
                    comparison['created_values'][key] = (info[0], created)
                if deleted:
                    comparison['deleted_values'][key] = (info[0], deleted)
                if modified:
                    comparison['modified_values'][key] = (info[0], modified)
        else:
            comparison['created_keys'][key] = info

    for key in registry0.keys():
        if key not in registry1:
            comparison['deleted_keys'].append(key)

    return comparison
674599
def clean(self):
        
        super().clean()

        # At least a poster (user) or a session key must be associated with
        # the vote instance.
        if self.voter is None and self.anonymous_key is None:
            raise ValidationError(_('A user id or an anonymous key must be used.'))
        if self.voter and self.anonymous_key:
            raise ValidationError(_('A user id or an anonymous key must be used, but not both.'))
38676
private void makeAccessible(List<AccessibleObject> nonPublicAccessibleObjects) {

    if (nonPublicAccessibleObjects.size() > 0) {
      final AccessibleObject[] nonPublicAccessibles = new AccessibleObject[nonPublicAccessibleObjects.size()];
      nonPublicAccessibleObjects.toArray(nonPublicAccessibles);
      // enable reflective access that violates visibility - this will
      // fail if disallowed by security-manager.
      AccessController.doPrivileged(new PrivilegedAction<Object>() {

        @Override
        public Object run() {

          AccessibleObject.setAccessible(nonPublicAccessibles, true);
          return null;
        }
      });
    }
  }