Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Shorten long lines

Roland Geider4a34f3bc377d
diff --git a/extras/scripts/filter-fixtures.py b/extras/scripts/filter-fixtures.py
index e03c0bfcb..b3f7dd2bd 100755
--- a/extras/scripts/filter-fixtures.py
+++ b/extras/scripts/filter-fixtures.py
@@ -25,7 +25,7 @@ After dumping the database (or parts of it), just copy the file and filter it:
mv categories.json muscles.json equipment.json translations.json exercise-base-data.json ../../wger/exercises/fixtures
...
rm *.json
-"""
+""" # noqa: E501
import json
import sys
diff --git a/settings/main.py b/settings/main.py
index 5c7e0d317..0ea4a609b 100644
--- a/settings/main.py
+++ b/settings/main.py
@@ -327,7 +327,10 @@ LOGGING = {
'disable_existing_loggers': False,
'formatters': {
'simple': {
- 'format': 'level={levelname} ts={asctime} module={module} path={pathname} line={lineno} message={message}',
+ 'format': (
+ 'level={levelname} ts={asctime} module={module} '
+ 'path={pathname} line={lineno} message={message}'
+ ),
'style': '{',
},
},
diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.py
index 5e43edf0c..db03aaafd 100644
--- a/wger/core/api/serializers.py
+++ b/wger/core/api/serializers.py
@@ -192,11 +192,13 @@ class LanguageCheckSerializer(serializers.Serializer):
'check': {
'result': False,
'detected_language': detected_language_code,
- 'message': f'The detected language is "{detected_language.name.capitalize()}" ({detected_language_code}), '
- f'which does not match your selected language "{language.full_name.capitalize()}" '
- f'({language.short_name}). If you believe this is incorrect, try adding more content '
- f'or rephrasing your text, as language detection works better with longer or more '
- f'complete sentences.',
+ 'message': 'The detected language is '
+ f'"{detected_language.name.capitalize()}" ({detected_language_code}), '
+ 'which does not match your selected language '
+ f'"{language.full_name.capitalize()}" ({language.short_name}). '
+ 'If you believe this is incorrect, try adding more content or '
+ 'rephrasing your text, as language detection works better with '
+ 'longer or more complete sentences.',
}
}
)
diff --git a/wger/core/management/commands/setup-powersync-storage.py b/wger/core/management/commands/setup-powersync-storage.py
index dab3c5395..f2d04cb6f 100644
--- a/wger/core/management/commands/setup-powersync-storage.py
+++ b/wger/core/management/commands/setup-powersync-storage.py
@@ -116,7 +116,9 @@ class Command(BaseCommand):
EXECUTE format('CREATE ROLE %%I LOGIN PASSWORD %%L', user_name, user_pwd);
RAISE NOTICE 'created role %%', user_name;
ELSE
- EXECUTE format('ALTER ROLE %%I WITH LOGIN PASSWORD %%L', user_name, user_pwd);
+ EXECUTE format(
+ 'ALTER ROLE %%I WITH LOGIN PASSWORD %%L', user_name, user_pwd
+ );
RAISE NOTICE 'role %% already exists, password updated', user_name;
END IF;
diff --git a/wger/core/middleware.py b/wger/core/middleware.py
index a6f2c44c2..1cbc41f2e 100644
--- a/wger/core/middleware.py
+++ b/wger/core/middleware.py
@@ -64,7 +64,8 @@ class AuthProxyHeaderMiddleware(MiddlewareMixin):
return None
# Only handle requests to the login page.
- # Here the user will be logged in using the proxy headers and redirected to the original page.
+ # Here the user will be logged in using the proxy headers and redirected
+ # to the original page.
if remove_language_code(request.path_info) != self.login_url_path:
# logger.debug(f'AuthProxyMiddleware: not request to login page. Skipping.')
return None
@@ -126,8 +127,9 @@ class AuthProxyHeaderMiddleware(MiddlewareMixin):
# and log in the header user for consistency.
else:
logger.warning(
- f"AuthProxyMiddleware: User mismatch. Session user '{request.user.get_username()}' "
- f"differs from proxy header user '{username}'. Logging out old user."
+ 'AuthProxyMiddleware: User mismatch. '
+ f"Session user '{request.user.get_username()}' differs from "
+ f"proxy header user '{username}'. Logging out old user."
)
logout(request)
diff --git a/wger/exercises/api/serializers.py b/wger/exercises/api/serializers.py
index 0068ee36c..c20900b5b 100644
--- a/wger/exercises/api/serializers.py
+++ b/wger/exercises/api/serializers.py
@@ -764,7 +764,9 @@ class ExerciseSubmissionSerializer(serializers.ModelSerializer):
if data.get('variation_group') and data.get('variations_connect_to'):
raise serializers.ValidationError(
{
- 'variation_group': 'Either set variation_group or variations_connect_to, not both.'
+ 'variation_group': (
+ 'Either set variation_group or variations_connect_to, not both.'
+ )
}
)
diff --git a/wger/exercises/models/translation.py b/wger/exercises/models/translation.py
index a9e21559b..023a5413f 100644
--- a/wger/exercises/models/translation.py
+++ b/wger/exercises/models/translation.py
@@ -126,7 +126,9 @@ class Translation(AbstractLicenseModel, AbstractHistoryMixin, models.Model):
models.UniqueConstraint(
fields=['exercise', 'language'],
name='unique_exercise_language_translation',
- violation_error_message='A translation for this exercise and language already exists.',
+ violation_error_message=(
+ 'A translation for this exercise and language already exists.'
+ ),
)
]
diff --git a/wger/exercises/tests/api/test_exercise_submission_api.py b/wger/exercises/tests/api/test_exercise_submission_api.py
index 0491d0551..2467d88f7 100644
--- a/wger/exercises/tests/api/test_exercise_submission_api.py
+++ b/wger/exercises/tests/api/test_exercise_submission_api.py
@@ -48,7 +48,10 @@ class ExerciseSubmissionApiTestCase(BaseTestCase, ApiBaseTestCase):
'translations': [
{
'name': '1-Arm Half-Kneeling Lat Pulldown',
- 'description_source': 'Attach a D-Handle to a high pully. And use your lat muscles to pull the weight single handedly.',
+ 'description_source': (
+ 'Attach a D-Handle to a high pully. And use your lat muscles '
+ 'to pull the weight single handedly.'
+ ),
'language': 2,
'license_author': 'tester',
'aliases': [
diff --git a/wger/exercises/tests/test_sync.py b/wger/exercises/tests/test_sync.py
index 285b5f9e3..1f9c906f5 100644
--- a/wger/exercises/tests/test_sync.py
+++ b/wger/exercises/tests/test_sync.py
@@ -560,8 +560,8 @@ class MockExerciseResponse:
"uuid": "581338a1-8e52-405b-99eb-f0724c528bc8",
"name": "Balançoire Kettlebell à 2 mains",
"exercise": 2,
- "description": "<p>Balançoire Kettlebell à deux mains de style russe</p>",
- "description_source": "Balançoire Kettlebell à deux mains de style russe",
+ "description": "<p>Balançoire Kettlebell à deux mains de style russe</p>", # noqa: E501
+ "description_source": "Balançoire Kettlebell à deux mains de style russe", # noqa: E501
"created": "2015-08-03",
"language": 3,
"aliases": [],
diff --git a/wger/gallery/management/commands/check_gallery_images.py b/wger/gallery/management/commands/check_gallery_images.py
index 7c64ffad1..8938abf5a 100644
--- a/wger/gallery/management/commands/check_gallery_images.py
+++ b/wger/gallery/management/commands/check_gallery_images.py
@@ -222,7 +222,10 @@ class Command(BaseCommand):
return {
'valid': False,
'issue_type': 'oversized',
- 'message': f'File too large: {file_size / (1024 * 1024):.1f}MB (max {MAX_FILE_SIZE_MB}MB)',
+ 'message': (
+ f'File too large: {file_size / (1024 * 1024):.1f}MB '
+ f'(max {MAX_FILE_SIZE_MB}MB)'
+ ),
}
except Exception as e:
return {
@@ -255,7 +258,9 @@ class Command(BaseCommand):
return {
'valid': False,
'issue_type': 'invalid_format',
- 'message': f'Unsupported format: {img_format} (allowed: {", ".join(allowed_formats)})',
+ 'message': (
+ f'Unsupported format: {img_format} (allowed: {", ".join(allowed_formats)})'
+ ),
}
# Check for animation
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.py
index 76cd3970f..cfabbc399 100644
--- a/wger/manager/helpers.py
+++ b/wger/manager/helpers.py
@@ -74,10 +74,11 @@ def render_workout_day(
set_count = 1
day_markers.append(len(data))
+ day_name = _('Rest day') if day_data.day.is_rest else day_data.day.name
data.append(
[
Paragraph(
- f'<para align="center">{_("Rest day") if day_data.day.is_rest else day_data.day.name}</para>',
+ f'<para align="center">{day_name}</para>',
styleSheet['SubHeader'],
)
]
diff --git a/wger/manager/models/routine.py b/wger/manager/models/routine.py
index d92771a3a..79697e716 100644
--- a/wger/manager/models/routine.py
+++ b/wger/manager/models/routine.py
@@ -109,7 +109,9 @@ class Routine(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',
+ help_text=(
+ '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/models/session.py b/wger/manager/models/session.py
index 9baa40e0b..2fd7d4ae7 100644
--- a/wger/manager/models/session.py
+++ b/wger/manager/models/session.py
@@ -114,7 +114,9 @@ class WorkoutSession(models.Model):
max_length=2,
choices=IMPRESSION,
default=IMPRESSION_NEUTRAL,
- help_text='Your impression about this workout session. Did you exercise as well as you could?',
+ help_text=(
+ 'Your impression about this workout session. Did you exercise as well as you could?'
+ ),
)
"""
The user's general impression of workout
diff --git a/wger/measurements/migrations/0006_health_sync.py b/wger/measurements/migrations/0006_health_sync.py
index 87c4f7a1b..ccb662285 100644
--- a/wger/measurements/migrations/0006_health_sync.py
+++ b/wger/measurements/migrations/0006_health_sync.py
@@ -148,7 +148,6 @@ class Migration(migrations.Migration):
verbose_name='Value',
),
),
-
# Powersync only re-replicates existing rows when the sync rules file changes
# or when the data changes. In order to avoid problems for self-hoster that
# have not updated the docker repo, we do a no-op update, that forces a
diff --git a/wger/measurements/tests/test_dynamic.py b/wger/measurements/tests/test_dynamic.py
index 4e88726ba..9c6539203 100644
--- a/wger/measurements/tests/test_dynamic.py
+++ b/wger/measurements/tests/test_dynamic.py
@@ -417,10 +417,12 @@ class DuplicateCalculationTestCase(DynamicMeasurementTestCase):
dynamic_params={'category_id': str(waist.pk)},
)
- response = self.create({
- 'dynamic_type': 'WHTR',
- 'dynamic_params': {'category_id': str(waist.pk)},
- })
+ response = self.create(
+ {
+ 'dynamic_type': 'WHTR',
+ 'dynamic_params': {'category_id': str(waist.pk)},
+ }
+ )
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn('dynamic_type', response.data)
@@ -440,10 +442,12 @@ class DuplicateCalculationTestCase(DynamicMeasurementTestCase):
dynamic_params={'category_id': str(waist.pk)},
)
- response = self.create({
- 'dynamic_type': 'WHTR',
- 'dynamic_params': {'category_id': str(hip.pk)},
- })
+ response = self.create(
+ {
+ 'dynamic_type': 'WHTR',
+ 'dynamic_params': {'category_id': str(hip.pk)},
+ }
+ )
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
@@ -460,11 +464,13 @@ class DuplicateCalculationTestCase(DynamicMeasurementTestCase):
dynamic_params={'exercise_id': 1},
)
- response = self.create({
- 'unit': 'kg',
- 'dynamic_type': 'ONE_REP_MAX',
- 'dynamic_params': {'exercise_id': 2},
- })
+ response = self.create(
+ {
+ 'unit': 'kg',
+ 'dynamic_type': 'ONE_REP_MAX',
+ 'dynamic_params': {'exercise_id': 2},
+ }
+ )
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
diff --git a/wger/tasks.py b/wger/tasks.py
index 0a9b9c255..550043c2c 100644
--- a/wger/tasks.py
+++ b/wger/tasks.py
@@ -69,7 +69,9 @@ def start(context, address='localhost', port=8000, settings_path=None, extra_arg
@task(
help={
'settings-path': 'Path to settings file. Leave empty for default (settings.main)',
- 'process-static': 'Whether to process static files (install npm packages and process css). Default: True',
+ 'process-static': (
+ 'Whether to process static files (install npm packages and process css). Default: True'
+ ),
}
)
def bootstrap(context, settings_path=None, process_static=True):