fix style
Wing924 committed
Feb 23, 2018 at 11:39 UTC
2a3bb94aa0048bae1ba1be90e80c02887b110d15
1 file changed
+9
-8
python.d/springboot.chart.py
+9
-8
@@ -78,7 +78,7 @@ class Service(UrlService):
78
if raw_data:
79
try:
80
data = json.loads(raw_data)
81
- except:
81
+ except Excepton:
82
self.debug('%s is not a vaild JSON page' % self.url)
83
return None
84
@@ -113,12 +113,12 @@ class Service(UrlService):
113
self.definitions = definitions
114
115
def _add_extra_chart(self, charts, chart):
116
- chart_id = chart.get('id', None) or self.die('id is not defined in extra chart')
117
- options = chart.get('options', None) or self.die('option is not defined in extra chart: %s' % chart_id)
118
- lines = chart.get('lines', None) or self.die('lines is not defined in extra chart: %s' % chart_id)
116
+ chart_id = chart.get('id', None) or die('id is not defined in extra chart')
117
+ options = chart.get('options', None) or die('option is not defined in extra chart: %s' % chart_id)
118
+ lines = chart.get('lines', None) or die('lines is not defined in extra chart: %s' % chart_id)
119
120
- title = options.get('title', None) or self.die('title is missing: %s', chart_id)
121
- units = options.get('units', None) or self.die('units is missing: %s', chart_id)
120
+ title = options.get('title', None) or die('title is missing: %s' chart_id)
121
+ units = options.get('units', None) or die('units is missing: %s' chart_id)
122
family = options.get('family', title)
123
context = options.get('context', 'springboot.' + title)
124
charttype = options.get('charttype', 'line')
@@ -129,7 +129,7 @@ class Service(UrlService):
129
}
130
131
for line in lines:
132
- dimension = line.get('dimension', None) or self.die('dimension is missing: %s', chart_id)
132
+ dimension = line.get('dimension', None) or self.die('dimension is missing: %s' chart_id)
133
name = line.get('name', dimension)
134
algorithm = line.get('algorithm', 'absolute')
135
multiplier = line.get('multiplier', 1)
@@ -138,5 +138,6 @@ class Service(UrlService):
138
139
charts[chart_id] = result
140
141
- def die(self, error_message):
141
+ @classmethod
142
+ def die(error_message):
143
raise Exception(error_message)