Skip to content

Sourcery Starbot ⭐ refactored BQBB/05-commerce#1

Open
SourceryAI wants to merge 1 commit intoBQBB:mainfrom
SourceryAI:main
Open

Sourcery Starbot ⭐ refactored BQBB/05-commerce#1
SourceryAI wants to merge 1 commit intoBQBB:mainfrom
SourceryAI:main

Conversation

@SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch https://github.com/sourcery-ai-bot/05-commerce main
git merge --ff-only FETCH_HEAD
git reset HEAD^

except User.DoesNotExist:
return email
raise forms.ValidationError("Email '%s' already in use." % email)
raise forms.ValidationError(f"Email '{email}' already in use.")
Copy link
Author

Choose a reason for hiding this comment

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

Function AccountUpdateForm.clean_email refactored with the following changes:

class CustomUserManager(UserManager):
def get_by_natural_key(self, username):
case_insensitive_username_field = '{}__iexact'.format(self.model.USERNAME_FIELD)
case_insensitive_username_field = f'{self.model.USERNAME_FIELD}__iexact'
Copy link
Author

Choose a reason for hiding this comment

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

Function CustomUserManager.get_by_natural_key refactored with the following changes:

Comment on lines -112 to +114
addresses = Address.objects.select_related('city', 'user').filter(user=User.objects.get(id=request.auth['pk']))
if addresses:
if addresses := Address.objects.select_related('city', 'user').filter(
user=User.objects.get(id=request.auth['pk'])
):
Copy link
Author

Choose a reason for hiding this comment

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

Function list_addresses refactored with the following changes:

Comment on lines -128 to +129
cities_qs = City.objects.all()

if cities_qs:
if cities_qs := City.objects.all():
Copy link
Author

Choose a reason for hiding this comment

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

Function list_cities refactored with the following changes:

Comment on lines -191 to +192
cart_items = Item.objects.filter(user=User.objects.get(id=request.auth['pk']), ordered=False)

if cart_items:
if cart_items := Item.objects.filter(
user=User.objects.get(id=request.auth['pk']), ordered=False
):
Copy link
Author

Choose a reason for hiding this comment

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

Function view_cart refactored with the following changes:

if self.parent:
return f'- {self.name}'
return f'{self.name}'
return f'- {self.name}' if self.parent else f'{self.name}'
Copy link
Author

Choose a reason for hiding this comment

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

Function Category.__str__ refactored with the following changes:

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