-
Notifications
You must be signed in to change notification settings - Fork 2
Sourcery refactored master branch #3
base: master
Are you sure you want to change the base?
Conversation
log("u32 out of range: %s" % data, "INFO") | ||
log(f"u32 out of range: {data}", "INFO") |
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 u32
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
else: | ||
checkResult = check_output( | ||
"wiino check {}".format(wiino), shell=True, universal_newlines=True | ||
) | ||
if int(checkResult) == 0: | ||
return True | ||
else: | ||
return False | ||
checkResult = check_output( | ||
f"wiino check {wiino}", shell=True, universal_newlines=True | ||
) | ||
return int(checkResult) == 0 |
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 checkWiino
refactored with the following changes:
- Remove unnecessary else after guard condition (
remove-unnecessary-else
) - Replace call to format with f-string (
use-fstring-for-formatting
) - Replace if statement with if expression (
assign-if-exp
) - Simplify boolean if expression (
boolean-if-exp-identity
) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
if len(mac) == 12 and mac.upper()[:6] in oui: | ||
return True | ||
else: | ||
return False | ||
return len(mac) == 12 and mac.upper()[:6] in oui |
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 verifyMac
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
) - Simplify boolean if expression (
boolean-if-exp-identity
) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
if storedIP != None: | ||
if storedIP[0] == "None": # allows admins to reset a mii's IP | ||
pass | ||
|
||
elif storedIP[0] != ip: | ||
pass | ||
# result(610) #current IP address is different from the one the mii was initially uploaded with | ||
|
||
else: | ||
pass | ||
# result(610) | ||
|
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 212-223
refactored with the following changes:
- Remove redundant conditional [×2] (
remove-redundant-if
) - Merge duplicate blocks in conditional (
merge-duplicate-blocks
) - Remove redundant pass statement (
remove-redundant-pass
)
This removes the following comments ( why? ):
# result(610)
# allows admins to reset a mii's IP
# result(610) #current IP address is different from the one the mii was initially uploaded with
artisans.append(form["craftsno1"].value) | ||
artisans.append(form["craftsno2"].value) | ||
artisans.append(form["craftsno3"].value) | ||
artisans.extend( | ||
( | ||
form["craftsno1"].value, | ||
form["craftsno2"].value, | ||
form["craftsno3"].value, | ||
) | ||
) | ||
judgingMiis = True | ||
|
||
except KeyError: | ||
artisans.append(form["craftsno1"].value) | ||
judgingMiis = False | ||
|
||
if judgingMiis == True: | ||
if judgingMiis: |
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 33-59
refactored with the following changes:
- Merge consecutive list appends into a single extend [×2] (
merge-list-appends-into-extend
) - Simplify comparison to boolean (
simplify-boolean-comparison
) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
headers = "\t<tr>\n" + "".join(headers) + "\t</tr>\n" | ||
|
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 54-86
refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block
) - Replace manual loop counter with call to enumerate (
convert-to-enumerate
) - Replace call to format with f-string (
use-fstring-for-formatting
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
if 232 < (0xD4A50FFF < num) + (crc & 0xFF): | ||
if (num > 0xD4A50FFF) + (crc & 0xFF) > 232: |
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 decToEntry
refactored with the following changes:
- Ensure constant in comparison is on the right [×2] (
flip-comparison
)
headers = "\t<tr>\n" + "".join(headers) + "\t</tr>\n" | ||
|
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 54-86
refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block
) - Replace manual loop counter with call to enumerate (
convert-to-enumerate
) - Replace call to format with f-string (
use-fstring-for-formatting
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
if 232 < (0xD4A50FFF < num) + (crc & 0xFF): | ||
if (num > 0xD4A50FFF) + (crc & 0xFF) > 232: |
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 decToEntry
refactored with the following changes:
- Ensure constant in comparison is on the right [×2] (
flip-comparison
)
mii_filename = "/var/www/rc24/wapp.wii.com/miicontest/public_html/render/entry-{}.mii".format( | ||
entryno | ||
) | ||
mii_filename = f"/var/www/rc24/wapp.wii.com/miicontest/public_html/render/entry-{entryno}.mii" |
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 80-100
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
) - Use f-string instead of string concatenation [×7] (
use-fstring-for-concatenation
)
Branch
master
refactored 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
master
branch, then run:Help us improve this pull request!