Return username of user
547384
def get_username(sciper):
    
    attribute = 'uid'
    response = LDAP_search(
        pattern_search='(uniqueIdentifier={})'.format(sciper),
        attribute=attribute
    )
    try:
        username = get_attribute(response, attribute)
    except Exception:
        raise EpflLdapException("No username corresponds to sciper {}".format(sciper))
    return username
1117639
def _get_user(self, username, attrs=ALL_ATTRS):
        """"""

        username = ldap.filter.escape_filter_chars(username)
        user_filter = self.user_filter_tmpl % {
            'username': self._uni(username)
        }
        r = self._search(self._byte_p2(user_filter), attrs, self.userdn)

        if len(r) == 0:
            return None

        # if NO_ATTR, only return the DN
        if attrs == NO_ATTR:
            dn_entry = r[0][0]
        # in other cases, return everything (dn + attributes)
        else:
            dn_entry = r[0]
        return dn_entry
732232
def _key(self, username, frozen=False):
        """"""
        if frozen:
            return self.frozen + username
        return self.prefix + username
1085539
def name(self):
        
        if hasattr(self.user, "get_full_name"):
            return self.user.get_full_name()
        return "{0}".format(self.user)
698835
def username_or(user, attr):
    
    if not settings.ACCOUNTS_NO_USERNAME:
        attr = "username"
    value = getattr(user, attr)
    if callable(value):
        value = value()
    return value
244018
def User(self, Username=''):
        
        if not Username:
            Username = self.CurrentUserHandle
        o = User(self, Username)
        o.OnlineStatus # Test if such a user exists.
        return o
1083511
def username(self):
        
        username = self.config.get("username")
        if not username:
            username = self.userinfo__preferred_username
        return username
1019846
def get_user(self, username):
        
        try:
            return self.users[username]
        except Exception as e:
            raise UserDoesntExist(username, self.backend_name)
721623
def get_by_username(cls, username):
        
        return cls.query().filter(cls.username == username).first()
568832
def find_user_by_name(username):
    
    if db is not None:
        uid = db.hget('users', username)
        if uid:
            return get_user(uid)
    else:
        for uid, u in app.config['COIL_USERS'].items():
            if u['username'] == username:
                return get_user(uid)
954328
def getUserSid(username):
    '''
    
    '''
    if six.PY2:
        username = _to_unicode(username)

    domain = win32api.GetComputerName()
    if username.find('\\') != -1:
        domain = username.split('\\')[0]
        username = username.split('\\')[-1]
    domain = domain.upper()
    return win32security.ConvertSidToStringSid(
        win32security.LookupAccountName(None, domain + '\\' + username)[0])
1154780
def username(elk, user_number):
    """"""
    if user_number >= 0 and user_number < elk.users.max_elements:
        return elk.users[user_number].name
    if user_number == 201:
        return "*Program*"
    if user_number == 202:
        return "*Elk RP*"
    if user_number == 203:
        return "*Quick arm*"
    return ""
388956
def get_username(uid,**kwargs):
    
    rs = db.DBSession.query(User.username).filter(User.id==uid).one()

    if rs is None:
        raise ResourceNotFoundError("User with ID %s not found"%uid)

    return rs.username
353801
def get_user(self, name):
        """"""
        users = self.data['users']
        for user in users:
            if user['name'] == name:
                return user
        raise KubeConfError("user name not found.")
795573
def display_user(value, arg):
    ''' 
    '''
    if value.user == arg and arg.username != ANONYMOUS_USERNAME:
        return "You"
    else:
        return value.user.get_full_name()
864728
def get_users(username):
    
    reply = {}

    log.debug('Begin /v[x]/users/' + username)

    if username is None:
        reply['error'] = "No username given"
        return jsonify(reply), 404

    if ',' in username:
        reply['error'] = 'Multiple username queries are no longer supported.'
        return jsonify(reply), 401


    if "." not in username:
        fqa = "{}.{}".format(username, 'id')
    else:
        fqa = username

    profile = get_profile(fqa)

    reply[username] = profile
    if 'error' in profile:
        status_code = 200
        if 'status_code' in profile:
            status_code = profile['status_code']
            del profile['status_code']
        return jsonify(reply), status_code
    else:
        return jsonify(reply), 200
828560
def full_name(first_name, last_name, username, **extra):
    """"""
    name = " ".join(n for n in [first_name, last_name] if n)
    if not name:
        return username
    return name