Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Automatic linting

Github-actionsb6adb95d8acb
diff --git a/wger/core/api/views.py b/wger/core/api/views.py
index 1c4dd3ca1..73dcada11 100644
--- a/wger/core/api/views.py
+++ b/wger/core/api/views.py
@@ -59,10 +59,10 @@ from wger.core.api.serializers import (
LanguageSerializer,
LicenseSerializer,
RepetitionUnitSerializer,
+ RoutineWeightUnitSerializer,
UserApiSerializer,
UserprofileSerializer,
UserRegistrationSerializer,
- RoutineWeightUnitSerializer,
)
from wger.core.forms import UserLoginForm
from wger.core.models import (
@@ -76,6 +76,7 @@ from wger.core.models import (
from wger.utils.api_token import create_token
from wger.utils.permissions import WgerPermission
+
logger = logging.getLogger(__name__)
@@ -169,7 +170,7 @@ class ApplicationVersionView(viewsets.ViewSet):
"""
Returns the application's version
"""
- permission_classes = (AllowAny,)
+ permission_classes = (AllowAny, )
@staticmethod
@extend_schema(
@@ -186,7 +187,7 @@ class PermissionView(viewsets.ViewSet):
"""
Checks whether the user has a django permission
"""
- permission_classes = (AllowAny,)
+ permission_classes = (AllowAny, )
@staticmethod
@extend_schema(
@@ -200,13 +201,13 @@ class PermissionView(viewsets.ViewSet):
],
responses={
201:
- inline_serializer(name='PermissionResponse', fields={
- 'result': BooleanField(),
- }),
+ inline_serializer(name='PermissionResponse', fields={
+ 'result': BooleanField(),
+ }),
400:
- OpenApiResponse(
- description="Please pass a permission name in the 'permission' parameter"
- ),
+ OpenApiResponse(
+ description="Please pass a permission name in the 'permission' parameter"
+ ),
},
)
def get(request):
@@ -229,7 +230,7 @@ class RequiredApplicationVersionView(viewsets.ViewSet):
Returns the minimum required version of flutter app to access this server
such as 1.4.2 or 3.0.0
"""
- permission_classes = (AllowAny,)
+ permission_classes = (AllowAny, )
@staticmethod
@extend_schema(
@@ -249,7 +250,7 @@ class UserAPILoginView(viewsets.ViewSet):
Note that it is recommended to use token authorization instead.
"""
- permission_classes = (AllowAny,)
+ permission_classes = (AllowAny, )
queryset = User.objects.all()
serializer_class = UserApiSerializer
throttle_scope = 'login'
@@ -270,10 +271,10 @@ class UserAPILoginView(viewsets.ViewSet):
parameters=[],
responses={
status.HTTP_200_OK:
- inline_serializer(
- name='loginSerializer',
- fields={'token': CharField()},
- ),
+ inline_serializer(
+ name='loginSerializer',
+ fields={'token': CharField()},
+ ),
}
)
def post(self, request):
@@ -306,7 +307,7 @@ class UserAPIRegistrationViewSet(viewsets.ViewSet):
"""
API endpoint
"""
- permission_classes = (AllowRegisterUser,)
+ permission_classes = (AllowRegisterUser, )
serializer_class = UserRegistrationSerializer
def get_queryset(self):
@@ -319,10 +320,10 @@ class UserAPIRegistrationViewSet(viewsets.ViewSet):
parameters=[],
responses={
status.HTTP_200_OK:
- inline_serializer(
- name='loginSerializer',
- fields={'token': CharField()},
- ),
+ inline_serializer(
+ name='loginSerializer',
+ fields={'token': CharField()},
+ ),
}
)
def post(self, request):
@@ -369,7 +370,7 @@ class DaysOfWeekViewSet(viewsets.ReadOnlyModelViewSet):
queryset = DaysOfWeek.objects.all()
serializer_class = DaysOfWeekSerializer
ordering_fields = '__all__'
- filterset_fields = ('day_of_week',)
+ filterset_fields = ('day_of_week', )
class LicenseViewSet(viewsets.ReadOnlyModelViewSet):
@@ -393,7 +394,7 @@ class RepetitionUnitViewSet(viewsets.ReadOnlyModelViewSet):
queryset = RepetitionUnit.objects.all()
serializer_class = RepetitionUnitSerializer
ordering_fields = '__all__'
- filterset_fields = ('name',)
+ filterset_fields = ('name', )
class RoutineWeightUnitViewSet(viewsets.ReadOnlyModelViewSet):
@@ -403,4 +404,4 @@ class RoutineWeightUnitViewSet(viewsets.ReadOnlyModelViewSet):
queryset = WeightUnit.objects.all()
serializer_class = RoutineWeightUnitSerializer
ordering_fields = '__all__'
- filterset_fields = ('name',)
+ filterset_fields = ('name', )
diff --git a/wger/core/models/profile.py b/wger/core/models/profile.py
index ba7ca646f..8edda7b73 100644
--- a/wger/core/models/profile.py
+++ b/wger/core/models/profile.py
@@ -523,8 +523,8 @@ by the US Department of Agriculture. It is extremely complete, with around
"""
if (
not WeightEntry.objects.filter(user=self.user).exists() or (
- datetime.date.today() - WeightEntry.objects.filter(user=self.user).latest().date >
- datetime.timedelta(days=3)
+ datetime.date.today() - WeightEntry.objects.filter(user=self.user).latest().date
+ > datetime.timedelta(days=3)
)
):
entry = WeightEntry()
diff --git a/wger/settings_global.py b/wger/settings_global.py
index 11a918d0c..969124fb9 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -24,6 +24,7 @@ from datetime import timedelta
from wger import get_version
from wger.utils.constants import DOWNLOAD_INGREDIENT_WGER
+
"""
This file contains the global settings that don't usually need to be changed.
For a full list of options, visit:
@@ -170,7 +171,8 @@ TEMPLATES = [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
- 'debug': False
+ 'debug':
+ False
},
},
]
@@ -253,7 +255,7 @@ AVAILABLE_LANGUAGES = (
LANGUAGE_CODE = 'en'
# All translation files are in one place
-LOCALE_PATHS = (os.path.join(SITE_ROOT, 'locale'),)
+LOCALE_PATHS = (os.path.join(SITE_ROOT, 'locale'), )
# Primary keys are AutoFields
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
@@ -452,19 +454,34 @@ REST_FRAMEWORK = {
# Api docs
SPECTACULAR_SETTINGS = {
- 'TITLE': 'wger',
+ 'TITLE':
+ 'wger',
'SERVERS': [
- {'url': '/', 'description': 'This server'},
- {'url': 'https://wger.de', 'description': 'The "official" upstream wger instance'},
+ {
+ 'url': '/',
+ 'description': 'This server'
+ },
+ {
+ 'url': 'https://wger.de',
+ 'description': 'The "official" upstream wger instance'
+ },
],
- 'DESCRIPTION': 'Self hosted FLOSS workout and fitness tracker',
- 'VERSION': get_version(),
- 'SERVE_INCLUDE_SCHEMA': True,
- 'SCHEMA_PATH_PREFIX': '/api/v[0-9]',
- 'SWAGGER_UI_DIST': 'SIDECAR',
- 'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
- 'REDOC_DIST': 'SIDECAR',
- 'COMPONENT_SPLIT_REQUEST': True
+ 'DESCRIPTION':
+ 'Self hosted FLOSS workout and fitness tracker',
+ 'VERSION':
+ get_version(),
+ 'SERVE_INCLUDE_SCHEMA':
+ True,
+ 'SCHEMA_PATH_PREFIX':
+ '/api/v[0-9]',
+ 'SWAGGER_UI_DIST':
+ 'SIDECAR',
+ 'SWAGGER_UI_FAVICON_HREF':
+ 'SIDECAR',
+ 'REDOC_DIST':
+ 'SIDECAR',
+ 'COMPONENT_SPLIT_REQUEST':
+ True
}
#
@@ -487,7 +504,7 @@ CORS_URLS_REGEX = r'^/api/.*$'
#
# Ignore these URLs if they cause 404
#
-IGNORABLE_404_URLS = (re.compile(r'^/favicon\.ico$'),)
+IGNORABLE_404_URLS = (re.compile(r'^/favicon\.ico$'), )
#
# Password rules
diff --git a/wger/urls.py b/wger/urls.py
index fbe5c1099..155024b12 100644
--- a/wger/urls.py
+++ b/wger/urls.py
@@ -53,6 +53,7 @@ from wger.nutrition.sitemap import NutritionSitemap
from wger.utils.generic_views import TextTemplateView
from wger.weight.api import views as weight_api_views
+
# admin.autodiscover()
#