Skip to content

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
eikhr committed Jul 6, 2024
1 parent 490a654 commit 0f754b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lego/apps/email/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class Meta:

def validate(self, attrs: Any) -> Any:
# Use existing values where missing to support patch requests
get = lambda index: (
attrs[index] if index in attrs else getattr(self.instance, index)
)
length = lambda value: (
len(value) if hasattr(value, "__len__") else value.count()
)
def get(index):
return attrs[index] if index in attrs else getattr(self.instance, index)

def length(value):
return len(value) if hasattr(value, "__len__") else value.count()

# Require at least one receiver of the email list
users_len, emails_len = length(get("users")), length(get("additional_emails"))
if users_len == 0 and emails_len == 0:
Expand Down

0 comments on commit 0f754b2

Please sign in to comment.