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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 11
Duplicated Lines 0 %
Metric Value
wmc 5
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 10 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