diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-10-02 08:31:01 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-10-02 08:31:01 +0000 |
commit | c4e3c0c776f931b2b347b33dd115f9e833e39fb4 (patch) | |
tree | 7407f6a9b3b824f24dba34cf4300dedebabdb57a | |
parent | 44f8de2880d4665cfffb68958985655a60cb3b16 (diff) | |
parent | c2283582581dff56ce505495a3066f8edd944bc9 (diff) | |
download | horizon-c4e3c0c776f931b2b347b33dd115f9e833e39fb4.tar.gz |
Merge "Fix E127 errors in horizon/"
-rw-r--r-- | horizon/base.py | 8 | ||||
-rw-r--r-- | horizon/forms/fields.py | 4 | ||||
-rw-r--r-- | horizon/tables/actions.py | 4 | ||||
-rw-r--r-- | horizon/tables/base.py | 12 | ||||
-rw-r--r-- | horizon/tables/formset.py | 2 | ||||
-rw-r--r-- | horizon/templatetags/horizon.py | 26 | ||||
-rw-r--r-- | horizon/templatetags/sizeformat.py | 2 | ||||
-rw-r--r-- | horizon/test/helpers.py | 6 | ||||
-rw-r--r-- | horizon/test/patches.py | 8 | ||||
-rw-r--r-- | horizon/test/tests/base.py | 4 | ||||
-rw-r--r-- | horizon/test/tests/middleware.py | 2 | ||||
-rw-r--r-- | horizon/test/tests/tables.py | 8 | ||||
-rw-r--r-- | horizon/test/tests/utils.py | 14 | ||||
-rw-r--r-- | horizon/workflows/base.py | 10 |
14 files changed, 55 insertions, 55 deletions
diff --git a/horizon/base.py b/horizon/base.py index 1734a6fe7..17249c150 100644 --- a/horizon/base.py +++ b/horizon/base.py @@ -170,10 +170,10 @@ class Registry(object): parent = self._registered_with._registerable_class.__name__ raise NotRegistered('%(type)s with slug "%(slug)s" is not ' 'registered with %(parent)s "%(name)s".' - % {"type": class_name, - "slug": cls, - "parent": parent, - "name": self.slug}) + % {"type": class_name, + "slug": cls, + "parent": parent, + "name": self.slug}) else: slug = getattr(cls, "slug", cls) raise NotRegistered('%(type)s with slug "%(slug)s" is not ' diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py index 89c3d8036..5207e7bb1 100644 --- a/horizon/forms/fields.py +++ b/horizon/forms/fields.py @@ -181,8 +181,8 @@ class SelectWidget(widgets.Select): def render_option(self, selected_choices, option_value, option_label): option_value = force_text(option_value) - other_html = (option_value in selected_choices) and \ - u' selected="selected"' or '' + other_html = (u' selected="selected"' + if option_value in selected_choices else '') if callable(self.transform_html_attrs): html_attrs = self.transform_html_attrs(option_label) diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py index 6f825d712..143dad056 100644 --- a/horizon/tables/actions.py +++ b/horizon/tables/actions.py @@ -492,8 +492,8 @@ class FilterAction(BaseAction): # and actions won't allow it. Need to be fixed in the future. cls_name = self.__class__.__name__ raise NotImplementedError("You must define a %s method " - "for %s data type in %s." % - (func_name, data_type, cls_name)) + "for %s data type in %s." % + (func_name, data_type, cls_name)) _data = filter_func(table, data, filter_string) self.assign_type_string(table, _data, data_type) filtered_data.extend(_data) diff --git a/horizon/tables/base.py b/horizon/tables/base.py index 8f6eecfd7..16e3fd9fc 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -768,7 +768,7 @@ class Cell(html.HTMLElement): """Returns a flattened string of the cell's CSS classes.""" if not self.url: self.column.classes = [cls for cls in self.column.classes - if cls != "anchor"] + if cls != "anchor"] column_class_string = self.column.get_final_attrs().get('class', "") classes = set(column_class_string.split(" ")) if self.column.status: @@ -944,8 +944,8 @@ class DataTableOptions(object): """ def __init__(self, options): self.name = getattr(options, 'name', self.__class__.__name__) - verbose_name = getattr(options, 'verbose_name', None) \ - or self.name.title() + verbose_name = (getattr(options, 'verbose_name', None) + or self.name.title()) self.verbose_name = verbose_name self.columns = getattr(options, 'columns', None) self.status_columns = getattr(options, 'status_columns', []) @@ -983,9 +983,9 @@ class DataTableOptions(object): 'template', 'horizon/common/_data_table.html') self.row_actions_template = \ - 'horizon/common/_data_table_row_actions.html' + 'horizon/common/_data_table_row_actions.html' self.table_actions_template = \ - 'horizon/common/_data_table_table_actions.html' + 'horizon/common/_data_table_table_actions.html' self.context_var_name = unicode(getattr(options, 'context_var_name', 'table')) @@ -1300,7 +1300,7 @@ class DataTable(object): if not matches: raise exceptions.Http302(self.get_absolute_url(), _('No match returned for the id "%s".') - % lookup) + % lookup) return matches[0] @property diff --git a/horizon/tables/formset.py b/horizon/tables/formset.py index b7278a52f..a690eee4d 100644 --- a/horizon/tables/formset.py +++ b/horizon/tables/formset.py @@ -138,7 +138,7 @@ class FormsetDataTableMixin(object): formset = self.get_formset() formset.is_valid() for datum, form in itertools.izip_longest(self.filtered_data, - formset): + formset): row = self._meta.row_class(self, datum, form) if self.get_object_id(datum) == self.current_item_id: self.selected = True diff --git a/horizon/templatetags/horizon.py b/horizon/templatetags/horizon.py index a5e1b1645..f798b4a13 100644 --- a/horizon/templatetags/horizon.py +++ b/horizon/templatetags/horizon.py @@ -41,7 +41,7 @@ def has_permissions(user, component): @register.filter def has_permissions_on_list(components, user): return [component for component - in components if has_permissions(user, component)] + in components if has_permissions(user, component)] @register.inclusion_tag('horizon/_accordion_nav.html', takes_context=True) @@ -57,19 +57,19 @@ def horizon_nav(context): for group in panel_groups.values(): allowed_panels = [] for panel in group: - if callable(panel.nav) and panel.nav(context) and \ - panel.can_access(context): + if (callable(panel.nav) and panel.nav(context) and + panel.can_access(context)): allowed_panels.append(panel) - elif not callable(panel.nav) and panel.nav and \ - panel.can_access(context): + elif (not callable(panel.nav) and panel.nav and + panel.can_access(context)): allowed_panels.append(panel) if allowed_panels: non_empty_groups.append((group.name, allowed_panels)) - if callable(dash.nav) and dash.nav(context) and \ - dash.can_access(context): + if (callable(dash.nav) and dash.nav(context) and + dash.can_access(context)): dashboards.append((dash, SortedDict(non_empty_groups))) - elif not callable(dash.nav) and dash.nav and \ - dash.can_access(context): + elif (not callable(dash.nav) and dash.nav and + dash.can_access(context)): dashboards.append((dash, SortedDict(non_empty_groups))) return {'components': dashboards, 'user': context['request'].user, @@ -109,11 +109,11 @@ def horizon_dashboard_nav(context): for group in panel_groups.values(): allowed_panels = [] for panel in group: - if callable(panel.nav) and panel.nav(context) and \ - panel.can_access(context): + if (callable(panel.nav) and panel.nav(context) and + panel.can_access(context)): allowed_panels.append(panel) - elif not callable(panel.nav) and panel.nav and \ - panel.can_access(context): + elif (not callable(panel.nav) and panel.nav and + panel.can_access(context)): allowed_panels.append(panel) if allowed_panels: non_empty_groups.append((group.name, allowed_panels)) diff --git a/horizon/templatetags/sizeformat.py b/horizon/templatetags/sizeformat.py index b64eaba3b..75f58a121 100644 --- a/horizon/templatetags/sizeformat.py +++ b/horizon/templatetags/sizeformat.py @@ -66,7 +66,7 @@ def filesizeformat(bytes, filesize_number_format): return _("%s TB") % \ filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024)) return _("%s PB") % \ - filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024)) + filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024)) def float_cast_filesizeformat(value, multiplier=1, format=int_format): diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 4624406d2..3c5b21d13 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -107,7 +107,7 @@ class RequestFactoryWithMessages(RequestFactory): @unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False), - "The SKIP_UNITTESTS env variable is set.") + "The SKIP_UNITTESTS env variable is set.") class TestCase(django_test.TestCase): """Specialized base test case class for Horizon which gives access to numerous additional features: @@ -191,8 +191,8 @@ class TestCase(django_test.TestCase): msgs = [force_text(m.message) for m in messages if msg_type in m.tags] assert len(msgs) == count, \ - "%s messages not as expected: %s" % (msg_type.title(), - ", ".join(msgs)) + "%s messages not as expected: %s" % (msg_type.title(), + ", ".join(msgs)) @unittest.skipUnless(os.environ.get('WITH_SELENIUM', False), diff --git a/horizon/test/patches.py b/horizon/test/patches.py index 612c967cf..f94714e56 100644 --- a/horizon/test/patches.py +++ b/horizon/test/patches.py @@ -42,8 +42,8 @@ def parse_starttag_patched(self, i): attrname, rest, attrvalue = m.group(1, 2, 3) if not rest: attrvalue = None - elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ - attrvalue[:1] == '"' == attrvalue[-1:]: + elif (attrvalue[:1] == '\'' == attrvalue[-1:] or + attrvalue[:1] == '"' == attrvalue[-1:]): attrvalue = attrvalue[1:-1] if attrvalue: attrvalue = self.unescape(attrvalue) @@ -55,8 +55,8 @@ def parse_starttag_patched(self, i): lineno, offset = self.getpos() if "\n" in self.__starttag_text: lineno = lineno + self.__starttag_text.count("\n") - offset = len(self.__starttag_text) \ - - self.__starttag_text.rfind("\n") + offset = (len(self.__starttag_text) + - self.__starttag_text.rfind("\n")) else: offset = offset + len(self.__starttag_text) self.error("junk characters in start tag: %r" diff --git a/horizon/test/tests/base.py b/horizon/test/tests/base.py index 1ca82073c..73f8b6075 100644 --- a/horizon/test/tests/base.py +++ b/horizon/test/tests/base.py @@ -342,7 +342,7 @@ class GetUserHomeTests(BaseHorizonTests): conf.HORIZON_CONFIG._setup() self.assertEqual(self.test_user.username.upper(), - base.Horizon.get_user_home(self.test_user)) + base.Horizon.get_user_home(self.test_user)) def test_using_module_function(self): module_func = 'django.utils.encoding.force_text' @@ -351,7 +351,7 @@ class GetUserHomeTests(BaseHorizonTests): self.test_user.username = 'testname' self.assertEqual(self.original_username, - base.Horizon.get_user_home(self.test_user)) + base.Horizon.get_user_home(self.test_user)) def test_using_url(self): fixed_url = "/url" diff --git a/horizon/test/tests/middleware.py b/horizon/test/tests/middleware.py index dd6b73937..617351f88 100644 --- a/horizon/test/tests/middleware.py +++ b/horizon/test/tests/middleware.py @@ -56,7 +56,7 @@ class MiddlewareTests(test.TestCase): HTTP_X_REQUESTED_WITH='XMLHttpRequest') request.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' request.horizon = {'async_messages': - [('error', 'error_msg', 'extra_tag')]} + [('error', 'error_msg', 'extra_tag')]} response = HttpResponseRedirect(url) response.client = self.client diff --git a/horizon/test/tests/tables.py b/horizon/test/tests/tables.py index e4fa5d977..ad18f84e3 100644 --- a/horizon/test/tests/tables.py +++ b/horizon/test/tests/tables.py @@ -227,7 +227,7 @@ class MyTable(tables.DataTable): link_attrs={'data-type': 'modal dialog', 'data-tip': 'click for dialog'}) status = tables.Column('status', link=get_link, - cell_attributes_getter=tooltip_dict.get) + cell_attributes_getter=tooltip_dict.get) optional = tables.Column('optional', empty_value='N/A') excluded = tables.Column('excluded') @@ -1219,12 +1219,12 @@ class DataTableTests(test.TestCase): self.assertEqual(row.cells['status'].data, 'down') self.assertEqual(row.cells['status'].attrs, - {'title': 'service is not available', + {'title': 'service is not available', 'style': 'color:red;cursor:pointer'}) self.assertEqual(row1.cells['status'].data, 'up') self.assertEqual(row1.cells['status'].attrs, - {'title': 'service is up and running', - 'style': 'color:green;cursor:pointer'}) + {'title': 'service is up and running', + 'style': 'color:green;cursor:pointer'}) self.assertEqual(row2.cells['status'].data, 'standby') self.assertEqual(row2.cells['status'].attrs, {}) diff --git a/horizon/test/tests/utils.py b/horizon/test/tests/utils.py index 961f10fe3..7f8018a15 100644 --- a/horizon/test/tests/utils.py +++ b/horizon/test/tests/utils.py @@ -79,9 +79,9 @@ class ValidatorsTests(test.TestCase): "1.2.3.4:1111:2222::5555//22", "fe80::204:61ff:254.157.241.86/200", # some valid IPv4 addresses - "10.144.11.107/4", - "255.255.255.255/0", - "0.1.2.3/16") + "10.144.11.107/4", + "255.255.255.255/0", + "0.1.2.3/16") ip = forms.IPField(mask=True, version=forms.IPv6) for cidr in GOOD_CIDRS: self.assertIsNone(ip.validate(cidr)) @@ -149,7 +149,7 @@ class ValidatorsTests(test.TestCase): ipv4 = forms.IPField(required=True, version=forms.IPv4) ipv6 = forms.IPField(required=False, version=forms.IPv6) ipmixed = forms.IPField(required=False, - version=forms.IPv4 | forms.IPv6) + version=forms.IPv4 | forms.IPv6) for ip_addr in GOOD_IPS_V4: self.assertIsNone(ipv4.validate(ip_addr)) @@ -170,9 +170,9 @@ class ValidatorsTests(test.TestCase): self.assertRaises(ValidationError, ipv4.validate, "") # required=True iprange = forms.IPField(required=False, - mask=True, - mask_range_from=10, - version=forms.IPv4 | forms.IPv6) + mask=True, + mask_range_from=10, + version=forms.IPv4 | forms.IPv6) self.assertRaises(ValidationError, iprange.validate, "fe80::204:61ff:254.157.241.86/6") self.assertRaises(ValidationError, iprange.validate, diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py index 6eb5167d4..2ae20b83f 100644 --- a/horizon/workflows/base.py +++ b/horizon/workflows/base.py @@ -67,8 +67,8 @@ class ActionMetaclass(forms.forms.DeclarativeFieldsMetaclass): cls.slug = getattr(opts, "slug", slugify(name)) cls.permissions = getattr(opts, "permissions", ()) cls.progress_message = getattr(opts, - "progress_message", - _("Processing...")) + "progress_message", + _("Processing...")) cls.help_text = getattr(opts, "help_text", "") cls.help_text_template = getattr(opts, "help_text_template", None) return cls @@ -347,8 +347,8 @@ class Step(object): except ImportError: raise ImportError("Could not import %s from the " "module %s as a connection " - "handler on %s." - % (bits[-1], module_name, cls)) + "handler on %s." + % (bits[-1], module_name, cls)) except AttributeError: raise AttributeError("Could not import %s from the " "module %s as a connection " @@ -723,7 +723,7 @@ class Workflow(html.HTMLElement): def _trigger_handlers(self, key): responses = [] handlers = [(step.slug, f) for step in self.steps - for f in step._handlers.get(key, [])] + for f in step._handlers.get(key, [])] for slug, handler in handlers: responses.append((slug, handler(self.request, self.context))) return responses |