Skip to content
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

Runs Ruff Formatting Over Project (Sourcery refactored) #207

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Dec 11, 2023

Pull Request #206 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

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 develop branch, then run:

git fetch origin sourcery/develop
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

Comment on lines -33 to +42
if not word.isupper():
if (
if word.isupper():
updated_words.append(word)
elif (
len(word.strip()) >= 4 or word in capitalized_exceptions
) and word not in uncapitalized_exceptions:
updated_words.append(word.title())
elif (
len(word.strip()) < 4 or word in uncapitalized_exceptions
) and word not in capitalized_exceptions:
updated_words.append(word.lower())
else:
updated_words.append(word)
updated_words.append(word.title())
elif (
len(word.strip()) < 4 or word in uncapitalized_exceptions
) and word not in capitalized_exceptions:
updated_words.append(word.lower())
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PostForm.clean_title refactored with the following changes:

cleaned_query = search.cleanup_string(initial_query)
if cleaned_query:
if cleaned_query := search.cleanup_string(initial_query):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SearchResultsView.get_queryset refactored with the following changes:

s: str = ""
for key, value in vowel_freq.items():
s += key * value
s: str = "".join(key * value for key, value in vowel_freq.items())
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GameSetup.get_weighted_vowels refactored with the following changes:

  • Use str.join() instead of for loop (use-join)

Comment on lines -76 to +74
s: str = ""
for key, value in consonant_freq.items():
s += key * value
s: str = "".join(key * value for key, value in consonant_freq.items())
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GameSetup.get_weighted_consonants refactored with the following changes:

  • Use str.join() instead of for loop (use-join)

Comment on lines -183 to +179
definition = (
f"The definition for '{word}' cannot be found " + "in the Oxford Dictionaries API."
)
definition = f"The definition for '{word}' cannot be found in the Oxford Dictionaries API."
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function lookup_definition_data refactored with the following changes:

return [line for line in file.readlines()]
return list(file.readlines())
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function read_log_file refactored with the following changes:

results = []
for area in area_results:
results.append(area)

results = list(area_results)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_area_results refactored with the following changes:

user_passes_auth = self.authenticate_user(user=user)
if user_passes_auth:
if user_passes_auth := self.authenticate_user(user=user):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserLoginView.handle_email_auth_user refactored with the following changes:

Comment on lines -288 to +287
context["redacted_user_email"] = f"{email[0:2]}**********@{domain}"
context["redacted_user_email"] = f"{email[:2]}**********@{domain}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserSetupEmailTokenView.get_context_data refactored with the following changes:

Comment on lines -143 to +144
def good_data_with_image(test_image):
return {
"profile_picture": test_image,
"author_view": 0,
"validity": True,
}
def good_data_with_image(self):
return {"profile_picture": self, "author_view": 0, "validity": True}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestProfileUpdateForm.good_data_with_image refactored with the following changes:

Copy link
Owner

@WayneLambert WayneLambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes recommended by Sourcery can be accepted.

@WayneLambert WayneLambert merged commit d5b89ca into develop Dec 11, 2023
1 check failed
@WayneLambert WayneLambert deleted the sourcery/develop branch December 11, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant