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.
Completed
Push — master ( 6f4f6d...9a5ffb )
by
unknown
10s
created

print_usage()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
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
if __name__ == "__main__":
41
    daemon = BotkoDaemon('/tmp/botko.pid')  # nosec: predictable, but low risk
42
    if len(sys.argv) == 2:
43
        if sys.argv[1] == 'start':
44
            daemon.start()
45
        elif sys.argv[1] == 'stop':
46
            daemon.stop()
47
        elif sys.argv[1] == 'restart':
48
            daemon.restart()
49
        elif sys.argv[1] == 'nodaemon':
50
            run_bot()
51
        else:
52
            print_usage()
53
            sys.exit(2)
54
        sys.exit(0)
55
    else:
56
        print_usage()
57
        sys.exit(2)
58