Self hosted FLOSS fitness/workout, nutrition and weight tracker
Fix pep8 errors
Roland Geider3189927f884c
diff --git a/.travis.yml b/.travis.ymlindex ae2c27a17..a273b2dd0 100644--- a/.travis.yml+++ b/.travis.yml@@ -39,7 +39,7 @@ script:- coverage run --source='.' ./manage.py test# Formatting- - pep8 --max-line-length=100 --exclude="urls.py,*migrations*" wger+ - pep8 wger# Code coverage- coverage reportdiff --git a/docs/development.rst b/docs/development.rstindex 737e00d67..a4f4fc894 100644--- a/docs/development.rst+++ b/docs/development.rst@@ -75,7 +75,7 @@ Contributing* **Code according to PEP8**: check that the code is structured as per pep8 butwith a maximum line length of 100. This can be checked automatically with thepep8 tool (pip install pep8) from the command line (travis will do this as part- of the tests): ``pep8 --max-line-length=100--exclude="urls.py,*migrations*" wger``+ of the tests): ``pep8 wger``* **code for python3**: while the application should remain compatible withpython2, use django's suggestion to mantain sanity: code for py3 and treatdiff --git a/setup.cfg b/setup.cfgnew file mode 100644index 000000000..305608721--- /dev/null+++ b/setup.cfg@@ -0,0 +1,4 @@+[pep8]+ exclude = urls.py,*migrations*+ max-line-length = 100+ ignore = W503diff --git a/wger/core/demo.py b/wger/core/demo.pyindex 1dd0786ef..688baa429 100644--- a/wger/core/demo.py+++ b/wger/core/demo.py@@ -116,7 +116,7 @@ def create_demo_entries(user):exercise = Exercise.objects.get(pk=25)else:exercise = Exercise.objects.get(pk=84)- day_set = Set(exerciseday=day, sets=4, order=2)+ day_set = Set(exerciseday=day, sets=4, order=2)day_set.save()day_set.exercises.add(exercise)diff --git a/wger/core/templatetags/wger_extras.py b/wger/core/templatetags/wger_extras.pyindex 898cab06b..0fa3b1c2c 100644--- a/wger/core/templatetags/wger_extras.py+++ b/wger/core/templatetags/wger_extras.py@@ -76,7 +76,7 @@ def pagination(paginator, page):page_range = paginator.page_range# Set the template variables- return {'page': page,+ return {'page': page,'page_range': page_range}diff --git a/wger/core/tests/test_preferences.py b/wger/core/tests/test_preferences.pyindex 834a73fa3..59cce80dd 100644--- a/wger/core/tests/test_preferences.py+++ b/wger/core/tests/test_preferences.py@@ -207,8 +207,8 @@ class PreferencesCalculationsTestCase(WorkoutManagerTestCase):user = User.objects.get(pk=2)bmi = user.userprofile.calculate_bmi()self.assertEqual(bmi,- user.userprofile.weight.quantize(TWOPLACES)- / decimal.Decimal(1.80 * 1.80).quantize(TWOPLACES))+ user.userprofile.weight.quantize(TWOPLACES) /+ decimal.Decimal(1.80 * 1.80).quantize(TWOPLACES))def test_basal_metabolic_rate(self):'''diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.pyindex bf5b6836e..1af1fb143 100644--- a/wger/exercises/management/commands/download-exercise-images.py+++ b/wger/exercises/management/commands/download-exercise-images.py@@ -46,7 +46,7 @@ class Command(BaseCommand):dest='remote_url',default='https://wger.de',help='Remote URL to fetch the exercises from (default: https://wger.de)'),- )+ )help = ('Download exercise images from wger.de and update the local database\n''\n'diff --git a/wger/manager/pdf.py b/wger/manager/pdf.pyindex d2fc2a63e..256fde8bc 100644--- a/wger/manager/pdf.py+++ b/wger/manager/pdf.py@@ -83,15 +83,15 @@ def workout_log(request, id, uidb64=None, token=None):{'description': workout},styleSheet["HeaderBold"])elements.append(p)- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# Iterate through the Workout and render the training daysfor day in workout.canonical_representation['day_list']:elements.append(render_workout_day(day, nr_of_weeks=7))- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# Footer, date and info- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))elements.append(render_footer(request.build_absolute_uri(workout.get_absolute_url())))# write the document and send the response to the browser@@ -277,13 +277,13 @@ def workout_view(request, id, uidb64=None, token=None):elements.append(p)# Filler- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# Append the tableelements.append(t)# Footer, date and info- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))created = datetime.date.today().strftime("%d.%m.%Y")p = Paragraph('''<para align="left">%(date)s -diff --git a/wger/manager/views/schedule.py b/wger/manager/views/schedule.pyindex 5d893e403..3b4c82644 100644--- a/wger/manager/views/schedule.py+++ b/wger/manager/views/schedule.py@@ -124,21 +124,21 @@ def export_pdf(request, pk, uidb64=None, token=None):# Set the titlep = Paragraph(u'<para align="center">{0}</para>'.format(schedule), styleSheet["HeaderBold"])elements.append(p)- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# Iterate through the Workout and render the training daysfor step in schedule.schedulestep_set.all():p = Paragraph(u'<para>{0} {1}</para>'.format(step.duration, _('Weeks')),styleSheet["HeaderBold"])elements.append(p)- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))for day in step.workout.canonical_representation['day_list']:elements.append(render_workout_day(day, nr_of_weeks=7))- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# Footer, date and info- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))url = reverse('manager:schedule:view', kwargs={'pk': schedule.id})elements.append(render_footer(request.build_absolute_uri(url)))diff --git a/wger/nutrition/views/bmi.py b/wger/nutrition/views/bmi.pyindex 50a71fcd7..4c4930d4c 100644--- a/wger/nutrition/views/bmi.py+++ b/wger/nutrition/views/bmi.py@@ -107,7 +107,7 @@ def chart_data(request):{'key': 'obese_class_3', 'height': 150, 'weight': 190},{'key': 'obese_class_3', 'height': 200, 'weight': 190}- ])+ ])# Return the results to the clientreturn HttpResponse(data, 'application/json')diff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.pyindex e798974c3..c70cb6fe5 100644--- a/wger/nutrition/views/plan.py+++ b/wger/nutrition/views/plan.py@@ -300,7 +300,7 @@ def export_pdf(request, id, uidb64=None, token=None):elements.append(p)# Filler- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))# append the table to the documentelements.append(t)@@ -356,7 +356,7 @@ def export_pdf(request, id, uidb64=None, token=None):elements.append(t)# Footer, date and info- elements.append(Spacer(10*cm, 0.5*cm))+ elements.append(Spacer(10 * cm, 0.5 * cm))created = datetime.date.today().strftime("%d.%m.%Y")url = reverse('nutrition:plan:view', kwargs={'id': plan.id})p = Paragraph('''<para align="left">diff --git a/wger/settings_global.py b/wger/settings_global.pyindex f346d5a90..e74e93bab 100644--- a/wger/settings_global.py+++ b/wger/settings_global.py@@ -267,7 +267,7 @@ THUMBNAIL_ALIASES = {'large': {'size': (800, 800), 'quality': 90},'large_cropped': {'size': (800, 800), 'crop': 'smart', 'quality': 90},- },+ },}diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.pyindex 41c77eada..d9f4ec3fc 100644--- a/wger/utils/context_processor.py+++ b/wger/utils/context_processor.py@@ -45,8 +45,8 @@ def processor(request):'request_full_path': full_path,# The current full path with host- 'request_absolute_path': request.build_absolute_uri(),- 'image_absolute_path': request.build_absolute_uri(static_path),+ 'request_absolute_path': request.build_absolute_uri(),+ 'image_absolute_path': request.build_absolute_uri(static_path),# Translation linksdiff --git a/wger/weight/forms.py b/wger/weight/forms.pyindex 666b24d05..6771cd488 100644--- a/wger/weight/forms.py+++ b/wger/weight/forms.py@@ -47,4 +47,4 @@ class WeightForm(ModelForm):exclude = []widgets = {'user': widgets.HiddenInput(),- }+ }