Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Automatic linting

Github-actions0a75eb0e7509
diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.py
index dd342a556..1ef372a8c 100644
--- a/wger/core/api/serializers.py
+++ b/wger/core/api/serializers.py
@@ -177,7 +177,7 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
suggestions_string = ', '.join(suggestions)
raise serializers.ValidationError(
f'A user with this username already exists. \nSuggestions: {suggestions_string}'
- )
+ )
return value
def validate_email(self, value):
diff --git a/wger/utils/tests/test_username.py b/wger/utils/tests/test_username.py
index 4247ab43e..bffffd4f2 100644
--- a/wger/utils/tests/test_username.py
+++ b/wger/utils/tests/test_username.py
@@ -33,7 +33,9 @@ class TestGenerateUsernameSuggestions(TestCase):
Suggestions should not exist in the database
"""
suggestions = generate_username_suggestions('john', 100)
- taken = set(User.objects.filter(username__in=suggestions).values_list('username', flat=True))
+ taken = set(
+ User.objects.filter(username__in=suggestions).values_list('username', flat=True)
+ )
for suggestion in suggestions:
self.assertNotIn(suggestion, taken)
diff --git a/wger/utils/username.py b/wger/utils/username.py
index 3542707c8..9a78907e3 100644
--- a/wger/utils/username.py
+++ b/wger/utils/username.py
@@ -12,13 +12,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+import random
+# Standard library
+import re
+
# Django
from django.contrib.auth.models import User
-#Standard library
-import re
-import random
-
def generate_username_suggestions(username: str, count: int = 3):
"""
@@ -31,7 +32,7 @@ def generate_username_suggestions(username: str, count: int = 3):
f'{text}{random.randint(100, 999)}',
f'{text[0]}{text}{random.randint(1, 10)}',
f'{text}{text[-1]}{random.randint(1, 10)}',
- f'{text}_{random.randint(1,99)}',
+ f'{text}_{random.randint(1, 99)}',
]
random.shuffle(candidates)