Identity selection
169931
function select($p)
    {
        if ($p['selected'] !== null || !is_object($p['message']->headers)) {
            return $p;
        }

        $rcmail = rcmail::get_instance();

        foreach ((array)$rcmail->config->get('identity_select_headers', array()) as $header) {
            if ($emails = $this->get_email_from_header($p['message'], $header)) {
                foreach ($p['identities'] as $idx => $ident) {
                    if (in_array($ident['email_ascii'], $emails)) {
                        $p['selected'] = $idx;
                        break 2;
                    }
                }
            }
        }

        return $p;
    }
1160214
public static void setIdentity( DMatrixRBlock A )
    {
        int minLength = Math.min(A.numRows,A.numCols);

        CommonOps_DDRM.fill(A, 0);

        int blockLength = A.blockLength;

        for( int i = 0; i < minLength; i += blockLength ) {
            int h = Math.min(blockLength,A.numRows-i);
            int w = Math.min(blockLength,A.numCols-i);

            int index = i*A.numCols + h*i;

            int m = Math.min(h,w);
            for( int k = 0; k < m; k++ ) {
                A.data[index + k*w + k ] = 1;
            }
        }
    }
63795
def get_identity(user):
    
    identity = Identity(user.id)

    if hasattr(user, 'id'):
        identity.provides.add(UserNeed(user.id))

    for role in getattr(user, 'roles', []):
        identity.provides.add(RoleNeed(role.name))

    identity.user = user
    return identity
109458
function findIdentityMatch()
    {
        $identity = $this->wrap->findIdentityMatch();
        if (!$identity)
            return false;
        
        $return   = $this->identity_map->clean();
        $return->import($identity);
        return $identity;
    }
193402
def almost_identity(gate: Gate) -> bool:
    """"""
    N = gate.qubit_nb
    return np.allclose(asarray(gate.asoperator()), np.eye(2**N))
702051
def _create_identity(id_type=None, username=None, password=None, tenant_id=None,
            tenant_name=None, api_key=None, verify_ssl=None,
            return_context=False):
    
    if id_type:
        cls = _import_identity(id_type)
    else:
        cls = settings.get("identity_class")
    if not cls:
        raise exc.IdentityClassNotDefined("No identity class has "
                "been defined for the current environment.")
    if verify_ssl is None:
        verify_ssl = get_setting("verify_ssl")
    context = cls(username=username, password=password, tenant_id=tenant_id,
            tenant_name=tenant_name, api_key=api_key, verify_ssl=verify_ssl)
    if return_context:
        return context
    else:
        global identity
        identity = context
729943
def identify(self, request):
        
        try:
            authorization = request.authorization
        except ValueError:
            return NO_IDENTITY
        if authorization is None:
            return NO_IDENTITY
        authtype, params = authorization
        auth = parse_basic_auth(authtype, params)
        if auth is None:
            return NO_IDENTITY
        return Identity(userid=auth.username, password=auth.password)
379409
def get_identities(self, item):
        """"""

        for rol in self.roles:
            if rol in item['data']:
                user = self.get_sh_identity(item["data"][rol])
                yield user

        if 'activity' in item["data"]:
            for event in item["data"]['activity']:
                event_user = [{"__text__": event['Who']}]
                user = self.get_sh_identity(event_user)
                yield user

        if 'long_desc' in item["data"]:
            for comment in item["data"]['long_desc']:
                user = self.get_sh_identity(comment['who'])
                yield user
384575
def pop_identity(self):
        
        popped = None
        stack = self.get_run_as_identifiers_stack()

        if (stack):
            popped = stack.pop()
            if (stack):
                # persist the changed stack to the session
                session = self.get_session()
                session.set_internal_attribute(self.run_as_identifiers_session_key, stack)

            else:
                # stack is empty, remove it from the session:
                self.clear_run_as_identities()
        return popped
1331966
def get_identities(self, item):
        """"""

        category = item['category']
        item = item['data']

        if category == "issue":
            identity_types = ['user', 'assignee']
        elif category == "pull_request":
            identity_types = ['user', 'merged_by']
        else:
            identity_types = []

        for identity in identity_types:
            if item[identity]:
                # In user_data we have the full user data
                user = self.get_sh_identity(item[identity + "_data"])
                if user:
                    yield user
1003934
def best_identities(self):
        
        if len(self.hsp_list) > 0:
            return round(float(self.hsp_list[0].identities) / float(self.hsp_list[0].align_length) * 100, 1)
720075
public void setIdentities(java.util.Collection<IdentityDescription> identities) {
        if (identities == null) {
            this.identities = null;
            return;
        }

        this.identities = new java.util.ArrayList<IdentityDescription>(identities);
    }
1169495
def get_identities(self, item):
        """"""

        item = item['data']
        if 'owner' in item:
            owner = self.get_sh_identity(item['owner'])
            yield owner
        if 'user' in item:
            user = self.get_sh_identity(item['user'])
            yield user
        if 'mentor' in item:
            mentor = self.get_sh_identity(item['mentor'])
            yield mentor
336563
private static boolean identityEquals(Object[] a, Object[] a2) {
        if (a == a2) {
            return true;
        }
        if (a == null || a2 == null) {
            return false;
        }

        int length = a.length;
        if (a2.length != length) {
            return false;
        }

        for (int i=0; i<length; i++) {
            if (a[i] != a2[i]) {
                return false;
            }
        }

        return true;
    }
393367
function Identity(category, type, name) {
  Element.call(this, 'identity', 'http://jabber.org/protocol/disco#info');
  this.category = category;
  this.type = type;
  this.displayName = name;
}
968271
public void trySetIdentity(Object entity, String id) {
        Class<?> entityType = entity.getClass();
        Field identityProperty = _conventions.getIdentityProperty(entityType);

        if (identityProperty == null) {
            return;
        }

        setPropertyOrField(identityProperty.getType(), entity, identityProperty, id);
    }
356692
def _get_user_identity(user):
        
        if not (
            user and user.get('name') and user.get('password') and user.get("domain") and user.get("domain").get("id")
        ):
            raise IncompleteIdentity()

        identity = {"methods": ['password'], "password": {"user": user}}
        return identity