From e6f423604a4041cba3c1edfe856c6db14c5bc243 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sat, 11 Jan 2020 16:42:13 +0100 Subject: [PATCH] Remove six usage This repo does not support Python 2 anymore, so we don't need six for compatibility between Python2 and 3, convert six usage to Python 3 code. Change-Id: Id84564d8350fb793a2511abae218db17ea122873 Needed-By: https://review.opendev.org/701743 --- mistraldashboard/default/smart_cell.py | 6 ++---- mistraldashboard/workbooks/forms.py | 4 +--- mistraldashboard/workflows/forms.py | 4 +--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/mistraldashboard/default/smart_cell.py b/mistraldashboard/default/smart_cell.py index b5404ab..56460bc 100644 --- a/mistraldashboard/default/smart_cell.py +++ b/mistraldashboard/default/smart_cell.py @@ -22,8 +22,6 @@ from django import template from horizon.tables import base -import six - def get_data(self, datum, column, row): """Fetches the data to be displayed in this cell.""" @@ -34,7 +32,7 @@ def get_data(self, datum, column, row): widget = forms.CheckboxInput(check_test=lambda value: False) # Convert value to string to avoid accidental type conversion data = widget.render('object_ids', - six.text_type(table.get_object_id(datum)), + str(table.get_object_id(datum)), {'class': 'table-row-multi-select'}) table._data_cache[column][table.get_object_id(datum)] = data elif column.auto == "form_field": @@ -44,7 +42,7 @@ def get_data(self, datum, column, row): widget_name = "%s__%s" % \ (column.name, - six.text_type(table.get_object_id(datum))) + str(table.get_object_id(datum))) # Create local copy of attributes, so it don't change column # class form_field_attributes diff --git a/mistraldashboard/workbooks/forms.py b/mistraldashboard/workbooks/forms.py index 8caac05..d3cff93 100644 --- a/mistraldashboard/workbooks/forms.py +++ b/mistraldashboard/workbooks/forms.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import six - from django.urls import reverse from django.utils.translation import ugettext_lazy as _ @@ -78,7 +76,7 @@ class DefinitionForm(forms.SelfHandlingForm): cleaned_data['definition'] ) except Exception as e: - raise forms.ValidationError(six.text_type(e)) + raise forms.ValidationError(str(e)) if not validated.get('valid'): raise forms.ValidationError( diff --git a/mistraldashboard/workflows/forms.py b/mistraldashboard/workflows/forms.py index acec683..ba2608f 100644 --- a/mistraldashboard/workflows/forms.py +++ b/mistraldashboard/workflows/forms.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import six - from django.urls import reverse from django.utils.translation import ugettext_lazy as _ @@ -131,7 +129,7 @@ class DefinitionForm(forms.SelfHandlingForm): cleaned_data['definition'] ) except Exception as e: - raise forms.ValidationError(six.text_type(e)) + raise forms.ValidationError(str(e)) if not validated.get('valid'): raise forms.ValidationError(