Completed
Push — master ( 32acac...19ae40 )
by Lakshmi
11:34
created

ParseCSVAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 2
1
import csv
2
from StringIO import StringIO
3
4
from st2actions.runners.pythonrunner import Action
5
6
__all__ = [
7
    'ParseCSVAction'
8
]
9
10
11
class ParseCSVAction(Action):
12
    def run(self, data, delimiter=',', quote_char='"'):
13
        fh = StringIO(data)
14
15
        reader = csv.reader(fh, delimiter=str(delimiter), quotechar=str(quote_char))
16
17
        result = []
18
        for row in reader:
19
            result.append(row)
20
        return result
21