Completed
Push — master ( d1f0a7...3b2ece )
by Edward
21:04 queued 05:38
created

st2tests.resources.packs.pythonactions.actions.FakeConcurrencyApplicator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %
Metric Value
wmc 5
dl 0
loc 21
rs 10
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
        return [math.factorial(row_index) / (math.factorial(i) * math.factorial(row_index - i))
14
                for i in range(row_index + 1)]
15