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 — pip_8.1.2 ( 36f804 )
by
unknown
06:44
created

PascalRowAction._compute_pascal_row()   C

Complexity

Conditions 9

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 9
c 4
b 0
f 0
dl 0
loc 20
rs 6.4615
1
import math
2
3
4
from st2actions.runners.pythonrunner import Action
5
6
7
class PascalRowAction(Action):
8
    def run(self, **kwargs):
9
        return PascalRowAction._compute_pascal_row(**kwargs)
10
11
    @staticmethod
12
    def _compute_pascal_row(row_index=0):
13
        if row_index == 'a':
14
            return False, 'This is suppose to fail don\'t worry!!'
15
        elif row_index == 'b':
16
            return None
17
        elif row_index == 'c':
18
            return False, None
19
        elif row_index == 'd':
20
            return 'succeeded', [1, 2, 3, 4]
21
        elif row_index == 'e':
22
            return [1, 2]
23
        elif row_index == 5:
24
            return [math.factorial(row_index) /
25
                    (math.factorial(i) * math.factorial(row_index - i))
26
                    for i in range(row_index + 1)]
27
        else:
28
            return True, [math.factorial(row_index) /
29
                          (math.factorial(i) * math.factorial(row_index - i))
30
                          for i in range(row_index + 1)]
31