Returns the username of the current user.

        :rtype: str
482373
def current_user(self):
        
        if not hasattr(self, '_serverInfo') or 'username' not in self._serverInfo:

            url = self._get_url('serverInfo')
            r = self._session.get(url, headers=self._options['headers'])

            r_json = json_loads(r)
            if 'x-ausername' in r.headers:
                r_json['username'] = r.headers['x-ausername']
            else:
                r_json['username'] = None
            self._serverInfo = r_json
            # del r_json['self']  # this isn't really an addressable resource
        return self._serverInfo['username']
1224077
def usernameFromRequest(request):
    
    username = request.args.get('username', [''])[0]
    if '@' not in username:
        username = '%s@%s' % (
            username, request.getHeader('host').split(':')[0])
    return username
1019846
def get_user(self, username):
        
        try:
            return self.users[username]
        except Exception as e:
            raise UserDoesntExist(username, self.backend_name)
719149
def get_user_id(username):
    
    uid = single_line_stdout('id -u {0}'.format(username), expected_errors=(1,), shell=False)
    return check_int(uid)
380942
def get_current_user():
    
    if pwd is None:
        return getpass.getuser()
    else:
        try:
            return pwd.getpwuid(os.getuid())[0]
        except KeyError as error:
            LOGGER.error('Could not get logged-in user: %s', error)
1149976
def GetUsername(self, event, default_username='-'):
    
    username = getattr(event, 'username', None)
    if username and username != '-':
      return username

    session_identifier = event.GetSessionIdentifier()
    if session_identifier is None:
      return default_username

    user_sid = getattr(event, 'user_sid', None)
    username = self._knowledge_base.GetUsernameByIdentifier(
        user_sid, session_identifier=session_identifier)
    return username or default_username
670172
def _get_name(self):
        
        if self._name is None:
            self._name = self._generate_name()
        return self._name
92727
public function getUserName()
    {
        return $this->user ? Module::getInstance()->getUserName($this->user, 'id') : $this->user_id;
    }
1306890
public function getUsername() {
		if (isset($_SESSION) && isset($_SESSION[self::SESSION_FIELD_USERNAME])) {
			return $_SESSION[self::SESSION_FIELD_USERNAME];
		}
		else {
			return null;
		}
	}
128193
def who_am_i():
    
    me = url['me'].format(token)
    r = requests.get(me, params={'client_id': CLIENT_ID})
    r.raise_for_status()
    current_user = r.json()
    logger.debug(me)

    logger.info('Hello {0}!'.format(current_user['username']))
    return current_user
973509
def currentuser(self):
        
        request = requests.get(
            '{0}/api/v3/user'.format(self.host),
            headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        return request.json()
940338
def hasUser(self):
        
        username = self.getUsername()
        if not username:
            return False
        user = api.get_user(username)
        return user is not None
1368929
def user_name(self, user_id):
        """"""
        user = self.users.get(user_id)

        if user is None:
            return "Unknown user ({})".format(user_id)

        return user["name"]
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
276380
def get_current_user():
    """"""
    thread_local = AutomatedLoggingMiddleware.thread_local
    if hasattr(thread_local, 'current_user'):
        user = thread_local.current_user
        if isinstance(user, AnonymousUser):
            user = None
    else:
        user = None

    return user
224459
def user(self, username=None):
        
        if username is None:
            username = self.__getUsername()

        url = "%s/%s" % (self.root, username)
        return User(url=url,
                    securityHandler=self._securityHandler,
                    proxy_url=self._proxy_url,
                    proxy_port=self._proxy_port,
                    initalize=True)
711882
def clean_username(self):
        
        username = self.cleaned_data.get('username').split('@')[0]
        if not username:
            raise forms.ValidationError(_('Invalid username provided'))
        return username