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.

BotkoDaemon   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 4
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 2 1
1
#!/usr/bin/env python
2
3
import sys
4
from daemon import Daemon
5
6
7
def run_bot():
8
    from handler import Bot
9
10
    while True:
11
        try:
12
            # initialize and run
13
            botko = Bot()
14
            botko.run()
15
16
        except Exception:
17
            # log the error
18
            from traceback import format_exc
19
            from datetime import datetime
20
            from time import sleep
21
22
            print("ERR " + str(format_exc()))
23
24
            f = open('error_log', 'a')
25
            f.write(str(datetime.now()) + "\n")
26
            f.write(str(format_exc() + "\n\n"))
27
            f.close()
28
            sleep(10)
29
30
31
def print_usage():
32
    print("usage: %s start|stop|restart|nodaemon" % sys.argv[0])
33
34
35
class BotkoDaemon(Daemon):
36
37
    def run(self):
38
        run_bot()
39
40
41
if __name__ == "__main__":
42
    daemon = BotkoDaemon('/tmp/botko.pid')  # nosec: predictable, but low risk
43
    if len(sys.argv) == 2:
44
        if sys.argv[1] == 'start':
45
            daemon.start()
46
        elif sys.argv[1] == 'stop':
47
            daemon.stop()
48
        elif sys.argv[1] == 'restart':
49
            daemon.restart()
50
        elif sys.argv[1] == 'nodaemon':
51
            run_bot()
52
        else:
53
            print_usage()
54
            sys.exit(2)
55
        sys.exit(0)
56
    else:
57
        print_usage()
58
        sys.exit(2)
59