Return a Future for a nickname from an account.
357343
def get_nickname(userid):
  """"""
  account = yield get_account(userid)
  if not account:
    nickname = 'Unregistered'
  else:
    nickname = account.nickname or account.email
  raise ndb.Return(nickname)
377795
def by_alias(cls, name: str) -> "TxType":
        """"""
        return {
            "get": TxType.Get,
            "check": TxType.Check,
            "delete": TxType.Delete,
            "save": TxType.Update,
        }[name]
185425
def get_name(self, properly_capitalized=False):
        """"""

        if properly_capitalized:
            self.name = _extract(
                self._request(self.ws_prefix + ".getInfo", True), "name"
            )

        return self.name
563237
def remove(self, name):
        """"""
        fut = self.execute(b'REMOVE', name)
        return wait_ok(fut)
840333
def badnick(self, me=None, nick=None, **kw):
        """"""
        if me == '*':
            self.bot.set_nick(self.bot.nick + '_')
        self.bot.log.debug('Trying to regain nickname in 30s...')
        self.nick_handle = self.bot.loop.call_later(
            30, self.bot.set_nick, self.bot.original_nick)
702875
def get(self, name: str, default: Any = None) -> Any:
        """"""
        return super().get(name, [default])[0]
819244
def account(self, id):
        """"""
        if self.parser.has_section(id):
            return self._section_to_account(id)
        return None
1206443
def fromProfileName(cls, name):
        
        session = bones.SessionAPI.fromProfileName(name)
        return cls(session)
357275
def get_account(netid, timestamp=None):
    
    response = _get_account(netid, timestamp=timestamp)
    return _account_from_json(response)
489628
def get_username(self):
        """"""
        _from = self.auth_context['from']
        if self.token_version == 1:
            return '{0}'.format(_from)
        elif self.token_version == 2:
            _user_type = self.auth_context['user_type']
            return '{0}/{1}/{2}'.format(
                self.token_version,
                _user_type,
                _from
            )
1306088
def last_first(self):
        
        return "{}, {} ".format(self.last_name, self.first_name) + ("({})".format(self.nickname) if self.nickname else "")
733284
def me(self):
        

        if self._me is not None:
            return self._me

        self._me = self.Person("{username}@{server}".format(
            username=self.client.nickname,
            server=self.client.server,
        ))
        return self._me
580180
def account(self):
        
        data = self.query(Account.key)
        return Account(self, data)
394522
def delFuture(afuture):
    """"""
    try:
        del futureDict[afuture.id]
    except KeyError:
        pass
    try:
        del futureDict[afuture.parentId].children[afuture]
    except KeyError:
        pass
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
908432
def seen(self, event, nickname):
        
        try:
            self.joined[nickname]
        except KeyError:
            pass
        else:
            if nickname == self.get_nickname(event):
                prefix = "you are"
            else:
                prefix = "%s is" % nickname
            return "%s here right now" % prefix
        try:
            seen = self.timesince(self.quit[nickname])
        except KeyError:
            return "%s has never been seen" % nickname
        else:
            return "%s was last seen %s ago" % (nickname,  seen)
231704
def rev_after(self, rev: int) -> int:
        """"""
        self.seek(rev)
        if self._future:
            return self._future[-1][0]