-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ def _parse_ds(self): | |
| m = re.search(ds_re, line) | ||
| if m: | ||
| data_source, field, value = m.groups(0) | ||
| if not data_source in ds_dict: | ||
| if data_source not in ds_dict: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| ds_dict[data_source] = {} | ||
|
|
||
| ds_dict[data_source][field] = value.strip('"').strip() | ||
|
|
@@ -102,7 +102,7 @@ def _parse_rra(self): | |
| m = re.search(rra_re, line) | ||
| if m: | ||
| rra, field, value = m.groups(0) | ||
| if not rra in rra_dict: | ||
| if rra not in rra_dict: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| rra_dict[rra] = {} | ||
|
|
||
| rra_dict[rra][field] = value.strip('"').strip() | ||
|
|
@@ -131,10 +131,7 @@ def parse(self): | |
|
|
||
| for key, value in ds.items(): | ||
| for item in ['max', 'min']: | ||
| if value[item] == 'NaN': | ||
| value[item] = 'U' | ||
| else: | ||
| value[item] = float(value[item]) | ||
| value[item] = 'U' if value[item] == 'NaN' else float(value[item]) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| ds_str = ' DS:%s:' % key | ||
| ds_str += '%s:%s:%s:%s \\' % ( | ||
| value['type'], value['minimal_heartbeat'], | ||
|
|
@@ -171,10 +168,7 @@ def main(): | |
| help="Existing rrdfile to parse") | ||
|
|
||
| (options, args) = parser.parse_args() | ||
| params = {} | ||
| params['debug'] = options.debug | ||
| params['file'] = options.file | ||
|
|
||
| params = {'debug': options.debug, 'file': options.file} | ||
|
Comment on lines
-174
to
+171
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| rrd_parser = RRDParser(params) | ||
| rrd_parser.parse() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
rrd_convertrefactored with the following changes:remove-zero-from-range)for-index-underscore)