-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery refactored master branch #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| a.sort(key = lambda x: str(x.date_obj.minute)) # sort by minute | ||
| for i in a: | ||
| print('{}, {}, {}'.format(i.date_str, i.constraint, i.whole_msg)) | ||
| print(f'{i.date_str}, {i.constraint}, {i.whole_msg}') |
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.
Lines 50-50 refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| print(scripts) | ||
| body_str = body(divs, scripts) | ||
| whole_thing = '<html>' + header_str + body_str + '</html>' | ||
| whole_thing = f'<html>{header_str}{body_str}</html>' |
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 construct_page refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation)
| # eg. src and dest are the same file | ||
| except shutil.Error as e: | ||
| print('Error: %s' % e) | ||
| # eg. source or destination doesn't exist | ||
| print(f'Error: {e}') | ||
| except IOError as e: | ||
| print('Copy Error: %s' % e.strerror) | ||
| print(f'Copy Error: {e.strerror}') |
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 copy_file refactored with the following changes:
- Replace interpolated string formatting with f-string [×2] (
replace-interpolation-with-fstring)
This removes the following comments ( why? ):
# eg. src and dest are the same file
# eg. source or destination doesn't exist
| parser.error("The file %s does not exist!" % arg) | ||
| parser.error(f"The file {arg} does not exist!") |
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 is_valid_file refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| full_day = 86400 | ||
| hr_val = past.hour > present.hour | ||
| day_diff = (present - past).total_seconds()/full_day >= 1 | ||
| day_diff = (present - past).total_seconds() >= 86400 |
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 day_has_passed refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block) - Simplify numeric comparison (
simplify-numeric-comparison) - Inline variable that is only used once (
inline-variable)
| if '__main__'==__name__: | ||
| if __name__ == '__main__': | ||
| url = 'http://localhost' | ||
| port = 8000 | ||
| ServerThread(port).start() | ||
| url_n_port = "{}:{}/".format(url,str(port)) | ||
| url_n_port = f"{url}:{port}/" |
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.
Lines 24-28 refactored with the following changes:
- Ensure constant in comparison is on the right (
flip-comparison) - Replace call to format with f-string (
use-fstring-for-formatting) - Remove unnecessary calls to
str()from formatted values in f-strings (remove-str-from-fstring)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.21%.
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! Help us improve this quality report! |
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:Help us improve this pull request!