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.

Uptime   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
dl 0
loc 19
rs 10
c 3
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _uptime() 0 14 3
A handle_message() 0 2 1
1
from base import BotPlugin
2
from time import time
3
from datetime import timedelta
4
5
6
class Uptime(BotPlugin):
7
8
    def _uptime(self, tokens, channel):
9
        try:
10
            with open("/proc/uptime", 'r') as f:
11
                server_uptime_seconds = int(float(f.readline().split()[0]))
12
                server_uptime = str(timedelta(seconds=server_uptime_seconds))
13
        except Exception:
14
            self.bot.log_error('Could not get server uptime.')
15
            server_uptime = "unknown"
16
17
        bot_uptime_seconds = int(time() - self.bot.start_time)
18
        bot_uptime = str(timedelta(seconds=bot_uptime_seconds))
19
        self.bot.say("My uptime: %s, server uptime: %s"
20
                     % (bot_uptime, server_uptime),
21
                     channel)
22
23
    def handle_message(self, channel, nick, msg, line=None):
24
        self.handle_tokens(channel, msg, ('uptime',), self._uptime)
25