Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove 'six' compatibility library
Roland1f98ecd869f8
diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.pyindex 74ce1edd8..cbcb71709 100644--- a/wger/core/tests/base_testcase.py+++ b/wger/core/tests/base_testcase.py@@ -20,7 +20,6 @@ import shutilimport tempfile# Third Party-import sixfrom django.conf import settingsfrom django.core.cache import cachefrom django.urls import (@@ -47,7 +46,7 @@ def get_reverse(url, kwargs={}):# everything was already done in the individual test caseurl = url- return six.text_type(url)+ return str(url)def get_user_list(users):diff --git a/wger/core/tests/test_robots_txt.py b/wger/core/tests/test_robots_txt.pyindex b7101e2be..1b7159748 100644--- a/wger/core/tests/test_robots_txt.py+++ b/wger/core/tests/test_robots_txt.py@@ -13,7 +13,6 @@# You should have received a copy of the GNU Affero General Public License# Third Party-import sixfrom django.urls import reverse# wger@@ -31,4 +30,4 @@ class RobotsTxtTestCase(WorkoutManagerTestCase):response = self.client.get(reverse('robots'))for lang in Language.objects.all():self.assertTrue('wger.de/{0}/sitemap.xml'.format(lang.short_name)- in six.text_type(response.content))+ in str(response.content))diff --git a/wger/exercises/models.py b/wger/exercises/models.pyindex 47670cae2..5321f41ec 100644--- a/wger/exercises/models.py+++ b/wger/exercises/models.py@@ -21,7 +21,6 @@ import uuid# Third Partyimport bleach-import sixfrom django.conf import settingsfrom django.contrib.auth.models import Userfrom django.contrib.sites.models import Site@@ -341,8 +340,8 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):subject = _('New user submitted exercise')message = _(u'The user {0} submitted a new exercise "{1}".').format(request.user.username, self.name)- mail.mail_admins(six.text_type(subject),- six.text_type(message),+ mail.mail_admins(str(subject),+ str(message),fail_silently=True)@@ -463,8 +462,8 @@ class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model)request.user.username,self.name,self.exercise)- mail.mail_admins(six.text_type(subject),- six.text_type(message),+ mail.mail_admins(str(subject),+ str(message),fail_silently=True)diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.pyindex 48c6bb532..17f126883 100644--- a/wger/exercises/views/exercises.py+++ b/wger/exercises/views/exercises.py@@ -9,18 +9,15 @@## wger Workout Manager is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of---# Standard Library# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.+# You should have received a copy of the GNU Affero General Public License++# Standard Libraryimport loggingimport uuid# Third Party-#-# You should have received a copy of the GNU Affero General Public License-import sixfrom django.contrib import messagesfrom django.contrib.auth.decorators import permission_requiredfrom django.contrib.auth.mixins import (@@ -300,8 +297,8 @@ class ExerciseCorrectView(ExercisesEditAddView, LoginRequiredMixin, UpdateView):'user': self.request.user}message = render_to_string('exercise/email_correction.tpl', context)- mail.mail_admins(six.text_type(subject),- six.text_type(message),+ mail.mail_admins(str(subject),+ str(message),fail_silently=True)messages.success(self.request, self.messages)diff --git a/wger/manager/models.py b/wger/manager/models.pyindex 7176808a6..9b011518b 100644--- a/wger/manager/models.py+++ b/wger/manager/models.py@@ -20,7 +20,6 @@ import datetimeimport logging# Third Party-import sixfrom django.contrib.auth.models import Userfrom django.core.cache import cachefrom django.core.exceptions import (@@ -537,7 +536,7 @@ class Day(models.Model):return {'obj': self,'days_of_week': {- 'text': u', '.join([six.text_type(_(i.day_of_week))+ 'text': u', '.join([str(_(i.day_of_week))for i in tmp_days_of_week]),'day_list': tmp_days_of_week},'muscles': {diff --git a/wger/manager/views/ical.py b/wger/manager/views/ical.pyindex 89f82c334..53d0329e5 100644--- a/wger/manager/views/ical.py+++ b/wger/manager/views/ical.py@@ -19,7 +19,6 @@ import datetimeimport logging# Third Party-import sixfrom django.contrib.sites.models import Sitefrom django.http import (HttpResponse,@@ -97,7 +96,7 @@ def get_events_workout(calendar, workout, duration, start_date=None):description_list = []for set in day['set_list']:for exercise in set['exercise_list']:- description_list.append(six.text_type(exercise['obj']))+ description_list.append(str(exercise['obj']))description = ', '.join(description_list) if description_list else day['obj'].description# Make an event for each weekdaydiff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.pyindex adc923de6..099608051 100644--- a/wger/nutrition/views/plan.py+++ b/wger/nutrition/views/plan.py@@ -19,7 +19,6 @@ import datetimeimport logging# Third Party-import sixfrom django.contrib.auth.decorators import login_requiredfrom django.urls import (reverse,@@ -341,32 +340,32 @@ def export_pdf(request, id, uidb64=None, token=None):Paragraph(_('Percent of energy'), styleSheet["Normal"]),Paragraph(_('g per body kg'), styleSheet["Normal"])])data.append([Paragraph(_('Energy'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['energy']), styleSheet["Normal"])])+ Paragraph(str(plan_data['total']['energy']), styleSheet["Normal"])])data.append([Paragraph(_('Protein'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['protein']), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['percent']['protein']), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['per_kg']['protein']), styleSheet["Normal"])])+ Paragraph(str(plan_data['total']['protein']), styleSheet["Normal"]),+ Paragraph(str(plan_data['percent']['protein']), styleSheet["Normal"]),+ Paragraph(str(plan_data['per_kg']['protein']), styleSheet["Normal"])])data.append([Paragraph(_('Carbohydrates'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['carbohydrates']),+ Paragraph(str(plan_data['total']['carbohydrates']),styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['percent']['carbohydrates']),+ Paragraph(str(plan_data['percent']['carbohydrates']),styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['per_kg']['carbohydrates']),+ Paragraph(str(plan_data['per_kg']['carbohydrates']),styleSheet["Normal"])])data.append([Paragraph(_('Sugar content in carbohydrates'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['carbohydrates_sugar']),+ Paragraph(str(plan_data['total']['carbohydrates_sugar']),styleSheet["Normal"])])data.append([Paragraph(_('Fat'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['fat']), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['percent']['fat']), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['per_kg']['fat']), styleSheet["Normal"])])+ Paragraph(str(plan_data['total']['fat']), styleSheet["Normal"]),+ Paragraph(str(plan_data['percent']['fat']), styleSheet["Normal"]),+ Paragraph(str(plan_data['per_kg']['fat']), styleSheet["Normal"])])data.append([Paragraph(_('Saturated fat content in fats'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['fat_saturated']),+ Paragraph(str(plan_data['total']['fat_saturated']),styleSheet["Normal"])])data.append([Paragraph(_('Fibres'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['fibres']), styleSheet["Normal"])])+ Paragraph(str(plan_data['total']['fibres']), styleSheet["Normal"])])data.append([Paragraph(_('Sodium'), styleSheet["Normal"]),- Paragraph(six.text_type(plan_data['total']['sodium']), styleSheet["Normal"])])+ Paragraph(str(plan_data['total']['sodium']), styleSheet["Normal"])])table_style = []table_style.append(('BOX', (0, 0), (-1, -1), 1.25, colors.black))diff --git a/wger/weight/helpers.py b/wger/weight/helpers.pyindex 3baa8b2c4..100a8b1b6 100644--- a/wger/weight/helpers.py+++ b/wger/weight/helpers.py@@ -20,10 +20,10 @@ import datetimeimport decimalimport jsonimport logging+import iofrom collections import OrderedDict# Third Party-import sixfrom django.core.cache import cache# wger@@ -47,7 +47,7 @@ def parse_weight_csv(request, cleaned_data):dialect = 'excel'# csv.reader expects a file-like object, so use StringIO- parsed_csv = csv.reader(six.StringIO(cleaned_data['csv_input']),+ parsed_csv = csv.reader(io.StringIO(cleaned_data['csv_input']),dialect)distinct_weight_entries = []entry_dates = set()