-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored master branch #1
Conversation
|
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.
Found the following improvement in Function QueryNotifyPrint.finish
:
|
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 QueryNotifyPrint.update
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
|
||
title = "End" | ||
|
||
print('\r') # An empty line between last line of main output and last line(more clear output) | ||
print(Style.BRIGHT + Fore.GREEN + "[" + | ||
Fore.YELLOW + "!" + | ||
Fore.GREEN + f"] {title}" + | ||
Fore.GREEN + ": " + | ||
Fore.WHITE + f" {message}" ) | ||
|
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.
Found the following improvement in Function QueryNotifyPrint.finish
:
allUsernames = [] | ||
for i in checksymbols: | ||
allUsernames.append(username.replace("{?}", i)) | ||
return allUsernames | ||
return [username.replace("{?}", i) for i in checksymbols] |
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 MultipleUsernames
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
) - Convert for loop into list comprehension (
list-comprehension
)
if len(site_data) >= 20: | ||
max_workers = 20 | ||
else: | ||
max_workers = len(site_data) | ||
|
||
max_workers = min(len(site_data), 20) |
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 sherlock
refactored with the following changes:
- Replace comparison with min/max call (
min-max-identity
) - Simplify boolean if expression (
boolean-if-exp-identity
) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
) - Replace if statement with if expression [×3] (
assign-if-exp
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Simplify logical expression using De Morgan identities (
de-morgan
)
This removes the following comments ( why? ):
# Site forwards request to a different URL if username not
# The final result of the request will be what is available.
# found. Disallow the redirect so we can capture the
# Allow whatever redirect that the site wants to do.
# Checks if the status code of the response is 2XX
# http status from the original URL request.
site_data_all = {} | ||
for site in sites: | ||
site_data_all[site.name] = site.information | ||
site_data_all = {site.name: site.information for site in sites} |
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 SherlockBaseTest.setUp
refactored with the following changes:
- Convert for loop into dictionary comprehension (
dict-comprehension
)
(site in self.excluded_sites) or | ||
(site_data["errorType"] != detect_type) or | ||
(site_data.get("username_claimed") is None) or | ||
(site_data.get("username_unclaimed") is None) | ||
): | ||
# This is either not a site we are interested in, or the | ||
# site does not contain the required information to do | ||
# the tests. | ||
pass | ||
else: | ||
site not in self.excluded_sites | ||
and site_data["errorType"] == detect_type | ||
and site_data.get("username_claimed") is not None | ||
and site_data.get("username_unclaimed") is not None | ||
): |
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 SherlockBaseTest.detect_type_check
refactored with the following changes:
- Swap if/else to remove empty if body (
remove-pass-body
)
This removes the following comments ( why? ):
# the tests.
# site does not contain the required information to do
# This is either not a site we are interested in, or the
site_no_tests_list = [] | ||
|
||
for site, site_data in self.site_data_all.items(): | ||
site_no_tests_list = [ | ||
site | ||
for site, site_data in self.site_data_all.items() | ||
if ( | ||
(site_data.get("username_claimed") is None) or | ||
(site_data.get("username_unclaimed") is None) | ||
): | ||
# Test information not available on this site. | ||
site_no_tests_list.append(site) |
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 SherlockBaseTest.coverage_total_check
refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension
)
This removes the following comments ( why? ):
# Test information not available on this site.
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.52%.
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! |
added browse functionality to notify.py
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!