Completed
Push — master ( f7c3f8...59d572 )
by Edward
04:38 queued 02:04
created

AddAnnotation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %
Metric Value
dl 0
loc 18
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 17 4
1
from lib import action
2
3
4
class AddAnnotation(action.LibratoBaseAction):
5
    def run(self, stream, title, description=None, start_time=None,
6
            end_time=None):
7
        # TODO: Add support for links
8
        data = {
9
            'title': title
10
        }
11
12
        if description:
13
            data['description'] = description
14
15
        if start_time:
16
            data['start_time'] = start_time
17
18
        if end_time:
19
            data['end_time'] = end_time
20
21
        return self.librato.post_annotation(name=stream, **data)
22