Self hosted FLOSS fitness/workout, nutrition and weight tracker
Automatic linting
Github-actions3c00a328615a
diff --git a/wger/core/management/commands/add-user-rest.py b/wger/core/management/commands/add-user-rest.pyindex 73172103b..c71a5ea12 100644--- a/wger/core/management/commands/add-user-rest.py+++ b/wger/core/management/commands/add-user-rest.py@@ -32,14 +32,14 @@ class Command(BaseCommand):user.userprofile.can_add_user = Falseself.stdout.write(self.style.SUCCESS(- f"{options['name']} is now DISABLED from adding users via the API"+ f'{options["name"]} is now DISABLED from adding users via the API'))else:user.userprofile.can_add_user = Trueself.stdout.write(- self.style.SUCCESS(f"{options['name']} is now ALLOWED to add users via the API")+ self.style.SUCCESS(f'{options["name"]} is now ALLOWED to add users via the API'))user.userprofile.save()diff --git a/wger/core/management/commands/dummy-generator-users.py b/wger/core/management/commands/dummy-generator-users.pyindex 19ffccc89..29d1fc234 100644--- a/wger/core/management/commands/dummy-generator-users.py+++ b/wger/core/management/commands/dummy-generator-users.py@@ -65,7 +65,7 @@ class Command(BaseCommand):def handle(self, **options):faker = Faker()- self.stdout.write(f"** Generating {options['number_users']} users")+ self.stdout.write(f'** Generating {options["number_users"]} users')match options['add_to_gym']:case 'auto':@@ -80,7 +80,7 @@ class Command(BaseCommand):first_name = faker.first_name()last_name = faker.last_name()- username = slugify(f"{first_name}, {last_name} - {str(uid).split('-')[1]}")+ username = slugify(f'{first_name}, {last_name} - {str(uid).split("-")[1]}')email = f'{username}@example.com'password = usernamediff --git a/wger/core/models/profile.py b/wger/core/models/profile.pyindex 581adcc7d..59e82527f 100644--- a/wger/core/models/profile.py+++ b/wger/core/models/profile.py@@ -116,7 +116,7 @@ class UserProfile(models.Model):show_comments = models.BooleanField(verbose_name=_('Show exercise comments'),- help_text=_('Check to show exercise comments on the ' 'workout view'),+ help_text=_('Check to show exercise comments on the workout view'),default=True,)"""@@ -149,7 +149,7 @@ by the US Department of Agriculture. It is extremely complete, with aroundworkout_reminder = IntegerField(verbose_name=_('Remind before expiration'),- help_text=_('The number of days you want to be reminded ' 'before a workout expires.'),+ help_text=_('The number of days you want to be reminded before a workout expires.'),default=14,validators=[MinValueValidator(1), MaxValueValidator(30)],)@@ -349,8 +349,8 @@ by the US Department of Agriculture. It is extremely complete, with around"""Allow anonymous read-only access"""num_days_weight_reminder = models.IntegerField(- verbose_name=_('Automatic reminders for weight ' 'entries'),- help_text=_('Number of days after the last ' 'weight entry (enter 0 to ' 'deactivate)'),+ verbose_name=_('Automatic reminders for weight entries'),+ help_text=_('Number of days after the last weight entry (enter 0 to deactivate)'),validators=[MinValueValidator(0), MaxValueValidator(30)],default=0,)diff --git a/wger/exercises/api/serializers.py b/wger/exercises/api/serializers.pyindex c9ef15538..88137a31d 100644--- a/wger/exercises/api/serializers.py+++ b/wger/exercises/api/serializers.py@@ -374,7 +374,7 @@ class ExerciseTranslationSerializer(serializers.ModelSerializer):~Q(id=self.instance.pk), language=value['language']).exists():raise serializers.ValidationError(- f"There is already a translation for this exercise in {value['language']}"+ f'There is already a translation for this exercise in {value["language"]}')# Creating a new object# -> Check if the language already exists@@ -383,7 +383,7 @@ class ExerciseTranslationSerializer(serializers.ModelSerializer):exercise_base=value['exercise_base'], language=value['language']).exists():raise serializers.ValidationError(- f"There is already a translation for this exercise in {value['language']}"+ f'There is already a translation for this exercise in {value["language"]}')return super().validate(value)diff --git a/wger/exercises/management/commands/download-exercise-videos.py b/wger/exercises/management/commands/download-exercise-videos.pyindex ed0b95f03..f76cf446c 100644--- a/wger/exercises/management/commands/download-exercise-videos.py+++ b/wger/exercises/management/commands/download-exercise-videos.py@@ -44,7 +44,7 @@ class Command(BaseCommand):action='store',dest='remote_url',default='https://wger.de',- help='Remote URL to fetch the exercises from (default: ' 'https://wger.de)',+ help='Remote URL to fetch the exercises from (default: https://wger.de)',)def handle(self, **options):diff --git a/wger/exercises/sync.py b/wger/exercises/sync.pyindex 7cbc1ffbe..d96a784ce 100644--- a/wger/exercises/sync.py+++ b/wger/exercises/sync.py@@ -88,7 +88,7 @@ def sync_exercises(uuid=uuid,defaults={'category_id': category_id, 'created': created},)- print_fn(f"{'created' if base_created else 'updated'} exercise {uuid}")+ print_fn(f'{"created" if base_created else "updated"} exercise {uuid}')base.muscles.set(muscles)base.muscles_secondary.set(muscles_sec)@@ -113,8 +113,8 @@ def sync_exercises(},)out = (- f"- {'created' if translation_created else 'updated'} translation "- f"{translation.language.short_name} {trans_uuid} - {name}"+ f'- {"created" if translation_created else "updated"} translation '+ f'{translation.language.short_name} {trans_uuid} - {name}')print_fn(out)@@ -344,7 +344,7 @@ def handle_deleted_entries(try:obj = Exercise.objects.get(uuid=uuid)obj.delete()- print_fn(f"Deleted translation {uuid} ({data['comment']})")+ print_fn(f'Deleted translation {uuid} ({data["comment"]})')except Exercise.DoesNotExist:passdiff --git a/wger/exercises/tests/test_categories.py b/wger/exercises/tests/test_categories.pyindex 986f6ce99..78b9e9b90 100644--- a/wger/exercises/tests/test_categories.py+++ b/wger/exercises/tests/test_categories.py@@ -46,7 +46,7 @@ class CategoryOverviewTestCase(WgerAccessTestCase):user_success = 'admin'user_fail = ('manager1',- 'manager2' 'general_manager1',+ 'manager2general_manager1','manager3','manager4','test',diff --git a/wger/exercises/tests/test_exercise_translation.py b/wger/exercises/tests/test_exercise_translation.pyindex 5e6af2287..7e413d12a 100644--- a/wger/exercises/tests/test_exercise_translation.py+++ b/wger/exercises/tests/test_exercise_translation.py@@ -118,7 +118,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles': Muscle.objects.get(pk=2)})- template = Template('{% load wger_extras %}' '{% render_muscles muscles %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles %}')rendered_template = template.render(context)self.assertIn('images/muscles/main/muscle-2.svg', rendered_template)self.assertNotIn('images/muscles/secondary/', rendered_template)@@ -130,7 +130,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles': Muscle.objects.get(pk=2), 'muscles_sec': []})- template = Template('{% load wger_extras %}' '{% render_muscles muscles muscles_sec %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles muscles_sec %}')rendered_template = template.render(context)self.assertIn('images/muscles/main/muscle-2.svg', rendered_template)self.assertNotIn('images/muscles/secondary/', rendered_template)@@ -142,7 +142,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles': Muscle.objects.get(pk=1)})- template = Template('{% load wger_extras %}' '{% render_muscles muscles_sec=muscles %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles_sec=muscles %}')rendered_template = template.render(context)self.assertIn('images/muscles/secondary/muscle-1.svg', rendered_template)self.assertNotIn('images/muscles/main/', rendered_template)@@ -154,7 +154,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles_sec': Muscle.objects.get(pk=1), 'muscles': []})- template = Template('{% load wger_extras %}' '{% render_muscles muscles muscles_sec %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles muscles_sec %}')rendered_template = template.render(context)self.assertIn('images/muscles/secondary/muscle-1.svg', rendered_template)self.assertNotIn('images/muscles/main/', rendered_template)@@ -166,7 +166,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles_sec': Muscle.objects.filter(is_front=True), 'muscles': []})- template = Template('{% load wger_extras %}' '{% render_muscles muscles muscles_sec %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles muscles_sec %}')rendered_template = template.render(context)self.assertIn('images/muscles/secondary/muscle-1.svg', rendered_template)self.assertNotIn('images/muscles/secondary/muscle-2.svg', rendered_template)@@ -185,7 +185,7 @@ class MuscleTemplateTagTest(WgerTestCase):'muscles': Muscle.objects.filter(id__in=[1, 4]),})- template = Template('{% load wger_extras %}' '{% render_muscles muscles muscles_sec %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles muscles_sec %}')rendered_template = template.render(context)self.assertIn('images/muscles/main/muscle-1.svg', rendered_template)self.assertNotIn('images/muscles/main/muscle-2.svg', rendered_template)@@ -202,7 +202,7 @@ class MuscleTemplateTagTest(WgerTestCase):"""context = Context({'muscles': [], 'muscles_sec': []})- template = Template('{% load wger_extras %}' '{% render_muscles muscles muscles_sec %}')+ template = Template('{% load wger_extras %}{% render_muscles muscles muscles_sec %}')rendered_template = template.render(context)self.assertEqual(rendered_template, '\n\n')@@ -211,7 +211,7 @@ class MuscleTemplateTagTest(WgerTestCase):Test that the tag works when given no parameters"""- template = Template('{% load wger_extras %}' '{% render_muscles %}')+ template = Template('{% load wger_extras %}{% render_muscles %}')rendered_template = template.render(Context({}))self.assertEqual(rendered_template, '\n\n')diff --git a/wger/exercises/tests/test_muscles.py b/wger/exercises/tests/test_muscles.pyindex 1a7a3ba7b..70df8bfc7 100644--- a/wger/exercises/tests/test_muscles.py+++ b/wger/exercises/tests/test_muscles.py@@ -52,7 +52,7 @@ class MuscleAdminOverviewTest(WgerAccessTestCase):user_success = 'admin'user_fail = ('manager1',- 'manager2' 'general_manager1',+ 'manager2general_manager1','manager3','manager4','test',diff --git a/wger/gym/forms.py b/wger/gym/forms.pyindex 1201bbffe..939a90a32 100644--- a/wger/gym/forms.py+++ b/wger/gym/forms.py@@ -95,9 +95,9 @@ class GymUserAddForm(GymUserPermissionForm, UserPersonalInformationForm):label=_('Username'),max_length=30,regex=r'^[\w.@+-]+$',- help_text=_('Required. 30 characters or fewer. Letters, digits and ' '@/./+/-/_ only.'),+ help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'),error_messages={- 'invalid': _('This value may contain only letters, numbers and ' '@/.//-/_ characters.')+ 'invalid': _('This value may contain only letters, numbers and @/.//-/_ characters.')},)diff --git a/wger/gym/management/commands/dummy-generator-gyms.py b/wger/gym/management/commands/dummy-generator-gyms.pyindex d10afeb93..9d796d1a2 100644--- a/wger/gym/management/commands/dummy-generator-gyms.py+++ b/wger/gym/management/commands/dummy-generator-gyms.py@@ -92,7 +92,7 @@ class Command(BaseCommand):faker.add_provider(gym_names_1)faker.add_provider(gym_names_2)- self.stdout.write(f"** Generating {options['number_gyms']} gyms")+ self.stdout.write(f'** Generating {options["number_gyms"]} gyms')gym_list = []for i in range(options['number_gyms']):diff --git a/wger/gym/models/user_config.py b/wger/gym/models/user_config.pyindex 36deb15f1..f13c700af 100644--- a/wger/gym/models/user_config.py+++ b/wger/gym/models/user_config.py@@ -90,7 +90,7 @@ class GymUserConfig(AbstractGymUserConfigModel, m.Model):include_inactive = m.BooleanField(verbose_name=_('Include in inactive overview'),- help_text=_('Include this user in the email list with ' 'inactive members'),+ help_text=_('Include this user in the email list with inactive members'),default=True,)"""diff --git a/wger/manager/management/commands/dummy-generator-workout-diary.py b/wger/manager/management/commands/dummy-generator-workout-diary.pyindex 38fcbc8a2..8aff6dae4 100644--- a/wger/manager/management/commands/dummy-generator-workout-diary.py+++ b/wger/manager/management/commands/dummy-generator-workout-diary.py@@ -78,7 +78,7 @@ class Command(BaseCommand):)def handle(self, **options):- self.stdout.write(f"** Generating {options['nr_diary_entries']} dummy diary entries")+ self.stdout.write(f'** Generating {options["nr_diary_entries"]} dummy diary entries')users = ([User.objects.get(pk=options['user_id'])] if options['user_id'] else User.objects.all()diff --git a/wger/manager/management/commands/dummy-generator-workout-plans.py b/wger/manager/management/commands/dummy-generator-workout-plans.pyindex dee7dcf57..a50562fcc 100644--- a/wger/manager/management/commands/dummy-generator-workout-plans.py+++ b/wger/manager/management/commands/dummy-generator-workout-plans.py@@ -61,7 +61,7 @@ class Command(BaseCommand):)def handle(self, **options):- self.stdout.write(f"** Generating {options['nr_plans']} dummy workout plan(s) per user")+ self.stdout.write(f'** Generating {options["nr_plans"]} dummy workout plan(s) per user')users = ([User.objects.get(pk=options['user_id'])] if options['user_id'] else User.objects.all()diff --git a/wger/manager/models/schedule.py b/wger/manager/models/schedule.pyindex 896b32835..210f3fb43 100644--- a/wger/manager/models/schedule.py+++ b/wger/manager/models/schedule.py@@ -54,7 +54,7 @@ class Schedule(models.Model):name = models.CharField(verbose_name=_('Name'),max_length=100,- help_text=_('Name or short description of the schedule. ' "For example 'Program XYZ'."),+ help_text=_("Name or short description of the schedule. For example 'Program XYZ'."),)"""Name or short description of the schedule."""diff --git a/wger/manager/models/session.py b/wger/manager/models/session.pyindex 1320ef0f7..ff8afa037 100644--- a/wger/manager/models/session.py+++ b/wger/manager/models/session.py@@ -73,7 +73,7 @@ class WorkoutSession(models.Model):verbose_name=_('Notes'),null=True,blank=True,- help_text=_('Any notes you might want to save about this workout ' 'session.'),+ help_text=_('Any notes you might want to save about this workout session.'),)"""User notes about the workout@@ -85,7 +85,7 @@ class WorkoutSession(models.Model):choices=IMPRESSION,default=IMPRESSION_NEUTRAL,help_text=_(- 'Your impression about this workout session. ' 'Did you exercise as well as you could?'+ 'Your impression about this workout session. Did you exercise as well as you could?'),)"""diff --git a/wger/manager/models/workout.py b/wger/manager/models/workout.pyindex e981f7923..276a178fa 100644--- a/wger/manager/models/workout.py+++ b/wger/manager/models/workout.py@@ -72,7 +72,7 @@ class Workout(models.Model):is_template = models.BooleanField(verbose_name=_('Workout template'),help_text=_(- 'Marking a workout as a template will freeze it and allow you to ' 'make copies of it'+ 'Marking a workout as a template will freeze it and allow you to make copies of it'),default=False,null=False,diff --git a/wger/manager/tests/test_set.py b/wger/manager/tests/test_set.pyindex a6acd0681..cf36390da 100644--- a/wger/manager/tests/test_set.py+++ b/wger/manager/tests/test_set.py@@ -483,7 +483,7 @@ class SetSmartReprTestCase(WgerTestCase):setting_text = set_obj.reps_smart_text(ExerciseBase.objects.get(pk=1))self.assertEqual(setting_text,- '8 (90 kg, 3 RiR) – 10 (80 kg, 2.5 RiR) – ' '10 (80 kg, 2 RiR) – 12 (80 kg, 1 RiR)',+ '8 (90 kg, 3 RiR) – 10 (80 kg, 2.5 RiR) – 10 (80 kg, 2 RiR) – 12 (80 kg, 1 RiR)',)def test_synthetic_settings(self):diff --git a/wger/measurements/management/commands/dummy-generator-measurement-categories.py b/wger/measurements/management/commands/dummy-generator-measurement-categories.pyindex 5e9a1da0e..4829e551e 100644--- a/wger/measurements/management/commands/dummy-generator-measurement-categories.py+++ b/wger/measurements/management/commands/dummy-generator-measurement-categories.py@@ -67,7 +67,7 @@ class Command(BaseCommand):def handle(self, **options):self.stdout.write(- f"** Generating {options['nr_categories']} dummy measurement categories per user"+ f'** Generating {options["nr_categories"]} dummy measurement categories per user')users = (diff --git a/wger/measurements/management/commands/dummy-generator-measurements.py b/wger/measurements/management/commands/dummy-generator-measurements.pyindex a28e552d9..4ac52e733 100644--- a/wger/measurements/management/commands/dummy-generator-measurements.py+++ b/wger/measurements/management/commands/dummy-generator-measurements.py@@ -63,7 +63,7 @@ class Command(BaseCommand):)def handle(self, **options):- self.stdout.write(f"** Generating {options['nr_measurements']} dummy measurements per user")+ self.stdout.write(f'** Generating {options["nr_measurements"]} dummy measurements per user')users = ([User.objects.get(pk=options['user_id'])] if options['user_id'] else User.objects.all()diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.pyindex 1e3539180..d084396bc 100644--- a/wger/nutrition/forms.py+++ b/wger/nutrition/forms.py@@ -206,16 +206,14 @@ class DailyCaloriesForm(forms.ModelForm):base_calories = forms.IntegerField(label=_('Basic caloric intake'),- help_text=_('Your basic caloric intake as calculated for ' 'your data'),+ help_text=_('Your basic caloric intake as calculated for your data'),required=False,widget=Html5NumberInput(),)additional_calories = forms.IntegerField(label=_('Additional calories'),help_text=_(- 'Additional calories to add to the base '- 'rate (to substract, enter a negative '- 'number)'+ 'Additional calories to add to the base rate (to substract, enter a negative number)'),initial=0,required=False,diff --git a/wger/nutrition/management/commands/dummy-generator-nutrition.py b/wger/nutrition/management/commands/dummy-generator-nutrition.pyindex 5b20cecac..fdbf1fae7 100644--- a/wger/nutrition/management/commands/dummy-generator-nutrition.py+++ b/wger/nutrition/management/commands/dummy-generator-nutrition.py@@ -80,7 +80,7 @@ class Command(BaseCommand):)def handle(self, **options):- self.stdout.write(f"** Generating {options['nr_plans']} dummy nutritional plan(s) per user")+ self.stdout.write(f'** Generating {options["nr_plans"]} dummy nutritional plan(s) per user')users = ([User.objects.get(pk=options['user_id'])] if options['user_id'] else User.objects.all()@@ -147,6 +147,6 @@ class Command(BaseCommand):diary_entries.append(log)if int(options['verbosity']) >= 2:- self.stdout.write(f" created {options['nr_diary_dates']} diary entries")+ self.stdout.write(f' created {options["nr_diary_dates"]} diary entries')LogItem.objects.bulk_create(diary_entries)diff --git a/wger/nutrition/management/commands/sync-ingredients-async.py b/wger/nutrition/management/commands/sync-ingredients-async.pyindex 3857391fc..5acd650ec 100644--- a/wger/nutrition/management/commands/sync-ingredients-async.py+++ b/wger/nutrition/management/commands/sync-ingredients-async.py@@ -12,19 +12,22 @@## You should have received a copy of the GNU Affero General Public License+# Djangofrom django.core.management.base import BaseCommand++# wgerfrom wger.nutrition.tasks import sync_all_ingredients_taskclass Command(BaseCommand):-- help = "Asynchronously synchronize all ingredients from another wger instance."+ help = 'Asynchronously synchronize all ingredients from another wger instance.'def handle(self, *args, **options):-- self.stdout.write("Triggering the Celery task to synchronize all ingredients...")+ self.stdout.write('Triggering the Celery task to synchronize all ingredients...')# Trigger the task asynchronouslysync_all_ingredients_task.delay()- self.stdout.write("Synchronization task has been triggered. Check the Celery worker logs for progress.")+ self.stdout.write(+ 'Synchronization task has been triggered. Check the Celery worker logs for progress.'+ )diff --git a/wger/nutrition/models/plan.py b/wger/nutrition/models/plan.pyindex 8cea374fb..4010d287d 100644--- a/wger/nutrition/models/plan.py+++ b/wger/nutrition/models/plan.py@@ -66,7 +66,7 @@ class NutritionPlan(models.Model):blank=True,verbose_name=_('Description'),help_text=_(- 'A description of the goal of the plan, e.g. ' '"Gain mass" or "Prepare for summer"'+ 'A description of the goal of the plan, e.g. "Gain mass" or "Prepare for summer"'),)diff --git a/wger/nutrition/sync.py b/wger/nutrition/sync.pyindex bf73b2347..937e9bd5b 100644--- a/wger/nutrition/sync.py+++ b/wger/nutrition/sync.py@@ -250,6 +250,6 @@ def sync_ingredients(},)- print_fn(f"{'created' if created else 'updated'} ingredient {uuid} - {name}")+ print_fn(f'{"created" if created else "updated"} ingredient {uuid} - {name}')print_fn(style_fn('done!\n'))diff --git a/wger/nutrition/tasks.py b/wger/nutrition/tasks.pyindex e6b771d89..a52418a06 100644--- a/wger/nutrition/tasks.py+++ b/wger/nutrition/tasks.py@@ -19,12 +19,12 @@ from random import (randint,)-from celery import shared_task# Djangofrom django.conf import settingsfrom django.core.management import call_command# Third Party+from celery import shared_taskfrom celery.schedules import crontab# wgerdiff --git a/wger/tasks.py b/wger/tasks.pyindex bd8170392..ca0546314 100644--- a/wger/tasks.py+++ b/wger/tasks.py@@ -258,7 +258,7 @@ def load_fixtures(context, settings_path=None):call_command('loaddata', 'gym-adminconfig.json')-@task(help={'settings-path': 'Path to settings file (absolute path). Leave empty for ' 'default'})+@task(help={'settings-path': 'Path to settings file (absolute path). Leave empty for default'})def load_online_fixtures(context, settings_path=None):"""Downloads fixtures from server and installs them (at the moment only ingredients)diff --git a/wger/weight/management/commands/dummy-generator-body-weight.py b/wger/weight/management/commands/dummy-generator-body-weight.pyindex 096f8be76..d6e6c04e2 100644--- a/wger/weight/management/commands/dummy-generator-body-weight.py+++ b/wger/weight/management/commands/dummy-generator-body-weight.py@@ -53,7 +53,7 @@ class Command(BaseCommand):)def handle(self, **options):- self.stdout.write(f"** Generating {options['nr_entries']} weight entries per user")+ self.stdout.write(f'** Generating {options["nr_entries"]} weight entries per user')base_weight = 80@@ -61,7 +61,7 @@ class Command(BaseCommand):[User.objects.get(pk=options['user_id'])] if options['user_id'] else User.objects.all())- print(f"** Generating {options['nr_entries']} weight entries per user")+ print(f'** Generating {options["nr_entries"]} weight entries per user')for user in users:new_entries = []