GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LastCommand.default()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 3
dl 0
loc 10
rs 9.4286
1
import re
2
3
from . import BotCommand
4
5
6
class LastCommand(BotCommand):
7
    command = '/last'
8
9
    def default(self, message):
10
        match = re.match('(/last)( (?P<howmany>\d+))?', message.text)
11
        howmany = int(match.groupdict(5)['howmany'])
12
        tab = self._db.get_or_create_tab(message.chat.id)[0]
13
        last_entries = u'\n'.join([
14
            u'*{:7.2f}* {} for {}'.format(entry.amount, entry.date.humanize(), entry.reason)
15
            for entry in tab.entries[:howmany]])
16
        if not last_entries:
17
            last_entries = 'No entries!'
18
        self.bot.say(message, last_entries, markdown=True)
19