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.
Passed
Push — kale/submit-debug-info ( c0cb8c...f2d693 )
by
unknown
08:15
created

PrimeCheckerAction.run()   B

Complexity

Conditions 5

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 8.5454
cc 5
1
import math
2
3
from st2actions.runners.pythonrunner import Action
4
5
6
class PrimeCheckerAction(Action):
7
    def run(self, value=0):
8
        self.logger.debug('value=%s' % (value))
9
        if math.floor(value) != value:
10
            raise ValueError('%s should be an integer.' % value)
11
        if value < 2:
12
            return False
13
        for test in range(2, int(math.floor(math.sqrt(value)))+1):
14
            if value % test == 0:
15
                return False
16
        return True
17
18
if __name__ == '__main__':
19
    checker = PrimeCheckerAction()
20
    for i in range(0, 10):
21
        print '%s : %s' % (i, checker.run(value=1))
22