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

ParseCSVAction.run()   A

Complexity

Conditions 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
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