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.

CLI.postloop()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
1
import cmd
2
import os
3
import argparse
4
from lib.main import SpeedOfPi
5
6
7
class CLI(cmd.Cmd):
8
    def __init__(self):
9
        self.game = SpeedOfPi()
10
        self.update_available = None
11
        cmd.Cmd.__init__(self)
12
        os.system('clear')
13
        self.prompt = "-->>"
14
        self.intro = "SpeedOfPi Command line interface"
15
16
    def do_exit(self, args):
17
        """Exits from the console"""
18
        return -1
19
20
    def do_shell(self, args):
21
        """Pass command to a system shell when line begins with '!'"""
22
        os.system(args)
23
24
    def postloop(self):
25
        """Take care of any unfinished business.
26
           Despite the claims in the Cmd
27
           documentaion, Cmd.postloop() is not a stub.
28
        """
29
        cmd.Cmd.postloop(self)  # Clean up command completion
30
        print("Exiting...")
31
32
    def emptyline(self):
33
        """Do nothing on empty input line"""
34
        pass
35
36
    def default(self, line):
37
        """Called on an input line when the command prefix is not recognized."""
38
        print("Unable to find '{command}' for help on commands type: help".format(command=line))
39
40
    def do_clear(self, args):
41
        """clears the screen"""
42
        os.system('clear')
43
        print(self.intro)
44
45
    def do_play(self, args):
46
        self.game.single_player()
47
48
    def do_update(self, args):
49
        """check for updates"""
50
        if not self.update_available:
51
            print("Checking for updates")
52
            if not self.update_check():
53
                return print("No updates available")
54
55
        if not args:
56
            self.game.update()
57
            print("Updating to latest stable version")
58
        else:
59
            parser = argparse.ArgumentParser()
60
            parser.add_argument(dest="branch")
61
62
            output, unknownArgs = parser.parse_known_args(args.split())
63
            self.game.update(output.branch)
64
            print("Updating to latest beta version")
65
66
    def update_check(self, branch=False):
67
        self.update_available = self.game.update_available(branch)
68
        return self.update_available
69
70
if __name__ == '__main__':
71
    cli = CLI()
72
    cli.cmdloop()
73
74