Conversation
| for ds in range(0, ds_cnt): | ||
| for ds in range(ds_cnt): | ||
| fd.write(fs.read(40)) | ||
| for i in range(0, 10): | ||
| for _ in range(10): | ||
| double_read_write_swap_nan() | ||
|
|
||
| row_cnt = 0 | ||
| ### __rrd_read(rrd->rra_def, rra_def_t, rrd->stat_head->rra_cnt); | ||
| for rra in range(0, rra_cnt): | ||
| for _ in range(rra_cnt): |
There was a problem hiding this comment.
Function rrd_convert refactored with the following changes:
- Replace range(0, x) with range(x) (
remove-zero-from-range) - Replace unused for index with underscore (
for-index-underscore)
| if m: | ||
| data_source, field, value = m.groups(0) | ||
| if not data_source in ds_dict: | ||
| if data_source not in ds_dict: |
There was a problem hiding this comment.
Function RRDParser._parse_ds refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan)
| if m: | ||
| rra, field, value = m.groups(0) | ||
| if not rra in rra_dict: | ||
| if rra not in rra_dict: |
There was a problem hiding this comment.
Function RRDParser._parse_rra refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan)
| value[item] = 'U' | ||
| else: | ||
| value[item] = float(value[item]) | ||
| value[item] = 'U' if value[item] == 'NaN' else float(value[item]) |
There was a problem hiding this comment.
Function RRDParser.parse refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| params = {} | ||
| params['debug'] = options.debug | ||
| params['file'] = options.file | ||
|
|
||
| params = {'debug': options.debug, 'file': options.file} |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Merge dictionary assignment with declaration (
merge-dict-assign)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.56%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
Branch
masterrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run: