Total Complexity | 5 |
Total Lines | 11 |
Duplicated Lines | 0 % |
1 | import math |
||
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 | |||
22 |