Returns full name (first and last) if name is available.
        If not, returns username if available.
        If not available too, returns the user id as a string.
338255
def default_format(self):
        
        user = self.user
        if user.first_name is not None:
            return self.full_name
        elif user.username is not None:
            return user.username
        else:
            return str(user.id)
365534
def get_user_name(self, uid, return_none_on_error=True):
        
        response = self.raw_command(netfn=0x06, command=0x46, data=(uid,))
        if 'error' in response:
            if return_none_on_error:
                return None
            raise Exception(response['error'])
        name = None
        if 'data' in response:
            data = response['data']
            if len(data) == 16:
                # convert int array to string
                n = ''.join(chr(data[i]) for i in range(0, len(data)))
                # remove padded \x00 chars
                n = n.rstrip("\x00")
                if len(n) > 0:
                    name = n
        return name
677340
private String[] firstAndLastName(String name) {
		if (name == null) {
			return EMPTY_FIRST_AND_LAST_NAME_ARRAY;
		}
		String[] nameParts = name.split("\\s+");
		if (nameParts.length == 1) {
			return new String[] { nameParts[0], null };
		} else {
			return new String[] { nameParts[0], nameParts[nameParts.length - 1] };
		}
	}
1070232
def get_username(self, userid):
        '''
        '''

        username = self.user_map.get(userid)
        if not username:
            users = self.get_users()
            if users:
                members = {
                    m['id']: m['name']
                    for m in users.get('members', [{}])
                    if m.get('id')
                    and m.get('name')
                }
                if members:
                    self.user_map.update(members)

                username = self.user_map.get(userid, userid)

        return username
264164
def get_user_details(self, response):
        """"""
        email = response['email']
        username = response.get('nickname', email).split('@', 1)[0]
        return {'username': username,
                'email': email,
                'fullname': '',
                'first_name': '',
                'last_name': ''}
290172
def _get_id_from_username(self, username):
        
        _mask = "mask[id, username]"
        _filter = {'users': {'username': utils.query_filter(username)}}
        user = self.list_users(_mask, _filter)
        if len(user) == 1:
            return [user[0]['id']]
        elif len(user) > 1:
            raise exceptions.SoftLayerError("Multiple users found with the name: %s" % username)
        else:
            raise exceptions.SoftLayerError("Unable to find user id for %s" % username)
1085539
def name(self):
        
        if hasattr(self.user, "get_full_name"):
            return self.user.get_full_name()
        return "{0}".format(self.user)
930158
async def get_friendly_name(self) -> Text:
        

        if 'first_name' not in self._user:
            user = await self._get_full_user()
        else:
            user = self._user

        return user.get('first_name')
686782
def get_username(self):
        
        username = self.get_as_nullable_string("username")
        username = username if username != None else self.get_as_nullable_string("user")
        return username
591743
def user_info(self, username):
        
        request_url = "{}/api/0/user/{}".format(self.instance, username)

        return_value = self._call_api(request_url)

        return return_value
664930
def get_user(self, username):
        
        for user in self.users:
            if user.id.name == username:
                return user
        return None
137711
@Basic
    @Column(name = "LASTNAME", unique = true, nullable = false, length=255)
	public String getLastName() 
	{
		return lastName;
	}
1337889
def _getUsername(self):
        
        for (l, d) in getAccountNames(self.store):
            return l + u'@' + d
1345991
public static String shortName(User user) {
    if (!isEmpty(user.getFirstName()))
      return user.getFirstName();

    if (!isEmpty(user.getLastName()))
      return user.getLastName();

    return user.getUserName();
  }
858415
public function getFullName()
    {
        if (! $this->_getVar('user_name')) {
            $name = ltrim($this->_getVar('user_first_name') . ' ') .
                    ltrim($this->_getVar('user_surname_prefix') . ' ') .
                    $this->_getVar('user_last_name');

            if (! $name) {
                // Use obfuscated login name
                $name = $this->getLoginName();
                $name = substr($name, 0, 3) . str_repeat('*', max(5, strlen($name) - 2));
            }

            $this->_setVar('user_name', $name);

            // \MUtil_Echo::track($name);
        }

        return $this->_getVar('user_name');
    }
457821
public String getUserName()
    {
        String strUserName = null;
        Record recUserInfo = (Record)this.getUserInfo();
        if (recUserInfo != null)
            strUserName = recUserInfo.getField(UserInfoModel.USER_NAME).toString();
        if ((strUserName == null) || (strUserName.length() == 0))
            strUserName = super.getUserName();
        return strUserName;
    }
874036
public function get_full_name()
    {
        $full_name = $this->first_name .
            ($this->last_name->isEmpty() ? '' : ' ' . $this->last_name);

        return $full_name;
    }